SessionContext
Context available during the session hook.
Extends AgentContext with session-level data: session ID, state,
conversation history, and event emission.
Extends
Section titled “Extends”Extended by
Section titled “Extended by”Properties
Section titled “Properties”agent:
object
Agent definition: name, model, instructions.
instructions
Section titled “instructions”instructions:
string
model:
string
name:
string
Inherited from
Section titled “Inherited from”config
Section titled “config”config:
Record<string,unknown>
Middleware-specific configuration from the agent definition.
Inherited from
Section titled “Inherited from”history
Section titled “history”history:
Message[]
Canonical conversation history (append-only).
sessionId
Section titled “sessionId”sessionId:
string
Unique session identifier.
state:
Record<string,unknown>
Session state — typed fields with optional reducers, shared across all turns.
Methods
Section titled “Methods”emit()
Section titled “emit()”emit(
event):void
Emit a stream event to the consumer.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
registerTool()
Section titled “registerTool()”registerTool(
tool):void
Register a tool on the agent. Call in the agent hook before next().
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void