#[non_exhaustive]pub struct AgentConfig { /* private fields */ }Expand description
Optional behavior configuration for an Agent.
Kept separate from the required parameters (Provider / ToolRegistry / system_prompt): the required ones define what the Agent is made of, while the optional ones are behavioral parameters for how it runs.
§Examples
Adjust the tool-round limit and model parameters (temperature, etc.):
use molo::agent::{AgentConfig, ReActAgent};
use molo::provider::{FakeProvider, FakeReply, ModelOptions};
use molo::tool::ToolRegistry;
let config = AgentConfig::default()
.with_max_tool_rounds(20)
.with_max_structured_retries(5)
.with_options(ModelOptions {
temperature: Some(0.2),
..Default::default()
});
let agent = ReActAgent::new(
FakeProvider::new([FakeReply::Text("Hello".into())]),
ToolRegistry::new(),
"",
)
.with_config(config);Implementations§
Source§impl AgentConfig
impl AgentConfig
Sourcepub fn max_tool_rounds(&self) -> usize
pub fn max_tool_rounds(&self) -> usize
Maximum tool-call rounds before a run fails.
Sourcepub fn with_max_tool_rounds(self, max_tool_rounds: usize) -> Self
pub fn with_max_tool_rounds(self, max_tool_rounds: usize) -> Self
Returns a config with an updated tool-round limit.
Sourcepub fn max_structured_retries(&self) -> usize
pub fn max_structured_retries(&self) -> usize
Maximum structured-output validation retries before a run fails.
Sourcepub fn with_max_structured_retries(self, max_structured_retries: usize) -> Self
pub fn with_max_structured_retries(self, max_structured_retries: usize) -> Self
Returns a config with an updated structured-output retry limit.
Sourcepub fn options(&self) -> &ModelOptions
pub fn options(&self) -> &ModelOptions
Model options sent on each provider request unless a run overrides them.
Sourcepub fn with_options(self, options: ModelOptions) -> Self
pub fn with_options(self, options: ModelOptions) -> Self
Returns a config with updated model options.
Trait Implementations§
Source§impl Clone for AgentConfig
impl Clone for AgentConfig
Source§impl Debug for AgentConfig
impl Debug for AgentConfig
Source§impl Default for AgentConfig
impl Default for AgentConfig
Source§impl<'de> Deserialize<'de> for AgentConfigwhere
AgentConfig: Default,
impl<'de> Deserialize<'de> for AgentConfigwhere
AgentConfig: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for AgentConfig
impl PartialEq for AgentConfig
Source§impl Serialize for AgentConfig
impl Serialize for AgentConfig
impl StructuralPartialEq for AgentConfig
Auto Trait Implementations§
impl Freeze for AgentConfig
impl RefUnwindSafe for AgentConfig
impl Send for AgentConfig
impl Sync for AgentConfig
impl Unpin for AgentConfig
impl UnsafeUnpin for AgentConfig
impl UnwindSafe for AgentConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more