Skip to main content

hindsight-agno

Persistent memory tools for Agno agents via Hindsight. Give your agents long-term memory with retain, recall, and reflect — using Agno's native Toolkit pattern.

Features

  • Native Toolkit - Extends Agno's Toolkit base class, just like Mem0Tools
  • Memory Instructions - Pre-recall memories for injection into Agent(instructions=[...])
  • Three Memory Tools - Retain (store), Recall (search), Reflect (synthesize) — include any combination
  • Flexible Bank Resolution - Static bank ID, RunContext.user_id, or custom resolver
  • Simple Configuration - Configure once globally, or pass a client directly

Installation

pip install hindsight-agno

Quick Start

✨ Recommended: Hindsight Cloud — free tier, no self-hosting required. Sign up and grab an API key in under a minute.

from agno.agent import Agent
from agno.models.openai import OpenAIChat
from hindsight_agno import HindsightTools

agent = Agent(
    model=OpenAIChat(id="gpt-4o-mini"),
    tools=[HindsightTools(
        bank_id="user-123",
        hindsight_api_url="https://api.hindsight.vectorize.io",
        api_key="hsk_...",  # or set HINDSIGHT_API_KEY env var
    )],
)

agent.print_response("Remember that I prefer dark mode")
agent.print_response("What are my preferences?")

The agent now has three tools it can call:

  • retain_memory — Store information to long-term memory
  • recall_memory — Search long-term memory for relevant facts
  • reflect_on_memory — Synthesize a reasoned answer from memories

Self-hosting (local development)

If you're running Hindsight locally with ./scripts/dev/start-api.sh, point at your local server instead:

tools=[HindsightTools(
    bank_id="user-123",
    hindsight_api_url="https://api.hindsight.vectorize.io",
)]

See the Hindsight installation guide for self-hosting setup.

With Memory Instructions

Pre-recall relevant memories and inject them into the system prompt:

from hindsight_agno import HindsightTools, memory_instructions

agent = Agent(
    model=OpenAIChat(id="gpt-4o-mini"),
    tools=[HindsightTools(
        bank_id="user-123",
        hindsight_api_url="https://api.hindsight.vectorize.io",
    )],
    instructions=[memory_instructions(
        bank_id="user-123",
        hindsight_api_url="https://api.hindsight.vectorize.io",
    )],
)

Selecting Tools

Include only the tools you need:

tools = [HindsightTools(
    bank_id="user-123",
    hindsight_api_url="https://api.hindsight.vectorize.io",
    enable_retain=True,
    enable_recall=True,
    enable_reflect=False,  # Omit reflect
)]

Bank Resolution

The bank ID is resolved in order:

  1. bank_resolver — Custom callable (RunContext) -> str
  2. bank_id — Static bank ID passed to constructor
  3. run_context.user_id — Automatic per-user banks
# Per-user banks from RunContext
agent = Agent(
    model=OpenAIChat(id="gpt-4o-mini"),
    tools=[HindsightTools(hindsight_api_url="https://api.hindsight.vectorize.io")],
    user_id="user-123",  # Used as bank_id
)

# Custom resolver
def resolve_bank(ctx):
    return f"team-{ctx.user_id}"

agent = Agent(
    model=OpenAIChat(id="gpt-4o-mini"),
    tools=[HindsightTools(
        bank_resolver=resolve_bank,
        hindsight_api_url="https://api.hindsight.vectorize.io",
    )],
)

Global Configuration

Instead of passing connection details to every toolkit, configure once:

from hindsight_agno import configure, HindsightTools

configure(
    hindsight_api_url="https://api.hindsight.vectorize.io",
    api_key="your-api-key",       # Or set HINDSIGHT_API_KEY env var
    budget="mid",                  # Recall budget: low/mid/high
    max_tokens=4096,               # Max tokens for recall results
    tags=["env:prod"],             # Tags for stored memories
    recall_tags=["scope:global"],  # Tags to filter recall
    recall_tags_match="any",       # Tag match mode: any/all/any_strict/all_strict
)

# Now create toolkit without passing connection details
tools = [HindsightTools(bank_id="user-123")]

Configuration Reference

HindsightTools()

Parameter Default Description
bank_id None Static Hindsight memory bank ID
bank_resolver None Callable (RunContext) -> str for dynamic bank ID
client None Pre-configured Hindsight client
hindsight_api_url None API URL (used if no client provided)
api_key None API key (used if no client provided)
budget "mid" Recall/reflect budget level (low/mid/high)
max_tokens 4096 Maximum tokens for recall results
tags None Tags applied when storing memories
recall_tags None Tags to filter when searching
recall_tags_match "any" Tag matching mode
enable_retain True Include the retain (store) tool
enable_recall True Include the recall (search) tool
enable_reflect True Include the reflect (synthesize) tool

memory_instructions()

Parameter Default Description
bank_id required Hindsight memory bank ID
client None Pre-configured Hindsight client
hindsight_api_url None API URL (used if no client provided)
api_key None API key (used if no client provided)
query "relevant context about the user" Recall query for memory injection
budget "low" Recall budget level
max_results 5 Maximum memories to inject
max_tokens 4096 Maximum tokens for recall results
prefix "Relevant memories:\n" Text prepended before memory list
tags None Tags to filter recall results
tags_match "any" Tag matching mode

configure()

Parameter Default Description
hindsight_api_url Hindsight Cloud (https://api.hindsight.vectorize.io) Hindsight API URL
api_key HINDSIGHT_API_KEY env API key for authentication
budget "mid" Default recall budget level
max_tokens 4096 Default max tokens for recall
tags None Default tags for retain operations
recall_tags None Default tags to filter recall
recall_tags_match "any" Default tag matching mode
verbose False Enable verbose logging

Requirements

  • Python >= 3.10
  • agno
  • hindsight-client >= 0.4.0
  • A running Hindsight API server

License

MIT

Metadata

Release files for hindsight-agno 0.4.20

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hindsight-agno 0.4.20
File Size Uploaded
hindsight_agno-0.4.20.tar.gz 112.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hindsight-agno 0.4.20
File Interpreter ABI Platform
hindsight_agno-0.4.20-py3-none-any.whl Python 3 none any Details

Total release size: 121.8 kB

Release files / hindsight_agno-0.4.20.tar.gz

Download URL hindsight_agno-0.4.20.tar.gz
Size 112.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d2a429869f002463668df384efa8fbabe65b0ef4368501a84006a22bfde95b36
BLAKE2b-256 checksum
How to use checksums
8010fcf9b4c0958ed36b98b2b5aadb5df62c2dee408d17d2e32a2042c0ae8728
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

Release files / hindsight_agno-0.4.20-py3-none-any.whl

Download URL hindsight_agno-0.4.20-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3500b2c38d83ff311b281393dea64b17f84bd754516427e75468350624cdde69
BLAKE2b-256 checksum
How to use checksums
848f3b840a58c51dea11d952c7a952ca8519412900ea99acb85e7d2a5fd9a80c
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

Release history Release notifications | RSS feed

This release

0.4.20 This release

2 release files

0.4.19

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page