pub struct AgentConfig {
pub id: String,
pub model: String,
pub system_prompt: String,
pub max_rounds: usize,
pub tool_executor: Arc<dyn ToolExecutor>,
pub chat_options: Option<ChatOptions>,
pub fallback_models: Vec<String>,
pub llm_retry_policy: LlmRetryPolicy,
pub plugins: Vec<Arc<dyn AgentPlugin>>,
pub step_tool_provider: Option<Arc<dyn StepToolProvider>>,
pub llm_executor: Option<Arc<dyn LlmExecutor>>,
}Expand description
Runtime configuration for the agent loop.
Fields§
§id: StringUnique identifier for this agent.
model: StringModel identifier (e.g., “gpt-4”, “claude-3-opus”).
system_prompt: StringSystem prompt for the LLM.
max_rounds: usizeOptional loop-budget hint (core loop does not enforce this directly).
tool_executor: Arc<dyn ToolExecutor>Tool execution strategy (parallel, sequential, or custom).
chat_options: Option<ChatOptions>Chat options for the LLM.
fallback_models: Vec<String>Fallback model ids used when the primary model fails.
Evaluated in order after model.
llm_retry_policy: LlmRetryPolicyRetry policy for LLM inference failures.
plugins: Vec<Arc<dyn AgentPlugin>>Plugins to run during the agent loop.
step_tool_provider: Option<Arc<dyn StepToolProvider>>Optional per-step tool provider.
When not set, the loop uses a static provider derived from the tools
map passed to run_step / run_loop / run_loop_stream.
llm_executor: Option<Arc<dyn LlmExecutor>>Optional LLM executor override.
When not set, the loop uses GenaiLlmExecutor with Client::default().
Implementations§
Source§impl AgentConfig
impl AgentConfig
Sourcepub fn with_id(id: impl Into<String>, model: impl Into<String>) -> Self
pub fn with_id(id: impl Into<String>, model: impl Into<String>) -> Self
Create a new instance with explicit id and model.
Sourcepub fn with_system_prompt(self, prompt: impl Into<String>) -> Self
pub fn with_system_prompt(self, prompt: impl Into<String>) -> Self
Set system prompt.
Sourcepub fn with_max_rounds(self, max_rounds: usize) -> Self
pub fn with_max_rounds(self, max_rounds: usize) -> Self
Set max rounds.
Sourcepub fn with_chat_options(self, options: ChatOptions) -> Self
pub fn with_chat_options(self, options: ChatOptions) -> Self
Set chat options.
Sourcepub fn with_fallback_models(self, models: Vec<String>) -> Self
pub fn with_fallback_models(self, models: Vec<String>) -> Self
Set fallback model ids to try after the primary model.
Sourcepub fn with_fallback_model(self, model: impl Into<String>) -> Self
pub fn with_fallback_model(self, model: impl Into<String>) -> Self
Add a single fallback model id.
Sourcepub fn with_llm_retry_policy(self, policy: LlmRetryPolicy) -> Self
pub fn with_llm_retry_policy(self, policy: LlmRetryPolicy) -> Self
Set LLM retry policy.
Sourcepub fn with_plugins(self, plugins: Vec<Arc<dyn AgentPlugin>>) -> Self
pub fn with_plugins(self, plugins: Vec<Arc<dyn AgentPlugin>>) -> Self
Set plugins.
Sourcepub fn with_plugin(self, plugin: Arc<dyn AgentPlugin>) -> Self
pub fn with_plugin(self, plugin: Arc<dyn AgentPlugin>) -> Self
Add a single plugin.
Sourcepub fn with_tool_executor(self, executor: Arc<dyn ToolExecutor>) -> Self
pub fn with_tool_executor(self, executor: Arc<dyn ToolExecutor>) -> Self
Set tool executor strategy.
Sourcepub fn with_tools(self, tools: HashMap<String, Arc<dyn Tool>>) -> Self
pub fn with_tools(self, tools: HashMap<String, Arc<dyn Tool>>) -> Self
Set static tool map (wraps in [StaticStepToolProvider]).
Prefer passing tools directly to [run_loop] / [run_loop_stream];
use this only when you need to set tools via step_tool_provider.
Sourcepub fn with_step_tool_provider(
self,
provider: Arc<dyn StepToolProvider>,
) -> Self
pub fn with_step_tool_provider( self, provider: Arc<dyn StepToolProvider>, ) -> Self
Set per-step tool provider.
Sourcepub fn with_llm_executor(self, executor: Arc<dyn LlmExecutor>) -> Self
pub fn with_llm_executor(self, executor: Arc<dyn LlmExecutor>) -> Self
Set LLM executor.
Sourcepub fn has_plugins(&self) -> bool
pub fn has_plugins(&self) -> bool
Check if any plugins are configured.
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