Command Palette

Search for a command to run...

All patterns
Agents

Agent System

An LLM with tools that can decide, act and observe in a loop until a task is complete.

User
Agent
Tools
APIs
Response
clientservicemodeldatabaseagentexternal
Explanation

The agent receives a task, reasons about which tool to call, executes the tool, observes the result, and loops until it can produce a final answer. This is the ReAct pattern.

Components
LLM with function callingTool definitions (schemas)Tool execution layerAgent loop / orchestratorMemory / state
When to use
  • Multi-step research tasks
  • Tasks requiring external data or actions
  • Workflows where the steps depend on intermediate results
When NOT to use
  • When the steps are fixed (use a deterministic workflow)
  • When latency or cost budget is tight
  • High-stakes actions without human approval
Failure modes
  • Infinite loops / tool thrashing
  • Hallucinated tool arguments
  • Premature termination
  • Tool errors cascading
  • Cost blowouts from unconstrained loops
  • Prompt injection via tool outputs
Production checklist
  • Max iteration limit
  • Per-run cost budget
  • Tool argument validation
  • Tool output sanitisation
  • Trace logging of every step
  • Human-in-the-loop for destructive actions
  • Timeout per tool call
  • Fallback to deterministic path on failure