Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.opper.ai/llms.txt

Use this file to discover all available pages before exploring further.

Source: opper-ai/opper-sdks. The agent layer ships inside the unified opperai package — no separate install.

1. Install

pip install opperai
# or: uv add opperai
Requirements: Python 3.10+ or Node.js 18+. TypeScript users need Zod v4.

2. Set your API key

export OPPER_API_KEY="your-api-key"
Get a key at platform.opper.ai. You can also pass it explicitly via client={"api_key": "..."} (Python) or client: { apiKey: "..." } (TypeScript) on the Agent constructor.

3. Run an agent

import asyncio
from opperai.agent import Agent, tool

@tool
def add(a: int, b: int) -> int:
    """Add two numbers."""
    return a + b

@tool
def multiply(a: int, b: int) -> int:
    """Multiply two numbers."""
    return a * b

async def main() -> None:
    agent = Agent(
        name="math-agent",
        instructions="You are a helpful math assistant. Show the steps.",
        tools=[add, multiply],
    )

    result = await agent.run("What is 5 + 3, then multiplied by 2?")

    print("Output:", result.output)
    print("Iterations:", result.meta.iterations)
    print("Tokens:", result.meta.usage.total_tokens)

asyncio.run(main())
The agent picks add(5, 3) = 8, then multiply(8, 2) = 16, then returns. Every tool call is captured in result.meta.tool_calls (Python) / result.meta.toolCalls (TS).

4. Run an end-to-end example

The repo ships numbered examples that each demonstrate one pattern. Run them directly:
git clone https://github.com/opper-ai/opper-sdks
cd opper-sdks/python
uv run python examples/agents/00_first_agent.py

Next

Tools

Define tools the agent can call.

Structured output

Return validated, typed data instead of free text.

Streaming

Observe the agent’s work as it happens.

Multi-agent

Compose specialists into a coordinator.