Quick Start
1
Simple Agent
2
Agent with Tools
3
Agent with Features
How It Works
Key Parameters
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

