Skip to main content

Module session

Module session 

Source
Available on crate feature sessions only.
Expand description

Session management.

Manage conversation context and state:

  • InMemorySessionService - In-memory sessions
  • Session creation, retrieval, and lifecycle
  • State management with scoped prefixes

Available with feature: sessions

Modules§

event
Event types and the Events trait for accessing session event history.
inmemory
In-memory session backend for testing and lightweight use cases.
migration
Schema migration utilities for database-backed session stores. Lightweight, embedded migration runner for SQL-backed session services.
service
Session service trait and request/response types.
session
The Session trait and state key prefix constants.
state
State access traits (State and ReadonlyState).
state_utils
Shared utilities for extracting and merging state deltas across backends. Shared state utility functions for session backends.

Structs§

AppendEventRequest
Request to append an event to a session using typed AdkIdentity addressing.
CreateRequest
Request to create a new session.
DeleteRequest
Request to delete a session.
Event
Event represents a single interaction in a conversation. This struct embeds LlmResponse to match ADK-Go’s design pattern.
EventActions
Actions to apply as side effects of an event.
GetRequest
Request to retrieve an existing session.
InMemorySessionService
In-memory session service for testing and lightweight deployments.
ListRequest
Request to list sessions for a given app and user.

Constants§

KEY_PREFIX_APP
Key prefix for application-scoped state entries.
KEY_PREFIX_TEMP
Key prefix for temporary state entries (stripped on event append).
KEY_PREFIX_USER
Key prefix for user-scoped state entries.

Traits§

Events
Trait for accessing events in a session.
ReadonlyState
Read-only view of session state.
Session
Trait representing a conversation session with state and event history.
SessionService
Trait for session persistence backends.
State
Mutable key-value state store for a session.

Functions§

extract_state_deltas
Split a flat state map into (app, user, session) tiers.
merge_states
Merge three state tiers back into a flat map with prefixes restored.