pub struct SessionContext {
pub session_id: Option<String>,
pub service_session_id: Option<String>,
pub session: Option<AgentSession>,
pub input_messages: Vec<Message>,
pub instructions: Option<String>,
pub messages: Vec<Message>,
pub tools: Vec<ToolDefinition>,
}Expand description
Per-invocation context a provider contributes to a run. Providers mutate this in place in before_run. Rust equivalent of upstream SessionContext.
Fields§
§session_id: Option<String>Local session identifier (from the thread), for provider scoping.
service_session_id: Option<String>Service-managed session/conversation id, when applicable.
session: Option<AgentSession>The session the run belongs to, when the caller of before_run has
one (an Agent run always does). Clones share
the session’s state bag, so a provider can read and persist
per-session state through it. Mirrors the session argument of
upstream’s before_run.
input_messages: Vec<Message>The run’s input messages (read-only for providers).
instructions: Option<String>Extra system instructions to inject (providers append via add_instructions).
messages: Vec<Message>Extra context messages to inject ahead of history.
tools: Vec<ToolDefinition>Extra tools to make available for this run.
Implementations§
Source§impl SessionContext
impl SessionContext
pub fn new(input_messages: Vec<Message>) -> SessionContext
Sourcepub fn add_instructions(&mut self, s: impl Into<String>)
pub fn add_instructions(&mut self, s: impl Into<String>)
Append instructions, newline-concatenating with any already present.
Trait Implementations§
Source§impl Clone for SessionContext
impl Clone for SessionContext
Source§fn clone(&self) -> SessionContext
fn clone(&self) -> SessionContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more