Agent Wealth HubFree public resources
中文 EN العربية

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

  1. List each state field and its lifetime: app, user, session, or temporary. [state]
  2. Use the app:, user:, or temp: prefix—or a session-scoped key—according to lifetime; keep credentials and unnecessary personal data out. [state]
  3. Read and write through Context/ToolContext and confirm required updates persist through session events. [state]
  4. 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

Permissions

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

https://github.com/google/adk-python/blob/e9b74d36140f2594b24c481fb7a3825b2cb01e96/docs/guides/sessions/state/index.md

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

Related resources