Struct Agent
pub struct Agent { /* private fields */ }Implementations§
Source§impl Agent
impl Agent
pub fn builder() -> AgentBuilder
pub fn set_channel_name(&mut self, name: String)
pub fn history(&self) -> &[ConversationMessage]
pub fn channel_handles(&self) -> &AgentChannelHandles
pub fn populate_channels( &self, channel_map: &HashMap<String, Arc<dyn Channel>>, ) -> Vec<String>
Sourcepub fn attribution_fields(&self) -> (String, String, String)
pub fn attribution_fields(&self) -> (String, String, String)
Attribution fields for opening a turn span at external call sites
(ACP, gateway WS) so every record inside a streamed turn carries the
same agent_alias/model_provider/model the RPC dispatch path sets.
Returns (agent_alias, model_provider, model).
pub fn clear_history(&mut self)
pub fn set_memory_session_id(&mut self, session_id: Option<String>)
pub fn set_temperature(&mut self, temperature: Option<f64>)
pub fn refresh_memory_embedder( &self, model_provider: &str, api_key: Option<&str>, model: &str, dimensions: usize, )
pub fn set_model_name(&mut self, model_name: String)
pub fn set_model_provider(&mut self, model_provider: Box<dyn ModelProvider>)
pub fn set_model_provider_name(&mut self, model_provider_name: String)
pub fn set_tool_dispatcher(&mut self, tool_dispatcher: Box<dyn ToolDispatcher>)
pub fn seed_history(&mut self, messages: &[ChatMessage])
Sourcepub fn seed_history_with_event(
&mut self,
messages: &[ChatMessage],
) -> Option<TurnEvent>
pub fn seed_history_with_event( &mut self, messages: &[ChatMessage], ) -> Option<TurnEvent>
Hydrate prior chat messages and return a transport event when restoring the history enforces the structured message cap.
Sourcepub fn seed_conversation_history(&mut self, messages: Vec<ConversationMessage>)
pub fn seed_conversation_history(&mut self, messages: Vec<ConversationMessage>)
Hydrate the agent with a full ConversationMessage history (e.g. restored
from an ACP session store). Preserves all variants including AssistantToolCalls
and ToolResults — use this for ACP restore; use seed_history for flat
channel session hydration.
Sourcepub fn seed_conversation_history_with_event(
&mut self,
messages: Vec<ConversationMessage>,
) -> Option<TurnEvent>
pub fn seed_conversation_history_with_event( &mut self, messages: Vec<ConversationMessage>, ) -> Option<TurnEvent>
Hydrate structured conversation history and return a transport event when restoring the history enforces the structured message cap.
pub async fn from_config( config: &Config, agent_alias: &str, ) -> Result<Agent, Error>
pub async fn from_config_with_session_cwd( config: &Config, agent_alias: &str, session_cwd: Option<&Path>, ) -> Result<Agent, Error>
pub async fn from_config_with_session_cwd_and_mcp( config: &Config, agent_alias: &str, session_cwd: Option<&Path>, initialize_mcp: bool, ) -> Result<Agent, Error>
pub async fn from_config_with_session_cwd_and_mcp_backchannel( config: &Config, agent_alias: &str, session_cwd: Option<&Path>, initialize_mcp: bool, exclude_memory: bool, sop_engine: Option<Arc<Mutex<SopEngine>>>, sop_audit: Option<Arc<SopAuditLogger>>, canvas_store: Option<CanvasStore>, ) -> Result<Agent, Error>
Sourcepub async fn from_live_config_with_session_cwd_and_mcp_backchannel(
live_config: Arc<RwLock<RawRwLock, Config>>,
agent_alias: &str,
session_cwd: Option<&Path>,
initialize_mcp: bool,
exclude_memory: bool,
sop_engine: Option<Arc<Mutex<SopEngine>>>,
sop_audit: Option<Arc<SopAuditLogger>>,
canvas_store: Option<CanvasStore>,
) -> Result<Agent, Error>
pub async fn from_live_config_with_session_cwd_and_mcp_backchannel( live_config: Arc<RwLock<RawRwLock, Config>>, agent_alias: &str, session_cwd: Option<&Path>, initialize_mcp: bool, exclude_memory: bool, sop_engine: Option<Arc<Mutex<SopEngine>>>, sop_audit: Option<Arc<SopAuditLogger>>, canvas_store: Option<CanvasStore>, ) -> Result<Agent, Error>
Build a daemon-backed ACP/WS Agent whose structured-history cap follows the shared config after reloads.
Sourcepub async fn from_config_with_tui_env(
config: &Config,
agent_alias: &str,
session_cwd: Option<&Path>,
initialize_mcp: bool,
exclude_memory: bool,
tui_env: Option<HashMap<String, String>>,
sop_engine: Option<Arc<Mutex<SopEngine>>>,
sop_audit: Option<Arc<SopAuditLogger>>,
) -> Result<Agent, Error>
pub async fn from_config_with_tui_env( config: &Config, agent_alias: &str, session_cwd: Option<&Path>, initialize_mcp: bool, exclude_memory: bool, tui_env: Option<HashMap<String, String>>, sop_engine: Option<Arc<Mutex<SopEngine>>>, sop_audit: Option<Arc<SopAuditLogger>>, ) -> Result<Agent, Error>
Like Self::from_config_with_session_cwd_and_mcp_backchannel but also
injects the TUI’s captured shell environment so that tools like
ShellTool inherit the user’s real PATH, SSH_AUTH_SOCK, etc.
rather than the daemon’s stripped-down process environment.
Sourcepub async fn from_live_config_with_tui_env(
live_config: Arc<RwLock<RawRwLock, Config>>,
agent_alias: &str,
session_cwd: Option<&Path>,
initialize_mcp: bool,
exclude_memory: bool,
tui_env: Option<HashMap<String, String>>,
sop_engine: Option<Arc<Mutex<SopEngine>>>,
sop_audit: Option<Arc<SopAuditLogger>>,
) -> Result<Agent, Error>
pub async fn from_live_config_with_tui_env( live_config: Arc<RwLock<RawRwLock, Config>>, agent_alias: &str, session_cwd: Option<&Path>, initialize_mcp: bool, exclude_memory: bool, tui_env: Option<HashMap<String, String>>, sop_engine: Option<Arc<Mutex<SopEngine>>>, sop_audit: Option<Arc<SopAuditLogger>>, ) -> Result<Agent, Error>
Build a daemon-backed TUI Agent whose structured-history cap follows the shared config after reloads.
pub async fn turn(&mut self, user_message: &str) -> Result<String, Error>
pub async fn turn_streamed( &mut self, user_message: &str, event_tx: Sender<TurnEvent>, cancel_token: Option<CancellationToken>, ) -> Result<(String, Vec<ConversationMessage>), Error>
pub async fn turn_streamed_with_steering_state( &mut self, user_message: &str, event_tx: Sender<TurnEvent>, cancel_token: Option<CancellationToken>, steering_rx: Option<&mut Receiver<String>>, ) -> Result<StreamedTurnSuccess, StreamedTurnError>
pub async fn run_single(&mut self, message: &str) -> Result<String, Error>
pub async fn run_interactive(&mut self) -> Result<(), Error>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Agent
impl !RefUnwindSafe for Agent
impl Send for Agent
impl Sync for Agent
impl Unpin for Agent
impl UnsafeUnpin for Agent
impl !UnwindSafe for Agent
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more