pub struct SessionAgent<M, C, T, R>where
M: Clone + Serialize + DeserializeOwned + Into<InputItem> + Send + Sync + 'static,
C: TypedTool + Clone + Serialize + DeserializeOwned + Send + Sync + 'static,
T: Clone + Serialize + DeserializeOwned + Send + Sync + 'static,
R: Clone + Serialize + DeserializeOwned + JsonSchema + Send + Sync + 'static,{ /* private fields */ }Expand description
Default model-backed implementation of super::Agent.
SessionAgent owns the runner, context manager, execution profile, optional
typed tool execution, and the mutable turn/session state required to drive a
conversation.
Implementations§
Source§impl<M, C, T, R> SessionAgent<M, C, T, R>where
M: Clone + Serialize + DeserializeOwned + Into<InputItem> + Send + Sync + 'static,
C: TypedTool + Clone + Serialize + DeserializeOwned + Send + Sync + 'static,
T: Clone + Serialize + DeserializeOwned + Send + Sync + 'static,
R: Clone + Serialize + DeserializeOwned + JsonSchema + Send + Sync + 'static,
impl<M, C, T, R> SessionAgent<M, C, T, R>where
M: Clone + Serialize + DeserializeOwned + Into<InputItem> + Send + Sync + 'static,
C: TypedTool + Clone + Serialize + DeserializeOwned + Send + Sync + 'static,
T: Clone + Serialize + DeserializeOwned + Send + Sync + 'static,
R: Clone + Serialize + DeserializeOwned + JsonSchema + Send + Sync + 'static,
pub async fn send(&mut self, input: AgentInput<M>) -> AgentResult<()>
pub async fn send_with_profile( &mut self, input: AgentInput<M>, profile: ExecutionProfile, ) -> AgentResult<()>
pub async fn next(&mut self) -> AgentResult<Option<AgentEvent<C, T, R>>>
pub async fn spawn( self, ) -> AgentResult<(AgentRunInput<M>, AgentRunOutput<C, T, R>)>
pub async fn transcript(&self) -> AgentResult<Vec<InputItem>>
pub fn active_turn(&self) -> Option<u64>
pub fn queued_turn_count(&self) -> usize
Source§impl SessionAgent<InputItem, (), (), String>
impl SessionAgent<InputItem, (), (), String>
pub fn raw_builder() -> AgentBuilder<InputItem, (), (), String>
Trait Implementations§
Source§impl<M, C, T, R> Agent for SessionAgent<M, C, T, R>where
M: Clone + Serialize + DeserializeOwned + Into<InputItem> + Send + Sync + 'static,
C: TypedTool + Clone + Serialize + DeserializeOwned + Send + Sync + 'static,
T: Clone + Serialize + DeserializeOwned + Send + Sync + 'static,
R: Clone + Serialize + DeserializeOwned + JsonSchema + Send + Sync + 'static,
impl<M, C, T, R> Agent for SessionAgent<M, C, T, R>where
M: Clone + Serialize + DeserializeOwned + Into<InputItem> + Send + Sync + 'static,
C: TypedTool + Clone + Serialize + DeserializeOwned + Send + Sync + 'static,
T: Clone + Serialize + DeserializeOwned + Send + Sync + 'static,
R: Clone + Serialize + DeserializeOwned + JsonSchema + Send + Sync + 'static,
Source§type ToolResult = T
type ToolResult = T
Tool result type returned into the agent after execution.
Source§async fn send(&mut self, input: AgentInput<Self::Input>) -> AgentResult<()>
async fn send(&mut self, input: AgentInput<Self::Input>) -> AgentResult<()>
Sends an input into the session.
Source§async fn next(
&mut self,
) -> AgentResult<Option<AgentEvent<Self::ToolCall, Self::ToolResult, Self::Output>>>
async fn next( &mut self, ) -> AgentResult<Option<AgentEvent<Self::ToolCall, Self::ToolResult, Self::Output>>>
Advances the session and yields the next event, if any.
Source§async fn spawn(
self,
) -> AgentResult<(AgentRunInput<Self::Input>, AgentRunOutput<Self::ToolCall, Self::ToolResult, Self::Output>)>
async fn spawn( self, ) -> AgentResult<(AgentRunInput<Self::Input>, AgentRunOutput<Self::ToolCall, Self::ToolResult, Self::Output>)>
Spawns the agent as a background task and exposes channel-based I/O.
Source§async fn cast(&mut self, input: Self::Input) -> AgentResult<()>
async fn cast(&mut self, input: Self::Input) -> AgentResult<()>
Sends a normal user message without waiting for completion.
Source§async fn call(&mut self, input: Self::Input) -> AgentResult<Self::Output>
async fn call(&mut self, input: Self::Input) -> AgentResult<Self::Output>
Sends a normal user message and waits for the terminal reply.
Source§async fn steer(&mut self, input: Self::Input) -> AgentResult<Self::Output>
async fn steer(&mut self, input: Self::Input) -> AgentResult<Self::Output>
Sends steering input and waits for the resulting terminal reply.
Source§async fn cancel(&mut self) -> AgentResult<()>
async fn cancel(&mut self) -> AgentResult<()>
Requests cancellation and waits until the session observes it.
Auto Trait Implementations§
impl<M, C, T, R> Freeze for SessionAgent<M, C, T, R>where
C: Freeze,
impl<M, C, T, R> !RefUnwindSafe for SessionAgent<M, C, T, R>
impl<M, C, T, R> Send for SessionAgent<M, C, T, R>
impl<M, C, T, R> Sync for SessionAgent<M, C, T, R>
impl<M, C, T, R> Unpin for SessionAgent<M, C, T, R>
impl<M, C, T, R> UnsafeUnpin for SessionAgent<M, C, T, R>where
C: UnsafeUnpin,
impl<M, C, T, R> !UnwindSafe for SessionAgent<M, C, T, R>
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