pub struct Agent<Deps> { /* private fields */ }Implementations§
Source§impl<Deps> Agent<Deps>
impl<Deps> Agent<Deps>
pub fn new(model: Arc<dyn Model>) -> Self
pub fn system_prompt(self, prompt: impl Into<String>) -> Self
pub fn model_settings(self, settings: ModelSettings) -> Self
pub fn instrumenter(self, instrumenter: Arc<dyn Instrumenter>) -> Self
pub fn output_schema(self, schema: Value) -> Self
pub fn output_schema_for<T: JsonSchema>(self) -> Self
pub fn output_retries(self, retries: u32) -> Self
pub fn allow_text_output(self, allow: bool) -> Self
pub fn tool(&mut self, tool: impl Tool<Deps> + 'static)
pub fn toolset(&mut self, toolset: impl Toolset<Deps> + 'static)
pub fn prepare_tools(self, func: PrepareToolsFn<Deps>) -> Self
pub async fn enter_toolsets(&self) -> Result<(), AgentError>
pub async fn exit_toolsets(&self) -> Result<(), AgentError>
pub async fn run_with_toolsets( &self, input: RunInput<Deps>, ) -> Result<AgentRunResult, AgentError>
pub async fn run( &self, input: RunInput<Deps>, ) -> Result<AgentRunResult, AgentError>
pub async fn run_with_failover( &self, input: RunInput<Deps>, resolver: &dyn ModelConfigResolver, agent_name: &str, requested_model: Option<&str>, environment: Option<&str>, model_factory: impl Fn(&str) -> Result<Arc<dyn Model>, AgentError> + Send + Sync, ) -> Result<FailoverResult<AgentRunResult>, AgentError>
pub async fn run_with_resolved_failover( &self, input: RunInput<Deps>, config: ResolvedModelConfig, model_factory: impl Fn(&str) -> Result<Arc<dyn Model>, AgentError> + Send + Sync, ) -> Result<FailoverResult<AgentRunResult>, AgentError>
pub async fn run_with_failover_with_toolsets( &self, input: RunInput<Deps>, resolver: &dyn ModelConfigResolver, agent_name: &str, requested_model: Option<&str>, environment: Option<&str>, model_factory: impl Fn(&str) -> Result<Arc<dyn Model>, AgentError> + Send + Sync, ) -> Result<FailoverResult<AgentRunResult>, AgentError>
pub async fn run_with_resolved_failover_with_toolsets( &self, input: RunInput<Deps>, config: ResolvedModelConfig, model_factory: impl Fn(&str) -> Result<Arc<dyn Model>, AgentError> + Send + Sync, ) -> Result<FailoverResult<AgentRunResult>, AgentError>
pub async fn run_stream( &self, input: RunInput<Deps>, ) -> Result<AgentEventStream, AgentError>
Auto Trait Implementations§
impl<Deps> Freeze for Agent<Deps>
impl<Deps> !RefUnwindSafe for Agent<Deps>
impl<Deps> Send for Agent<Deps>
impl<Deps> Sync for Agent<Deps>
impl<Deps> Unpin for Agent<Deps>
impl<Deps> !UnwindSafe for Agent<Deps>
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