Skip to main content

Module session

Module session 

Source
Expand description

Conversation sessions.

Rust equivalent of upstream’s _sessions.py. Upstream deleted _threads.py and _memory.py, consolidating a lightweight AgentSession ({session_id, service_session_id, state}) with memory/context providers. Conversation history left the session entirely: it is now injected by a HistoryProvider — just another ContextProvider — via before_run/after_run, instead of being owned by a message store on the thread/session itself.

A session is no longer “service-managed XOR locally-stored”: it always carries a session_id, optionally a service_session_id (when the underlying service manages the conversation server-side), a bag of free-form state, and the context_providers that run on every use.

Structs§

AgentSession
A conversation session: a lightweight identity + state container.
SessionState
The free-form state bag of an AgentSession, shared by reference across clones.

Constants§

MESSAGE_INJECTION_PENDING_MESSAGES_STATE_KEY
The session-state key holding messages queued for injection; see enqueue_messages. Upstream’s MESSAGE_INJECTION_PENDING_MESSAGES_STATE_KEY.

Functions§

enqueue_messages
Queue messages for the next model call of a run on session.
pending_messages
A snapshot of the messages queued on session.