hindsight-google-adk
Persistent long-term memory for Google ADK agents via Hindsight.
The package gives you two complementary patterns:
HindsightMemoryService— Implements ADK'sBaseMemoryService. Pass it toRunner(memory_service=...)and sessions are automatically retained on completion; agents callingsearch_memoryget results back from Hindsight.create_hindsight_tools(...)— Returns a list of ADKFunctionToolinstances (hindsight_retain,hindsight_recall,hindsight_reflect) the model can call inside a turn.
Installation
pip install hindsight-google-adk
Quick Start: Automatic Memory
import asyncio
from google.adk.agents import LlmAgent
from google.adk.runners import Runner
from google.adk.sessions import InMemorySessionService
from hindsight_google_adk import HindsightMemoryService
memory = HindsightMemoryService.from_url(
hindsight_api_url="https://api.hindsight.vectorize.io",
api_key="hsk_...",
)
agent = LlmAgent(name="assistant", model="gemini-2.0-flash")
runner = Runner(
app_name="my-app",
agent=agent,
session_service=InMemorySessionService(),
memory_service=memory,
)
When a session ends, Runner calls add_session_to_memory, which retains the session's events to a Hindsight bank keyed by (app_name, user_id). When the agent (or another call) invokes search_memory(app_name, user_id, query), the integration runs a Hindsight recall and returns the results as ADK MemoryEntry objects.
Quick Start: Explicit Tools
from google.adk.agents import LlmAgent
from hindsight_google_adk import create_hindsight_tools
tools = create_hindsight_tools(
bank_id="user-123",
hindsight_api_url="https://api.hindsight.vectorize.io",
api_key="hsk_...",
)
agent = LlmAgent(name="assistant", model="gemini-2.0-flash", tools=tools)
The agent now has three tools (toggle with include_retain / include_recall / include_reflect):
hindsight_retain(content)— store information to long-term memoryhindsight_recall(query)— search memory and return matcheshindsight_reflect(query)— synthesize a coherent answer from memory
Global Configuration
For shared defaults, call configure(...) once at startup:
from hindsight_google_adk import configure
configure(
hindsight_api_url="https://api.hindsight.vectorize.io",
api_key=None, # falls back to HINDSIGHT_API_KEY env var
bank_id_template="{app_name}::{user_id}",
budget="mid",
max_tokens=4096,
)
Subsequent HindsightMemoryService.from_url() and create_hindsight_tools() calls use the global config as a fallback.
Bank ID Derivation
By default, each (app_name, user_id) pair gets its own bank: "{app_name}::{user_id}". Override with bank_id_template:
# Per-user bank shared across apps
HindsightMemoryService.from_url(..., bank_id_template="user::{user_id}")
# Static bank shared across all users
HindsightMemoryService.from_url(..., bank_id_template="my-shared-bank")
Configuration Reference
| Argument | Default | Description |
|---|---|---|
hindsight_api_url |
https://api.hindsight.vectorize.io |
Hindsight API URL (Cloud by default). |
api_key |
HINDSIGHT_API_KEY env |
Bearer token for Hindsight Cloud. |
bank_id_template |
"{app_name}::{user_id}" |
Format string for deriving the bank id. |
budget |
"mid" |
Recall budget: low/mid/high. |
max_tokens |
4096 |
Max tokens for recall results. |
tags |
None |
Extra tags added to retains. app: and user: are always added. |
recall_tags |
None |
Extra tags appended to recall queries. user: is always added. |
recall_tags_match |
"any" |
Tag match mode: any / all / any_strict / all_strict. |
mission |
None |
If set, the bank is created (idempotent) on first use with this fact-extraction mission. |
context |
"google-adk" |
Provenance label attached to retained content. |
Memory Scoping with Tags
Each retained session/event carries app:<app_name> and user:<user_id> tags. Recall queries automatically include user:<user_id> so users never see each other's memories. Pass tags=[...] to extend the retain set or recall_tags=[...] to filter recall further.
Connection Modes
Hindsight Cloud (recommended)
HindsightMemoryService.from_url(
hindsight_api_url="https://api.hindsight.vectorize.io",
api_key="hsk_...",
)
Self-hosted
HindsightMemoryService.from_url(hindsight_api_url="http://localhost:8888")
Error Handling
All add_* and search_memory methods are resilient: Hindsight failures are logged but never propagate to the Runner. The explicit tools raise HindsightError on failure so the agent can react.
Requirements
- Python 3.10+
google-adk>=2.0hindsight-client>=0.4.0
License
MIT
Metadata
Release files for hindsight-google-adk 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hindsight_google_adk-0.1.1.tar.gz | 168.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hindsight_google_adk-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 181.3 kB
Release files / hindsight_google_adk-0.1.1.tar.gz
| Download URL | hindsight_google_adk-0.1.1.tar.gz |
|---|---|
| Size | 168.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
562cf4e4ca5e459dbcd04ae0c2ae49011ae2f9c27790d4fd711f90218d9d7bb4
|
|
BLAKE2b-256 checksum How to use checksums |
872bcb59477229614ec33c937211953013a892a5e9ac4b93347ceb47101a358d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.
Transparency logRelease files / hindsight_google_adk-0.1.1-py3-none-any.whl
| Download URL | hindsight_google_adk-0.1.1-py3-none-any.whl |
|---|---|
| Size | 13.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e91a7e621bd427f599f433cacee408ba6ef044abac0a8b27fad47c54ede4edc0
|
|
BLAKE2b-256 checksum How to use checksums |
9beeb8127c0e0040fdd8c04f142c5ad0e9df72f60518883550be969a29932a87
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.
Transparency log