sessions¶
sessions
¶
Redis session services for ADK.
RedisSessionMemoryService
¶
RedisSessionMemoryService(config: RedisSessionMemoryServiceConfig | None = None)
Bases: BaseSessionService
Session service backed by Redis memory backends.
Redis Agent Memory stores session events by session ID. The self-hosted Agent Memory Server stores sessions in Working Memory. Returned ADK sessions keep the original caller-facing session ID for both backends.
Initialize the Redis Agent Memory session service.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
RedisSessionMemoryServiceConfig | None
|
Configuration for the service. If None, defaults are used. |
None
|
Source code in src/adk_redis/sessions/session_memory.py
create_session
async
¶
create_session(*, app_name: str, user_id: str, state: dict[str, Any] | None = None, session_id: str | None = None) -> Session
Create a new ADK session object.
Redis Agent Memory creates a stored session when the first event is appended, so this method returns the ADK session without writing a marker event.
Source code in src/adk_redis/sessions/session_memory.py
get_session
async
¶
get_session(*, app_name: str, user_id: str, session_id: str, config: GetSessionConfig | None = None) -> Session | None
Retrieve an ADK session from Redis Agent Memory.
Source code in src/adk_redis/sessions/session_memory.py
list_sessions
async
¶
List stored sessions from Redis Agent Memory.
Source code in src/adk_redis/sessions/session_memory.py
delete_session
async
¶
Delete a session from Redis Agent Memory.
Source code in src/adk_redis/sessions/session_memory.py
append_event
async
¶
Append an event to the ADK session and configured backend.
Source code in src/adk_redis/sessions/session_memory.py
RedisSessionMemoryServiceConfig
¶
Bases: BaseModel
Configuration for Redis session memory service.
Attributes:
| Name | Type | Description |
|---|---|---|
backend |
MemoryBackendName
|
Memory backend to use. |
api_base_url |
str
|
Memory API base URL. |
api_key |
str | None
|
Redis Agent Memory API key. |
store_id |
str | None
|
Redis Agent Memory store ID. |
timeout |
float
|
HTTP request timeout in seconds. |
timeout_ms |
int | None
|
Optional SDK timeout in milliseconds. |
default_namespace |
str | None
|
Default namespace for session isolation. |
model_name |
str | None
|
Backward-compatible option retained from the previous client. |
context_window_max |
int | None
|
Backward-compatible option retained from the previous client. |
extraction_strategy |
Literal['discrete', 'summary', 'preferences', 'custom']
|
Backward-compatible option retained from the previous client. |
extraction_strategy_config |
dict[str, Any]
|
Backward-compatible option retained from the previous client. |
session_ttl_seconds |
int | None
|
Backward-compatible option retained from the previous client. |
RedisWorkingMemorySessionService
¶
RedisWorkingMemorySessionService(config: RedisSessionMemoryServiceConfig | None = None)
Bases: RedisSessionMemoryService
Deprecated alias for :class:RedisSessionMemoryService.
Retained for backward compatibility and removed in 0.1.0.
Source code in src/adk_redis/sessions/session_memory.py
create_session
async
¶
create_session(*, app_name: str, user_id: str, state: dict[str, Any] | None = None, session_id: str | None = None) -> Session
Create a new ADK session object.
Redis Agent Memory creates a stored session when the first event is appended, so this method returns the ADK session without writing a marker event.
Source code in src/adk_redis/sessions/session_memory.py
get_session
async
¶
get_session(*, app_name: str, user_id: str, session_id: str, config: GetSessionConfig | None = None) -> Session | None
Retrieve an ADK session from Redis Agent Memory.
Source code in src/adk_redis/sessions/session_memory.py
list_sessions
async
¶
List stored sessions from Redis Agent Memory.
Source code in src/adk_redis/sessions/session_memory.py
delete_session
async
¶
Delete a session from Redis Agent Memory.
Source code in src/adk_redis/sessions/session_memory.py
append_event
async
¶
Append an event to the ADK session and configured backend.
Source code in src/adk_redis/sessions/session_memory.py
RedisWorkingMemorySessionServiceConfig
¶
Bases: RedisSessionMemoryServiceConfig
Deprecated alias for :class:RedisSessionMemoryServiceConfig.
Retained for backward compatibility and removed in 0.1.0.