pub struct Agent<M: LanguageModel> { /* private fields */ }Expand description
An AGNO-style agent that alternates between the LLM and registered tools.
Implementations§
Source§impl<M: LanguageModel> Agent<M>
impl<M: LanguageModel> Agent<M>
pub fn new(model: Arc<M>) -> Self
pub fn with_system_prompt(self, prompt: impl Into<String>) -> Self
pub fn with_tools(self, tools: ToolRegistry) -> Self
pub fn with_memory(self, memory: ConversationMemory) -> Self
pub fn with_access_control(self, controller: Arc<AccessController>) -> Self
pub fn with_principal(self, principal: Principal) -> Self
pub fn with_metrics(self, metrics: MetricsTracker) -> Self
pub fn with_telemetry(self, telemetry: TelemetryCollector) -> Self
pub fn with_workflow_label(self, workflow: impl Into<String>) -> Self
pub fn with_input_schema(self, schema: Value) -> Self
pub fn with_output_schema(self, schema: Value) -> Self
pub fn with_hook(self, hook: Arc<dyn AgentHook>) -> Self
pub fn with_retriever(self, retriever: Arc<dyn Retriever>) -> Self
pub fn require_tool_confirmation( self, handler: Arc<dyn ConfirmationHandler>, ) -> Self
pub fn with_max_steps(self, max_steps: usize) -> Self
pub fn with_streaming(self, streaming: bool) -> Self
pub fn tools_mut(&mut self) -> &mut ToolRegistry
pub fn tool_names(&self) -> Vec<String>
pub fn set_principal(&mut self, principal: Principal)
pub fn attach_access_control(&mut self, controller: Arc<AccessController>)
pub fn attach_metrics(&mut self, metrics: MetricsTracker)
pub fn attach_telemetry(&mut self, telemetry: TelemetryCollector)
pub fn memory(&self) -> &ConversationMemory
pub fn sync_memory_from(&mut self, memory: &ConversationMemory)
pub fn take_memory_snapshot(&self) -> ConversationMemory
Sourcepub async fn respond(&mut self, user_input: impl Into<String>) -> Result<String>
pub async fn respond(&mut self, user_input: impl Into<String>) -> Result<String>
Run a single exchange with the agent. Returns the final assistant reply.
pub async fn respond_for( &mut self, principal: Principal, user_input: impl Into<String>, ) -> Result<String>
Auto Trait Implementations§
impl<M> Freeze for Agent<M>
impl<M> !RefUnwindSafe for Agent<M>
impl<M> Send for Agent<M>
impl<M> Sync for Agent<M>
impl<M> Unpin for Agent<M>
impl<M> !UnwindSafe for Agent<M>
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestCreates a shared type from an unshared type.