pub trait Agent: Send + Sync {
type Options: Send + 'static;
type Output: Send + 'static;
// Required methods
fn id(&self) -> Option<&str>;
fn tools(&self) -> &ToolSet;
fn generate(
&self,
call: AgentCall<Self::Options>,
) -> impl Future<Output = Result<GenerateTextResult<Self::Output>, Error>> + Send;
fn stream(
&self,
call: AgentStreamCall<Self::Options>,
) -> impl Future<Output = Result<StreamTextResult<Self::Output>, Error>> + Send;
}Expand description
An agent: a model plus configuration that answers prompts, possibly over several tool-calling steps.
Required Associated Types§
Required Methods§
Sourcefn generate(
&self,
call: AgentCall<Self::Options>,
) -> impl Future<Output = Result<GenerateTextResult<Self::Output>, Error>> + Send
fn generate( &self, call: AgentCall<Self::Options>, ) -> impl Future<Output = Result<GenerateTextResult<Self::Output>, Error>> + Send
Runs the agent to completion.
Sourcefn stream(
&self,
call: AgentStreamCall<Self::Options>,
) -> impl Future<Output = Result<StreamTextResult<Self::Output>, Error>> + Send
fn stream( &self, call: AgentStreamCall<Self::Options>, ) -> impl Future<Output = Result<StreamTextResult<Self::Output>, Error>> + Send
Runs the agent as a stream.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".