Quick Start
1
Simple Agent
2
Agent with Tools
Tool failures don’t stop the run. If a tool raises an exception or returns something that isn’t JSON-serializable (
datetime, set, bytes, custom classes), the sync and async loops both convert it to {"error": "<message>"} or {"result": "<str(value)>"} and feed it back to the model. agent.start() / agent.chat() continues so the model can recover or apologise (PR #3855).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.AgentTeam is the canonical multi-agent class; AgentManager, Agents, and PraisonAIAgents are silent aliases for the same class — see Back-compat class aliases.Related
Tools — add capabilities like web search and code execution
Memory — give agents persistent memory across sessions

