pub struct AgentConfig {Show 29 fields
pub path: TaskPath,
pub base_system_prompt: Option<String>,
pub prompt_assembly: Option<Arc<PromptAssembly>>,
pub prompt_profile: PromptProfile,
pub max_iterations: Option<usize>,
pub cwd: PathBuf,
pub env: HashMap<String, String>,
pub max_tool_result_chars: usize,
pub max_message_tool_results_chars: usize,
pub policies: Arc<PolicyRegistry>,
pub storage: Option<Arc<dyn Storage>>,
pub tool_diagnostics: Option<Arc<dyn ToolDiagnosticsSink>>,
pub compaction: Option<Arc<dyn HistoryCompactionStrategy>>,
pub permission_engine: Option<PermissionEngine>,
pub approval_handler: Option<Arc<dyn ApprovalHandler>>,
pub tool_concurrency_limit: usize,
pub token_budget: Option<TokenBudget>,
pub retry: RetryConfig,
pub auto_validate_schema: bool,
pub cancellation: CancellationState,
pub tool_timeout_ms: Option<u64>,
pub max_file_read_bytes: usize,
pub skill_registry: Option<Arc<SkillRegistry>>,
pub plugin_registry: Option<Arc<PluginRegistry>>,
pub task_manager: Option<Arc<TaskManager>>,
pub memory_injector: Option<Arc<MemoryInjector>>,
pub skill_injector: Option<Arc<SkillInjector>>,
pub mcp_manager: Option<Arc<McpManager>>,
pub event_channel: Option<EventChannelConfig>,
}Expand description
Configuration for an AgentSession.
Build with Default::default and override fields as needed. All fields
are public so callers don’t need a builder for simple cases.
Fields§
§path: TaskPathWorkflow path classification for the current task. Influences iteration budget, timeout, concurrency, and the system-prompt guidance injected at turn time.
base_system_prompt: Option<String>Optional base instruction appended to the identity section of the
system prompt. For full control, use prompt_assembly instead.
prompt_assembly: Option<Arc<PromptAssembly>>Optional pre-built prompt assembly. When set, the runtime uses this
instead of constructing the prompt from base_system_prompt alone.
prompt_profile: PromptProfileControls how much built-in prompt guidance is injected when the runtime constructs the default prompt assembly.
max_iterations: Option<usize>Optional maximum number of model ⇄ tool round-trips per turn before the
loop aborts with AgentError::MaxIterations.
None means the model/tool loop is allowed to continue until the model
finishes, the turn is cancelled, or another runtime limit is reached.
cwd: PathBufWorking directory used as the root for filesystem tools and shell commands.
env: HashMap<String, String>Environment variables exposed to shell-based tools.
max_tool_result_chars: usizeHard cap on the character length of any individual tool result. Anything longer is replaced with a truncated preview to protect the context window.
max_message_tool_results_chars: usizeHard cap on the aggregate character length of all tool results within a
single message. When N parallel tool calls collectively exceed this, the
largest results are truncated to fit. Prevents a turn with many tool
calls from flooding the context window even when each result individually
stays under max_tool_result_chars.
policies: Arc<PolicyRegistry>Registry of semantic runtime policies.
storage: Option<Arc<dyn Storage>>Optional persistent backing store for session messages.
tool_diagnostics: Option<Arc<dyn ToolDiagnosticsSink>>Optional sink for sanitized tool failure diagnostics.
compaction: Option<Arc<dyn HistoryCompactionStrategy>>Optional history-level compaction strategy (summarisation, etc.).
permission_engine: Option<PermissionEngine>Optional rule-based permission engine consulted before every tool call.
approval_handler: Option<Arc<dyn ApprovalHandler>>Optional handler invoked when a tool call requires explicit human approval.
tool_concurrency_limit: usizeMaximum number of concurrency-safe tools to run in parallel within a single batch.
token_budget: Option<TokenBudget>Optional token budget that triggers proactive compaction.
retry: RetryConfigRetry configuration for transient provider failures.
When None, provider calls are not retried.
auto_validate_schema: boolWhether to automatically validate tool arguments against the tool’s
input_schema after the tool’s own validate method runs.
cancellation: CancellationStateShared cancellation state. Hosts call cancel() to interrupt a running
turn and reset() before starting the next turn.
tool_timeout_ms: Option<u64>Per-tool execution timeout in milliseconds. When set, any tool that runs
longer than this will be interrupted and its result will be an
is_error: true timeout so the model can recover.
max_file_read_bytes: usizeMaximum number of bytes the built-in file tools will read from a single file. Files larger than this are rejected to avoid OOMing the agent.
skill_registry: Option<Arc<SkillRegistry>>Optional skill registry. When set, the Skill tool and the default prompt assembly can use registered skills (including bundled Superpowers skills).
plugin_registry: Option<Arc<PluginRegistry>>Optional plugin registry. When set, enabled plugins’ components are applied to tool/policy/skill registries at session startup.
task_manager: Option<Arc<TaskManager>>Optional task manager used by long-running tools such as background subagents to publish lifecycle state and output.
memory_injector: Option<Arc<MemoryInjector>>Optional memory injector for dynamic per-turn memory scoring. When set, memories are scored against the user’s current input and injected as system reminders before the first provider call of each turn.
skill_injector: Option<Arc<SkillInjector>>Optional skill injector for dynamic per-turn skill discovery. When set, top matching skills are injected as system reminders before the first provider call of each turn.
mcp_manager: Option<Arc<McpManager>>Optional MCP manager. When set, MCP server tools are bridged into the tool registry and an MCP tools section is added to the prompt assembly.
event_channel: Option<EventChannelConfig>Optional configuration for the bidirectional HTTP event channel.
When set and enabled is true, the session starts an embedded HTTP
server on the configured address, accepting external event injection
(POST /inject) and streaming TurnEvents via SSE (GET /events).
Implementations§
Source§impl AgentConfig
impl AgentConfig
Sourcepub fn request_cancel(&self)
pub fn request_cancel(&self)
Request cancellation and wake any runtime await that is listening for it.
Sourcepub fn reset_cancel(&self)
pub fn reset_cancel(&self)
Clear a previous cancellation request before starting a new turn.
Sourcepub fn validate(&self) -> Result<(), AgentError>
pub fn validate(&self) -> Result<(), AgentError>
Validate configuration values and return a structured error for any dangerous or nonsensical combination.
Sourcepub fn with_default_prompt_assembly(
self,
tools: Arc<ToolRegistry>,
) -> Result<Self, AgentError>
pub fn with_default_prompt_assembly( self, tools: Arc<ToolRegistry>, ) -> Result<Self, AgentError>
Replace base_system_prompt with the default modular prompt assembly.
This is the recommended way to use telos-agent’s built-in default prompt sections without manually wiring each section.
Sourcepub fn with_path(self, path: TaskPath) -> Self
pub fn with_path(self, path: TaskPath) -> Self
Apply path-appropriate defaults for timeouts, token budgets, and concurrency. Call after setting custom values if you want the path to override them.
| Knob | Fast | Standard | Heavy |
|---|---|---|---|
max_iterations | None | None | None |
tool_concurrency_limit | 10 | 10 | 5 |
token_budget | None | None | 308k |
tool_timeout_ms | 30_000 | None | 60_000 |
Sourcepub fn with_bundled_skills(self) -> Self
pub fn with_bundled_skills(self) -> Self
Load bundled skills into a fresh skill registry attached to this config.
Sourcepub fn apply_plugins(
&self,
tools: ToolRegistry,
policies: PolicyRegistry,
skills: SkillRegistry,
mcp: McpManager,
prompt: PromptAssembly,
) -> (ToolRegistry, PolicyRegistry, SkillRegistry, McpManager, PromptAssembly, Result<(), Vec<PluginError>>)
pub fn apply_plugins( &self, tools: ToolRegistry, policies: PolicyRegistry, skills: SkillRegistry, mcp: McpManager, prompt: PromptAssembly, ) -> (ToolRegistry, PolicyRegistry, SkillRegistry, McpManager, PromptAssembly, Result<(), Vec<PluginError>>)
Apply plugin components into the agent registries.
Call this before creating an AgentSession to
populate tools/policies/skills/mcp/prompt with enabled plugin content.
Always returns the registries (even on error) so callers can
continue with degraded state.
Trait Implementations§
Source§impl Clone for AgentConfig
impl Clone for AgentConfig
Source§fn clone(&self) -> AgentConfig
fn clone(&self) -> AgentConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more