pub trait Session: Send {
// Required methods
fn turn_stream(
&mut self,
input: Input,
options: TurnOptions,
) -> Pin<Box<dyn Future<Output = Result<EventStream, AgentError>> + Send + '_>>;
fn session_id(&self) -> Option<&str>;
fn interrupt(
&mut self,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + '_>>;
// Provided method
fn turn(
&mut self,
input: Input,
options: TurnOptions,
) -> Pin<Box<dyn Future<Output = Result<TurnOutput, AgentError>> + Send + '_>> { ... }
}Required Methods§
Sourcefn turn_stream(
&mut self,
input: Input,
options: TurnOptions,
) -> Pin<Box<dyn Future<Output = Result<EventStream, AgentError>> + Send + '_>>
fn turn_stream( &mut self, input: Input, options: TurnOptions, ) -> Pin<Box<dyn Future<Output = Result<EventStream, AgentError>> + Send + '_>>
Run a turn and return a stream of events.
Sourcefn session_id(&self) -> Option<&str>
fn session_id(&self) -> Option<&str>
Session ID (populated after the first turn completes).
Provided Methods§
Sourcefn turn(
&mut self,
input: Input,
options: TurnOptions,
) -> Pin<Box<dyn Future<Output = Result<TurnOutput, AgentError>> + Send + '_>>
fn turn( &mut self, input: Input, options: TurnOptions, ) -> Pin<Box<dyn Future<Output = Result<TurnOutput, AgentError>> + Send + '_>>
Run a turn and return the buffered result.
Default implementation calls turn_stream then collect_turn.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".