Single-Agent Systems¶
Start with one agent. Add tools as needed. Keep it simple.
Basic Pattern¶
from pauhu import Agent, Runner
agent = Agent(
name="Assistant",
instructions="Help users with their requests.",
tools=[search, calculate, send_email],
)
result = await Runner.run(agent, "What's 15% of $240?")
print(result) # "$36"
Running the Agent¶
The Runner.run() loop continues until:
- The agent returns a final answer
- The agent calls no more tools
- An error occurs or max turns reached
# Simple usage
result = await Runner.run(agent, "Book a meeting for tomorrow at 2pm")
# With options
result = await Runner.run(
agent,
"Research competitor pricing",
max_turns=10,
)
Adding Capabilities¶
Need more? Add another tool.
# Started with basic tools
agent = Agent(tools=[search, summarize])
# Later, add more
agent = Agent(tools=[search, summarize, translate, export_pdf])
When to Stay Single-Agent¶
Single agent works well when:
- Tasks are related (all customer support, all research)
- Tools don't overlap (clear purpose for each)
- Instructions stay manageable (< 500 words)
When to Split¶
Consider multiple agents when:
- Instructions get complex with many if-then branches
- Tools overlap and the agent picks wrong ones
- Different tasks need different expertise