Back to catalog / Agent state
Scope agent state by user, application, and invocation
Use explicit state namespaces to control which values persist across sessions and which are invocation-only.
Goal
Prevent temporary data from leaking into later sessions and keep user preferences scoped to that user.
Steps
- List each state field and its lifetime: app, user, session, or temporary. [state]
- Use the
app:,user:, ortemp:prefix—or a session-scoped key—according to lifetime; keep credentials and unnecessary personal data out. [state] - Read and write through Context/ToolContext and confirm required updates persist through session events. [state]
- Test two users and multiple sessions for user isolation, session inheritance, and temporary-field cleanup. [state]
How to verify
Inspect state deltas and final sessions; each field should be visible only for its intended lifetime.
Troubleshooting
If a value is not saved, check event append behavior; if it is shared incorrectly, fix namespaces and user binding.
Permissions
Prerequisites
- Python 3.11+, google-adk compatible with the pinned revision, and an isolated test environment
- A configured SessionService; cross-session retrieval also requires a MemoryService
Permissions
- Use authorized test data only; isolate sessions and credentials per user; obtain human authorization before external side effects
Limitations
This procedure follows Google ADK at the pinned revision; other versions, models, or remote services may differ in APIs and event semantics. Recheck permissions, retention, and recovery before production.
Pinned upstream source
- Repository
- google/adk-python
- File path
- docs/guides/sessions/state/index.md
- Pinned commit
e9b74d36140f2594b24c481fb7a3825b2cb01e96- Source checked
- 2026-10-14 · Reviewed against the pinned upstream source
Repository metrics
These values describe the upstream repository, not popularity or likes for an individual skill or playbook.
- Stars
- Not collected
- Forks
- Not collected
- Observed at
- Not collected
No metrics snapshot is available yet.
License: Apache-2.0
Main topic
Turn ecommerce campaign materials into a reviewable weekly brief