pub struct Agent { /* private fields */ }Expand description
Bidirectional handle consumed by a frontend.
Implementations§
Source§impl Agent
impl Agent
Sourcepub fn sender(&self) -> AgentSender
pub fn sender(&self) -> AgentSender
Returns a cloneable command sender.
Sourcepub fn model_router(&self) -> Arc<ModelRouter> ⓘ
pub fn model_router(&self) -> Arc<ModelRouter> ⓘ
Returns the immutable provider router owned by this runtime.
Sourcepub async fn next_event(&mut self) -> Option<Event>
pub async fn next_event(&mut self) -> Option<Event>
Receives the next agent event.
Frontends must keep draining events while the agent is running.
Sourcepub fn frontend(&self) -> &FrontendExtensions
pub fn frontend(&self) -> &FrontendExtensions
Returns the commands and status data exported by installed middleware.
Sourcepub fn session(&self) -> &SessionConfiguredEvent
pub fn session(&self) -> &SessionConfiguredEvent
Returns the immutable session descriptor emitted at startup.
Sourcepub fn model_route(&self) -> &str
pub fn model_route(&self) -> &str
Returns the selected model route at frontend startup.
Sourcepub fn model_choices(&self) -> &[ModelChoice]
pub fn model_choices(&self) -> &[ModelChoice]
Returns every model route exposed to frontend selectors.
Sourcepub const fn tool_count(&self) -> usize
pub const fn tool_count(&self) -> usize
Returns the number of tools registered for this agent.
Sourcepub const fn next_before_sequence(&self) -> Option<u64>
pub const fn next_before_sequence(&self) -> Option<u64>
Returns the cursor immediately preceding the initial transcript replay.
Sourcepub fn into_parts(self) -> (AgentSender, AgentEvents)
pub fn into_parts(self) -> (AgentSender, AgentEvents)
Separates command and event halves for a frontend event loop.
The returned event receiver must be drained while commands are active.
Sourcepub fn into_recorded_parts(self) -> (AgentSender, Receiver<JournalEvent>)
pub fn into_recorded_parts(self) -> (AgentSender, Receiver<JournalEvent>)
Separates command and durably recorded event halves.