pub struct Agent { /* private fields */ }Implementations§
Source§impl Agent
impl Agent
pub fn new( config: AgentConfig, provider: Box<dyn Provider>, memory: Box<dyn MemoryStore>, tools: Vec<Box<dyn Tool>>, ) -> Self
Sourcepub fn with_loop_detection(self, config: LoopDetectionConfig) -> Self
pub fn with_loop_detection(self, config: LoopDetectionConfig) -> Self
Enable tiered loop detection (similarity + cost runaway) for this agent.
pub fn with_audit(self, audit: Box<dyn AuditSink>) -> Self
pub fn with_hooks(self, hooks: Box<dyn HookSink>) -> Self
pub fn with_metrics(self, metrics: Box<dyn MetricsSink>) -> Self
pub fn with_tool_selector(self, selector: Box<dyn ToolSelector>) -> Self
Sourcepub fn with_tool_source(self, source: Arc<dyn ToolSource>) -> Self
pub fn with_tool_source(self, source: Arc<dyn ToolSource>) -> Self
Attach a dynamic tool source for mid-session tool registration.
The agent queries this source on each tool loop iteration to discover
newly registered tools (e.g. from [DynamicToolRegistry]).
pub async fn respond( &self, user: UserMessage, ctx: &ToolContext, ) -> Result<AssistantMessage, AgentError>
Sourcepub async fn respond_streaming(
&self,
user: UserMessage,
ctx: &ToolContext,
sink: StreamSink,
) -> Result<AssistantMessage, AgentError>
pub async fn respond_streaming( &self, user: UserMessage, ctx: &ToolContext, sink: StreamSink, ) -> Result<AssistantMessage, AgentError>
Streaming variant of respond(). Sends incremental StreamChunks through
sink as tokens arrive from the provider. Returns the final accumulated
AssistantMessage once the stream completes.
Auto Trait Implementations§
impl Freeze for Agent
impl !RefUnwindSafe for Agent
impl Send for Agent
impl Sync for Agent
impl Unpin for Agent
impl UnsafeUnpin for Agent
impl !UnwindSafe for Agent
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