Agent Patterns
Agents are systems where the LLM controls the flow. The developer provides tools and constraints; the LLM decides what to do.
When to use agents instead of workflows:
- The required steps are unknown at design time
- The task needs to react to unexpected observations
- You need open-ended tool use and dynamic decision-making
- The workflow conditional logic has become too complex to hardcode
ReAct
Reason-act loop: the LLM reasons, calls a tool, observes, and repeats until done.
Plan & Execute
LLM creates a full plan upfront, then executes each step sequentially.
Tool Use
Structured function calling with schema-validated tool dispatch.
Memory
Persistent state across sessions: short-term, long-term, and semantic memory.
RAG
Retrieval-augmented generation: retrieve relevant context before generating.
Reflection
LLM critiques its own output and self-improves through structured feedback.
Routing
Intent classification dispatches inputs to specialized handlers.
Multi-Agent
Supervisor-worker delegation across multiple autonomous agents.