pub struct MicroAgent<Ctx> {
pub history: Vec<Message>,
pub tools: HashMap<String, Arc<dyn ToolFunction<Ctx>>>,
pub skills: HashMap<String, String>,
pub provider: SupportedProvider,
pub model: String,
pub system: String,
pub tool_context: Arc<ToolExecutionContext<Ctx>>,
pub storage: Box<dyn AgentStorage>,
pub parallel_tool_calls: bool,
/* private fields */
}Expand description
A fully-configured agent ready to generate responses or run conversations.
Created via MicroAgentBuilder. Holds the conversation history, tool
registry, and LLM client configuration.
Fields§
§history: Vec<Message>§tools: HashMap<String, Arc<dyn ToolFunction<Ctx>>>§skills: HashMap<String, String>§provider: SupportedProvider§model: String§system: String§tool_context: Arc<ToolExecutionContext<Ctx>>§storage: Box<dyn AgentStorage>§parallel_tool_calls: boolTrait Implementations§
Source§impl<Ctx: Send + Sync + 'static> Agent for MicroAgent<Ctx>
impl<Ctx: Send + Sync + 'static> Agent for MicroAgent<Ctx>
Source§fn generate<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<GenerationStream, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn generate<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<GenerationStream, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Generate the next assistant response as a raw token stream.
The stream yields [StreamChunk]s that may contain text deltas or
partial tool calls. Higher-level orchestration (e.g. [run]) is
responsible for buffering and acting on tool calls.
Source§fn run<'async_trait>(
self,
prompt: String,
session_id: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<RunStream, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
fn run<'async_trait>(
self,
prompt: String,
session_id: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<RunStream, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
Run a complete conversation turn.
If session_id is Some the conversation history is restored from
storage; otherwise a new session is created. The returned stream yields
high-level events (AgentEventAny) including deltas, tool calls,
results, and the final stop event.
Auto Trait Implementations§
impl<Ctx> !RefUnwindSafe for MicroAgent<Ctx>
impl<Ctx> !UnwindSafe for MicroAgent<Ctx>
impl<Ctx> Freeze for MicroAgent<Ctx>
impl<Ctx> Send for MicroAgent<Ctx>
impl<Ctx> Sync for MicroAgent<Ctx>
impl<Ctx> Unpin for MicroAgent<Ctx>
impl<Ctx> UnsafeUnpin for MicroAgent<Ctx>
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