pub struct ConfigurableAgent { /* private fields */ }Expand description
A configurable agent that derives its behavior from TOML configuration
Implementations§
Source§impl ConfigurableAgent
impl ConfigurableAgent
Sourcepub fn new(
name: &str,
config: &AgentConfig,
llm: Box<dyn LLMClient>,
tools: Option<Arc<Tools>>,
) -> Self
👎Deprecated: use new_with_tool_service with ctx.get::<dyn ToolService>()
pub fn new( name: &str, config: &AgentConfig, llm: Box<dyn LLMClient>, tools: Option<Arc<Tools>>, ) -> Self
use new_with_tool_service with ctx.get::<dyn ToolService>()
Create a new configurable agent from TOML config
Deprecated shim kept for one commit. New code should use
new_with_tool_service with a service obtained via
ctx.get::<dyn ToolService>().
Sourcepub fn new_with_provider(
name: &str,
config: &AgentConfig,
llm: Box<dyn LLMClient>,
tools: Option<Arc<Tools>>,
provider_name: String,
) -> Self
👎Deprecated: use new_with_provider_and_tool_service with ctx.get::<dyn ToolService>()
pub fn new_with_provider( name: &str, config: &AgentConfig, llm: Box<dyn LLMClient>, tools: Option<Arc<Tools>>, provider_name: String, ) -> Self
use new_with_provider_and_tool_service with ctx.get::<dyn ToolService>()
Create a new configurable agent with explicit provider metadata
Deprecated shim. Prefer new_with_provider_and_tool_service.
Sourcepub fn with_params(
name: &str,
agent_type: AgentType,
llm: Box<dyn LLMClient>,
system_prompt: String,
tools: Option<Arc<Tools>>,
allowed_tools: Option<Vec<String>>,
max_tool_iterations: usize,
parallel_tools: bool,
) -> Self
👎Deprecated: use with_tool_service_params with ctx.get::<dyn ToolService>()
pub fn with_params( name: &str, agent_type: AgentType, llm: Box<dyn LLMClient>, system_prompt: String, tools: Option<Arc<Tools>>, allowed_tools: Option<Vec<String>>, max_tool_iterations: usize, parallel_tools: bool, ) -> Self
use with_tool_service_params with ctx.get::<dyn ToolService>()
Create a new configurable agent with explicit parameters
Deprecated shim. Prefer with_tool_service_params.
Sourcepub fn new_with_tool_service(
name: &str,
config: &AgentConfig,
llm: Box<dyn LLMClient>,
tool_service: Option<Arc<Tools>>,
) -> Self
pub fn new_with_tool_service( name: &str, config: &AgentConfig, llm: Box<dyn LLMClient>, tool_service: Option<Arc<Tools>>, ) -> Self
Create an agent wired to a unified ToolService.
Obtain the service via ctx.get::<dyn ToolService>() and pass it here.
This is the Cordis DI path. The service provides all tools with tenant
precedence already handled.
Sourcepub fn new_with_provider_and_tool_service(
name: &str,
config: &AgentConfig,
llm: Box<dyn LLMClient>,
tool_service: Option<Arc<Tools>>,
provider_name: String,
) -> Self
pub fn new_with_provider_and_tool_service( name: &str, config: &AgentConfig, llm: Box<dyn LLMClient>, tool_service: Option<Arc<Tools>>, provider_name: String, ) -> Self
Create an agent with provider metadata and a unified ToolService.
Sourcepub fn set_compaction(&mut self, enabled: bool)
pub fn set_compaction(&mut self, enabled: bool)
Enable per-session history compaction for this agent.
Sourcepub fn with_tool_service_params(
name: &str,
agent_type: AgentType,
llm: Box<dyn LLMClient>,
system_prompt: String,
tool_service: Option<Arc<Tools>>,
allowed_tools: Option<Vec<String>>,
max_tool_iterations: usize,
parallel_tools: bool,
) -> Self
pub fn with_tool_service_params( name: &str, agent_type: AgentType, llm: Box<dyn LLMClient>, system_prompt: String, tool_service: Option<Arc<Tools>>, allowed_tools: Option<Vec<String>>, max_tool_iterations: usize, parallel_tools: bool, ) -> Self
Create an agent with explicit parameters and a unified ToolService.
Sourcepub fn new_from_context(
ctx: &Arc<Context>,
name: &str,
config: &AgentConfig,
llm: Box<dyn LLMClient>,
) -> Self
pub fn new_from_context( ctx: &Arc<Context>, name: &str, config: &AgentConfig, llm: Box<dyn LLMClient>, ) -> Self
Create an agent by resolving the ToolService from a Context.
This is the one line handlers should use: ConfigurableAgent::new_from_context(&ctx, name, &config, llm).
Sourcepub fn new_from_context_with_provider(
ctx: &Arc<Context>,
name: &str,
config: &AgentConfig,
llm: Box<dyn LLMClient>,
provider_name: String,
) -> Self
pub fn new_from_context_with_provider( ctx: &Arc<Context>, name: &str, config: &AgentConfig, llm: Box<dyn LLMClient>, provider_name: String, ) -> Self
Same as new_from_context but with explicit provider name.
Sourcepub fn max_tool_iterations(&self) -> usize
pub fn max_tool_iterations(&self) -> usize
Get the max tool iterations setting
Sourcepub fn parallel_tools(&self) -> bool
pub fn parallel_tools(&self) -> bool
Get the parallel tools setting
Sourcepub fn has_tools(&self) -> bool
pub fn has_tools(&self) -> bool
Check if this agent may use tools (built-in or tenant-scoped via Tools).
Sourcepub fn set_tools(&mut self, tools: Arc<Tools>)
pub fn set_tools(&mut self, tools: Arc<Tools>)
Store the unified Tools capability used for list/resolve/dispatch.
Sourcepub fn bind_request_ctx(&mut self, ctx: Arc<Context>)
pub fn bind_request_ctx(&mut self, ctx: Arc<Context>)
Bind the request Cordis context so tool isolate labels and
ExternalContext are visible during execute.
Sourcepub fn allowed_tools(&self) -> Option<&[String]>
pub fn allowed_tools(&self) -> Option<&[String]>
Get the list of allowed tool names for this agent.
None means no tools are permitted.
Sourcepub fn set_allowed_tools(&mut self, allowed_tools: Option<Vec<String>>)
pub fn set_allowed_tools(&mut self, allowed_tools: Option<Vec<String>>)
Override the allowed tools list at runtime (e.g. after merging with a per-tenant allowlist).
Sourcepub fn set_observability(&mut self, obs: Arc<dyn ObservabilitySink>)
pub fn set_observability(&mut self, obs: Arc<dyn ObservabilitySink>)
Attach an observability sink to this agent.
Sourcepub fn set_fallback_llms(&mut self, fallbacks: Vec<Box<dyn LLMClient>>)
pub fn set_fallback_llms(&mut self, fallbacks: Vec<Box<dyn LLMClient>>)
Set fallback LLM clients to try if the primary fails.
Sourcepub fn set_fallback_llms_with_providers(
&mut self,
fallbacks: Vec<(String, Box<dyn LLMClient>)>,
)
pub fn set_fallback_llms_with_providers( &mut self, fallbacks: Vec<(String, Box<dyn LLMClient>)>, )
Set fallback LLM clients with provider names for observability and billing metadata.
Sourcepub fn set_run_id(&mut self, run_id: String)
pub fn set_run_id(&mut self, run_id: String)
Set the run id to associate with token usage records.
Sourcepub fn get_filtered_tool_definitions(&self) -> Vec<ToolDefinition>
pub fn get_filtered_tool_definitions(&self) -> Vec<ToolDefinition>
Get tool definitions for this agent.
If allowed_tools is set, returns only those tools (if enabled).
Otherwise returns no tools: tool use is deny-by-default.
Sourcepub fn can_use_tool(&self, tool_name: &str) -> bool
pub fn can_use_tool(&self, tool_name: &str) -> bool
Check if a specific tool is allowed for this agent. When no whitelist is set, no tool is allowed.