What is an Agent?
An agent is an AI system that can:- Think - Reason about how to accomplish a goal
- Act - Execute tools to interact with the world
- Observe - Process results and decide next steps
- Loop - Continue until the goal is achieved
Key Features
Type-Safe Tools
Define tools with full type safety using Pydantic (Python) or Zod (TypeScript). Input and Output validation happens automatically.
Agent Composition
Use agents as tools within other agents. Build complex multi-agent systems with clear hierarchies.
Persistent Memory
Enable memory to persist state across iterations. The LLM decides what to remember and recall.
MCP Integration
Connect to Model Context Protocol servers for filesystem access, databases, APIs, and more.
Lifecycle Hooks
Monitor agent execution with hooks for starts, tool calls, LLM responses, and errors.
Streaming
Stream responses token-by-token for responsive UIs and real-time feedback.
How It Works
The agent follows a think-act loop:1
Think
The LLM analyzes the goal and available tools, then decides which tools to call—or whether to respond directly.
2
Act
Execute the selected tools and collect their results. If no tools are needed, skip to the final step.
3
Observe
Process tool results and update the agent’s context for the next iteration.
4
Loop or Return
If more work is needed, return to Think. Otherwise, validate the output against the schema and return the final answer.
Quick Example
When to Use the Agent SDK
Good use cases:- Tasks requiring multiple steps or tool calls
- Dynamic decision-making based on intermediate results
- Complex workflows with branching logic
- Multi-agent coordination
- Tasks requiring persistent memory
- Simple one-shot LLM calls (use the Opper API directly)
- Fixed, deterministic workflows (use traditional programming)
- Real-time latency-critical applications