Agent class represents an individual AI agent that can be executed.
AgentBuilder
The recommended way to create agents is withAgentBuilder:
AgentBuilder Methods
| Method | Description |
|---|---|
with_provider(provider, model) | Set LLM provider and model |
with_system_prompt(prompt) | Set system prompt |
with_tools(tools) | Set allowed tools |
with_state_ownership(patterns) | Set state ownership patterns |
with_config(config) | Set full AgentConfig |
build(gateway) | Build the agent |
Agent Methods
run()
Execute the agent.| Parameter | Type | Description |
|---|---|---|
task | str | What the agent should do |
context | dict | None | Additional context |
AgentConfig
Configuration dataclass for agents:AgentConfig Fields
| Field | Type | Default | Description |
|---|---|---|---|
agent_id | str | Required | Unique identifier |
provider | LLMProvider | Required | LLM provider to use |
model | str | Required | Model name |
system_prompt | str | "" | System prompt |
tools | list[str] | [] | Allowed tools |
state_ownership | list[str] | [] | State ownership patterns |
max_steps | int | None | None | Max steps for this agent |
temperature | float | 0.7 | Temperature |