Skip to main content
An Agent is an AI that follows your instructions, uses tools, and completes tasks through conversation.
The user asks a question; the agent runs a single turn and returns the answer.

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


Best Practices

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.
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.
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.
Always set name when using multiple agents. Names appear in logs, hooks callbacks, and help diagnose which agent produced which output in complex workflows.

Tools — add capabilities like web search and code execution

Memory — give agents persistent memory across sessions