pub struct AgentConfig {
pub max_iterations: usize,
pub model: String,
pub system_prompt: String,
pub max_memory_recalls: usize,
pub max_memory_tokens: Option<usize>,
pub loop_timeout: Option<Duration>,
pub temperature: Option<f32>,
pub max_tokens: Option<usize>,
pub request_timeout: Option<Duration>,
}Expand description
Configuration for the ReAct agent loop.
Fields§
§max_iterations: usizeMaximum number of Thought-Action-Observation cycles.
model: StringModel identifier passed to the inference function.
system_prompt: StringSystem prompt injected at the start of the conversation.
max_memory_recalls: usizeMaximum number of episodic memories to inject into the prompt. Keeping this small prevents silent token-budget overruns. Default: 3.
max_memory_tokens: Option<usize>Maximum approximate token budget for injected memories. Uses ~4 chars/token heuristic. None means no limit.
loop_timeout: Option<Duration>Optional wall-clock timeout for the entire loop.
If the loop runs longer than this duration, it returns
Err(AgentRuntimeError::AgentLoop("loop timeout ...")).
temperature: Option<f32>Model sampling temperature.
max_tokens: Option<usize>Maximum output tokens.
request_timeout: Option<Duration>Per-inference timeout.
Implementations§
Source§impl AgentConfig
impl AgentConfig
Sourcepub fn new(max_iterations: usize, model: impl Into<String>) -> Self
pub fn new(max_iterations: usize, model: impl Into<String>) -> Self
Create a new config with sensible defaults.
Sourcepub fn with_system_prompt(self, prompt: impl Into<String>) -> Self
pub fn with_system_prompt(self, prompt: impl Into<String>) -> Self
Override the system prompt.
Sourcepub fn with_max_memory_recalls(self, n: usize) -> Self
pub fn with_max_memory_recalls(self, n: usize) -> Self
Set the maximum number of episodic memories injected per run.
Sourcepub fn with_max_memory_tokens(self, n: usize) -> Self
pub fn with_max_memory_tokens(self, n: usize) -> Self
Set a maximum token budget for injected memories (~4 chars/token heuristic).
Sourcepub fn with_loop_timeout(self, d: Duration) -> Self
pub fn with_loop_timeout(self, d: Duration) -> Self
Set a wall-clock timeout for the entire ReAct loop.
If the loop has not reached FINAL_ANSWER within this duration,
ReActLoop::run returns Err(AgentRuntimeError::AgentLoop(...)).
Sourcepub fn with_temperature(self, t: f32) -> Self
pub fn with_temperature(self, t: f32) -> Self
Set the model sampling temperature.
Sourcepub fn with_max_tokens(self, n: usize) -> Self
pub fn with_max_tokens(self, n: usize) -> Self
Set the maximum output tokens.
Sourcepub fn with_request_timeout(self, d: Duration) -> Self
pub fn with_request_timeout(self, d: Duration) -> Self
Set the per-inference timeout.
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