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 coreAgentor 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"— aprovider/modelstring, routed through LiteLLM- any name the provider recognises, when
base_urlis 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 BaseToolsubclasses with@capabilitymethodsMCPServerconnections
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
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:Agent Lifecycle
Synchronous Execution
Therun() method provides synchronous execution:
Asynchronous Execution
Thearun() method supports async execution with batch processing:
Fallback Models
Handle rate limits gracefully with fallback models:Streaming Responses
Stream agent responses in real-time:stream_chat() method returns an async iterator of AgentOutput objects:
Model Configuration
Configure model behavior withModelSettings:
Multi-Agent Systems
Agents talk to each other over the A2A protocol. Callagent.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 asRunContext. 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: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
