Skip to content

Agent Components

Every agent consists of three core components:

  1. Model - The LLM powering reasoning
  2. Tools - External functions for actions
  3. Instructions - Guidelines for behavior
from pauhu import Agent

weather_agent = Agent(
    name="Weather Agent",
    model="claude-sonnet-4-20250514",
    instructions="Help users understand weather conditions and forecasts.",
    tools=[get_current_weather, get_forecast],
)

Model

The model powers the agent's reasoning and decision-making. Different models have different strengths:

Model Type Best For
Large (GPT-4, Claude) Complex reasoning, nuanced decisions
Medium (GPT-4o-mini) Balanced cost/performance
Small (Llama 3.2) Simple tasks, high volume

Best Practice: Start with the most capable model to establish a baseline. Then try smaller models to see if they achieve acceptable results.

Tools

Tools extend agent capabilities. Three types:

Data Tools

Retrieve context and information.

@function_tool
def search_orders(customer_id: str) -> list[dict]:
    """Search customer order history."""
    return db.orders.find({"customer_id": customer_id})

Action Tools

Interact with systems to make changes.

@function_tool
def send_email(to: str, subject: str, body: str) -> bool:
    """Send an email to a customer."""
    return email_service.send(to, subject, body)

Orchestration Tools

Other agents can serve as tools.

manager = Agent(
    tools=[
        refund_agent.as_tool(description="Process refund requests"),
        shipping_agent.as_tool(description="Handle shipping inquiries"),
    ]
)

Instructions

Clear instructions reduce ambiguity and improve decisions.

Best Practices

Use existing documents - Convert operating procedures, support scripts, and policies into agent instructions.

Break down tasks - Provide smaller, clearer steps from dense resources.

Define clear actions - Every step should correspond to a specific action or output.

Capture edge cases - Include instructions for common variations and decision points.

Example

Agent(
    instructions="""
    You are a customer support agent for an e-commerce company.

    When a customer reports a problem:
    1. Greet them and acknowledge the issue
    2. Look up their order using search_orders
    3. If order exists, check its status
    4. For delivery issues, offer tracking or refund
    5. For product issues, offer replacement or refund
    6. If unsure, escalate to human support

    Always be polite and apologize for inconvenience.
    Never promise something you cannot deliver.
    """
)

Next Steps