Skip to main content
AgentConfig is an immutable dataclass that controls every aspect of agent behavior. Pass it when creating an agent, or use the defaults.

Basic Configuration

Configuration Reference

Identity

str
Unique identifier for the agent. Auto-generated UUID if not set.
str
Human-readable name used in logs and traces.

Execution

int
default:"10"
Maximum number of model-call-then-tool-execution loops before stopping. Prevents infinite loops when the model keeps calling tools.
int
Token limit per run. Stops execution if exceeded.
float
default:"300.0"
Timeout in seconds for streaming responses.

Reliability

bool
default:"true"
Automatically retry on transient network errors.
int
default:"3"
Maximum number of retry attempts for transient errors.
bool
default:"true"
Validate tool arguments against their schema before execution.

State & Dependencies

Dict[str, Any]
Default session state available to tools. Merged with per-run state.
Dict[str, Any]
Dependencies injected into tools that declare them (e.g., database connections, API clients).

Tracing

Tracing
Tracing configuration (backward compat). Prefer passing tracing=Tracing(...) directly to Agent. See Tracing for details.

Compression

Compression is configured directly on the Agent constructor (not in AgentConfig):

Readers

ReadersConfig
File reader configuration for processing attached files. See File Readers.

Memory

Memory is configured directly on the Agent constructor:
See Memory for full documentation.

Knowledge

Knowledge (RAG) is configured directly on the Agent constructor:
Agent(knowledge=True) raises ValueError — unlike memory=True, knowledge requires explicit configuration. Use a path string or a Knowledge instance.
See Knowledge Agent Integration for full documentation.

Thinking

The thinking layer is configured directly on the Agent constructor (not in AgentConfig):
See Thinking for full documentation.

Immutable Updates

AgentConfig is frozen after creation. Use with_updates() to create a modified copy:
The original base_config is unchanged. This pattern makes it safe to share configs across agents.

Compression

Compress large tool results to save tokens:
Compression uses a separate model call to summarize tool output. This adds a small amount of latency but can significantly reduce total token usage for tools that return large results.

Readers Config

Configure file reader behavior for processing attached files:
bool
default:"true"
Enable or disable file reading.
BaseReader
Custom reader instance. When None, a default BaseReader with all available built-in parsers is created.
int
Maximum total character length of all extracted file content. When None, no limit is applied.
str
default:"xml"
Format for injecting file content into the prompt. "xml" wraps content in XML tags, "markdown" uses code blocks.

Audio Transcription

The audio transcriber is configured directly on the Agent constructor. It automatically transcribes voice messages (from Telegram, Discord, or direct arun() calls) to text before the model sees them.
See Vision & Audio for full documentation.

How It Works

When audio_transcriber is set:
  1. Before the pipeline runs, _transcribe_audio() iterates over messages with Audio attachments
  2. Each audio clip is transcribed via the configured backend (Whisper by default)
  3. The transcript text is appended to the message’s content field
  4. The audio field is cleared from the message so non-audio models don’t receive raw input_audio blocks
Without audio_transcriber, voice messages from interfaces arrive as raw Audio objects. Most models (GPT-4o-mini, Claude, DeepSeek) will reject input_audio blocks — only gpt-4o-audio-preview supports them natively.

Security

Security features are configured directly on the Agent constructor:
See Security for full documentation on tool policies, rate limiting, prompt injection detection, SSRF protection, and security audits.

Usage Tracking

Track token usage and estimated cost across agent runs:

Deep Research

The deep research layer is configured directly on the Agent constructor:
See Deep Research for full documentation.

DeepResearchConfig Reference

str
default:"standard"
Research depth preset. "quick" (1 wave, 8 sources), "standard" (3 waves, 15 sources), "deep" (5 waves, 30 sources).
str
default:"duckduckgo"
Search backend name: "duckduckgo", "google", or "serpapi".
Dict[str, Any]
Backend-specific config (API keys, CSE ID, etc.). Required for Google CSE and SerpAPI.
Callable
Custom async search callable. Overrides search_provider when set.
Model
Model for CKU extraction (should be cheap/fast). Defaults to the agent’s model.
int
default:"15"
Maximum number of unique sources to read across all waves.
int
default:"3"
Maximum number of research waves.
int
default:"5"
Number of concurrent search queries per wave.
int
default:"10"
Number of concurrent page reads.
float
default:"0.3"
Minimum relevance score for CKU inclusion.
bool
default:"true"
Whether to include source citations in the research context.
bool
default:"true"
Whether to surface contradictions between sources.
str
default:"xml"
Format for the injected context: "xml" or "markdown".
int
default:"4000"
Approximate token budget for the research context block.
float
default:"0.2"
Stop when novelty ratio drops below this threshold between waves.
str
default:"always"
When to run research: "always" (every run), "auto" (model decides), "tool" (explicit tool call).
str
Description shown in the layer guide injected into the system prompt. If None, uses the default description.