Expand description
§adk-session
Session management and state persistence for ADK agents.
§Overview
This crate provides session and state management:
InMemorySessionService- Simple in-memory session storageVertexAiSessionService- Vertex AI Session API backend (vertex-sessionfeature)Session- Conversation session with state and eventsState- Key-value state with typed prefixesSessionService- Trait for custom session backends
§Quick Start
use adk_session::InMemorySessionService;
let service = InMemorySessionService::new();
// Sessions are created and managed by the Runner
// State is accessed via the session§State Prefixes
ADK uses prefixes to organize state:
| Prefix | Constant | Purpose |
|---|---|---|
user: | KEY_PREFIX_USER | User preferences |
app: | KEY_PREFIX_APP | Application state |
temp: | KEY_PREFIX_TEMP | Temporary data |
Re-exports§
pub use event::Events;pub use inmemory::InMemorySessionService;pub use service::AppendEventRequest;pub use service::CreateRequest;pub use service::DeleteRequest;pub use service::GetRequest;pub use service::ListRequest;pub use service::SessionService;pub use session::KEY_PREFIX_APP;pub use session::KEY_PREFIX_TEMP;pub use session::KEY_PREFIX_USER;pub use session::Session;pub use state::ReadonlyState;pub use state::State;pub use state_utils::extract_state_deltas;pub use state_utils::merge_states;
Modules§
- event
- Event types and the
Eventstrait 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
Sessiontrait and state key prefix constants. - state
- State access traits (
StateandReadonlyState). - state_
utils - Shared utilities for extracting and merging state deltas across backends. Shared state utility functions for session backends.
Structs§
- Event
- Event represents a single interaction in a conversation. This struct embeds LlmResponse to match ADK-Go’s design pattern.
- Event
Actions - Actions to apply as side effects of an event.