Core Concepts
The memory and state system is built on three foundational services:Memory
Long-term memory storage with semantic search for retrieving relevant past conversations
Sessions
Short-term conversation state with event tracking and multi-level state scoping
Artifacts
File and data storage with versioning for agent-generated content
Architecture
Memory vs Sessions vs Artifacts
Understanding when to use each system:Memory Service - Long-term Context
Memory Service - Long-term Context
Use for: Retrieving relevant information from past conversations
- Stores summaries of completed sessions
- Enables semantic search across conversation history
- Persists indefinitely until explicitly deleted
- Powers “remember when I told you…” capabilities
Session Service - Active Conversation
Session Service - Active Conversation
Use for: Managing the current conversation and its state
- Tracks all events in an active conversation
- Manages state variables (counters, flags, temporary data)
- Supports rewind and state delta tracking
- Automatically handles state scoping (session/user/app)
Artifact Service - File Storage
Artifact Service - File Storage
Use for: Storing files and binary data generated by agents
- Saves agent-generated files (reports, images, code)
- Maintains version history for all artifacts
- Supports both session-scoped and user-scoped storage
- Handles binary data and large content
Quick Start
Configure Sessions
Choose between in-memory (development) or database-backed (production) session storage:
State Scoping
ADK-TS supports three levels of state, each with different persistence and scope:| Scope | Prefix | Lifetime | Use Case |
|---|---|---|---|
| Session | None | Single conversation | Temporary data for current interaction |
| User | user: | All user sessions | User preferences and history |
| App | app: | All app sessions | Global configuration and statistics |
| Temporary | temp: | Single invocation | Scratch data, not persisted |
Development vs Production
Next Steps
Memory Services
Learn about long-term memory storage and semantic search
Session Management
Understand session lifecycle and event tracking
State Management
Master state scoping and delta tracking
Artifacts
Work with file storage and versioning
Key Features
Multi-level State Scoping
Multi-level State Scoping
Automatically manage state at session, user, and app levels with prefix-based namespacing.
State Delta Tracking
State Delta Tracking
Only persist what changed with efficient delta tracking for state updates.
Session Rewind
Session Rewind
Travel back in time by rewinding sessions to previous states for error recovery.
Semantic Memory Search
Semantic Memory Search
Find relevant past conversations using vector embeddings and similarity search.
Artifact Versioning
Artifact Versioning
Track every version of agent-generated files with automatic version control.
Pluggable Storage
Pluggable Storage
Swap between in-memory, database, and cloud storage with consistent interfaces.