Quick Start
How It Works
| Phase | What happens |
|---|---|
| 1. Receive | Agent receives user input |
| 2. Think | LLM decides whether to respond or call a tool |
| 3. Act | If tool needed, executes it and feeds result back |
| 4. Respond | Final answer returned to user |
Key Parameters
| Parameter | Type | Description |
|---|---|---|
name | str | Agent name (shown in logs and multi-agent setups) |
instructions | str | System prompt — what the agent does and how |
llm | str | Model name (e.g., "gpt-4o", "claude-3-5-sonnet") |
tools | list | List of tools the agent can use |
memory | bool | MemoryConfig | Enable conversation memory |
planning | bool | PlanningConfig | Enable pre-execution planning |
reflection | bool | ReflectionConfig | Enable self-review of responses |
caching | bool | CachingConfig | Enable response caching |
output | str | OutputConfig | Control response verbosity |
execution | str | ExecutionConfig | Control iteration and budget limits |
Common Patterns
Pattern 1 — Simple Q&A agent
Pattern 2 — Specialized domain agent
Pattern 3 — Fully-featured production agent
Best Practices
Write clear instructions
Write clear instructions
The
instructions parameter is your agent’s personality and purpose. Be specific: “You are a customer support agent for Acme Corp. Answer questions about orders, returns, and products. Escalate billing disputes to a human.” Clear instructions outperform vague ones every time.Add features progressively
Add features progressively
Start with just
Agent(instructions="...") and add features (memory, planning, reflection) one at a time. Each feature has a cost — only add what your use case actually needs.Use the right model
Use the right model
gpt-4o-mini handles simple Q&A and extraction cheaply and fast. Use gpt-4o or claude-3-5-sonnet for complex reasoning, code generation, and nuanced writing tasks.Name agents in multi-agent setups
Name agents in multi-agent setups
Always set
name when using multiple agents. Names appear in logs, hooks callbacks, and help diagnose which agent produced which output in complex workflows.Related
Tools — add capabilities like web search and code execution
Memory — give agents persistent memory across sessions

