Skip to main content

Overview

An Agentor agent is a model, a set of tools, and the loop that drives them. The loop calls the model; if the model asks for tools, the loop runs them and feeds the results back; it repeats until the model stops asking or the turn budget runs out. Everything the loop does is emitted as an event. Streaming, the final result, traces, and durable runs are all views of that one stream.

Agent Class

The core Agentor class provides the primary interface for building agents:

Constructor Parameters

str
required
Agent name used in logs, traces, and A2A protocol agent cards
str
System prompt defining agent behavior and personality
str | Model
default:"gpt-5-nano"
Model identifier:
  • "gpt-5-mini" — OpenAI models
  • "gemini/gemini-2.5-flash" — a provider/model string, routed through LiteLLM
  • any name the provider recognises, when base_url is set
str
An OpenAI-compatible endpoint to use instead of OpenAI. See Model providers.
List[Callable | Tool | str | BaseTool | MCPServer]
Tools available to the agent. Can be:
  • String names from the tool registry ("get_weather", "current_datetime")
  • Functions decorated with @function_tool, or plain callables
  • BaseTool subclasses with @capability methods
  • MCPServer connections
type[BaseModel]
Pydantic model describing the shape of the answer. See Structured output.
int
default:20
How many model calls a run may make before it ends with status="max_turns".
Store
Where to save the run’s events, so it can be resumed. See Durable runs.
ModelSettings
Model configuration including temperature, top_p, max_tokens
List[str]
Paths to skill directories (see Skills)
bool
default:false
Enable Celesto AI tracing and observability
str
API key for the LLM provider

Creating Agents from Markdown

Agents can be defined in markdown files with YAML frontmatter:
Load the agent:

Agent Lifecycle

Synchronous Execution

The run() method provides synchronous execution:

Asynchronous Execution

The arun() method supports async execution with batch processing:

Fallback Models

Handle rate limits gracefully with fallback models:
If the primary model fails with rate limit or API errors, Agentor automatically retries with fallback models in order.

Streaming Responses

Stream agent responses in real-time:
The stream_chat() method returns an async iterator of AgentOutput objects:

Model Configuration

Configure model behavior with ModelSettings:

Multi-Agent Systems

Agents talk to each other over the A2A protocol. Call agent.serve() and each agent becomes an addressable service with a published agent card, so one agent can delegate to another across processes or machines.

Agent Context

A tool can ask for the run’s shared configuration by annotating a parameter as RunContext. That parameter is filled in by the engine rather than by the model, so it never appears in the tool’s schema:
The older RunContextWrapper annotation from openai-agents is still recognised, so tools written before 0.1.0 keep working without an edit.

Tracing and Observability

Opt in to tracing with Celesto AI:
Traces appear at https://celesto.ai/observe. Tracing is off unless you ask for it, so there is nothing to disable. To exclude a single run from an agent that has it on, pass tracing=False on that call.

Next Steps

Tools

Learn how to add tools to your agents

Skills

Add specialized skills to improve agent performance

Deployment

Deploy your agent to production

A2A Protocol

Enable agent-to-agent communication
Last modified on August 28, 2026