pub struct Agent<C, T, S>{
pub pending_skill_references: Option<Vec<SkillKey>>,
/* private fields */
}Expand description
The main Agent struct
Fields§
§pending_skill_references: Option<Vec<SkillKey>>Skill references to resolve and inject for the next turn.
Set by surfaces before calling run(), consumed on run start.
Implementations§
Source§impl<C, T, S> Agent<C, T, S>where
C: AgentLlmClient + ?Sized + 'static,
T: AgentToolDispatcher + ?Sized + 'static,
S: AgentSessionStore + ?Sized + 'static,
impl<C, T, S> Agent<C, T, S>where
C: AgentLlmClient + ?Sized + 'static,
T: AgentToolDispatcher + ?Sized + 'static,
S: AgentSessionStore + ?Sized + 'static,
Sourcepub fn comms(&self) -> Option<&dyn CommsRuntime>
pub fn comms(&self) -> Option<&dyn CommsRuntime>
Get the comms runtime, if enabled.
Sourcepub fn comms_arc(&self) -> Option<Arc<dyn CommsRuntime>>
pub fn comms_arc(&self) -> Option<Arc<dyn CommsRuntime>>
Get a shared handle to the comms runtime, if enabled.
Source§impl<C, T, S> Agent<C, T, S>
impl<C, T, S> Agent<C, T, S>
Sourcepub fn stage_external_tool_filter(
&mut self,
filter: ToolFilter,
) -> Result<ToolScopeRevision, ToolScopeStageError>
pub fn stage_external_tool_filter( &mut self, filter: ToolFilter, ) -> Result<ToolScopeRevision, ToolScopeStageError>
Stage an external tool visibility filter update for subsequent turns.
Sourcepub fn set_flow_tool_overlay(
&mut self,
overlay: Option<TurnToolOverlay>,
) -> Result<(), ToolScopeStageError>
pub fn set_flow_tool_overlay( &mut self, overlay: Option<TurnToolOverlay>, ) -> Result<(), ToolScopeStageError>
Set or clear a per-turn flow tool overlay.
Set the shared mob authority handle for session-effect application.
The agent updates this handle after merging SessionEffects from tool
dispatch. Mob tools read from it for authorization checks.
Sourcepub fn replace_client(&mut self, client: Arc<C>)
pub fn replace_client(&mut self, client: Arc<C>)
Replace the LLM client for subsequent turns.
Enables hot-swapping the model/provider on a live session without
rebuilding the agent. The new client takes effect on the next
run() / run_with_events() call.
Source§impl<C, T, S> Agent<C, T, S>where
C: AgentLlmClient + ?Sized + 'static,
T: AgentToolDispatcher + ?Sized + 'static,
S: AgentSessionStore + ?Sized + 'static,
impl<C, T, S> Agent<C, T, S>where
C: AgentLlmClient + ?Sized + 'static,
T: AgentToolDispatcher + ?Sized + 'static,
S: AgentSessionStore + ?Sized + 'static,
Sourcepub fn builder() -> AgentBuilder
pub fn builder() -> AgentBuilder
Create a new agent builder
Sourcepub fn session_mut(&mut self) -> &mut Session
pub fn session_mut(&mut self) -> &mut Session
Get mutable access to the session (for setting metadata)
Sourcepub fn retry_policy(&self) -> &RetryPolicy
pub fn retry_policy(&self) -> &RetryPolicy
Get the retry policy
Sourcepub fn tool_scope(&self) -> &ToolScope
pub fn tool_scope(&self) -> &ToolScope
Access the live tool-scope projection bridge.
Sourcepub fn system_context_state(&self) -> Arc<Mutex<SessionSystemContextState>>
pub fn system_context_state(&self) -> Arc<Mutex<SessionSystemContextState>>
Get shared runtime system-context control state.
Sourcepub fn session_with_system_context_state(&self) -> Session
pub fn session_with_system_context_state(&self) -> Session
Clone the current session with the latest shared system-context state merged into metadata.
Sourcepub async fn run(
&mut self,
user_input: ContentInput,
) -> Result<RunResult, AgentError>
pub async fn run( &mut self, user_input: ContentInput, ) -> Result<RunResult, AgentError>
Run the agent with a user message.
Sourcepub async fn run_with_events(
&mut self,
user_input: ContentInput,
event_tx: Sender<AgentEvent>,
) -> Result<RunResult, AgentError>
pub async fn run_with_events( &mut self, user_input: ContentInput, event_tx: Sender<AgentEvent>, ) -> Result<RunResult, AgentError>
Run the agent with events streamed to the provided channel.
Sourcepub async fn run_pending(&mut self) -> Result<RunResult, AgentError>
pub async fn run_pending(&mut self) -> Result<RunResult, AgentError>
Run the agent using the pending continuation boundary already in the session.
This is useful when the session has been pre-populated with a continuation
boundary (for example a deferred first-turn user message or staged callback
tool results). Unlike run(), this method does NOT add a new user message;
it runs directly from the session’s current state.
Returns an error if the session doesn’t end at a resumable continuation
boundary (User or ToolResults).
Sourcepub async fn run_pending_with_events(
&mut self,
event_tx: Sender<AgentEvent>,
) -> Result<RunResult, AgentError>
pub async fn run_pending_with_events( &mut self, event_tx: Sender<AgentEvent>, ) -> Result<RunResult, AgentError>
Run the agent using the pending continuation boundary, with event streaming.
Like run_pending(), but emits events to the provided channel.