Skip to main content

hindsight-agent-framework

Persistent long-term memory for Microsoft Agent Framework via Hindsight.

Microsoft Agent Framework is the successor to Semantic Kernel. This integration plugs Hindsight in as a context provider, so every agent run automatically recalls relevant memories into the agent's context and retains the conversation afterward — no MCP, and no tools the model has to remember to call.

Installation

pip install hindsight-agent-framework

✨ Recommended: Hindsight Cloud — sign up free, get an API key, and skip self-hosting.

Usage

from agent_framework.openai import OpenAIChatClient
from hindsight_agent_framework import HindsightProvider

agent = OpenAIChatClient().as_agent(
    name="assistant",
    instructions="You are a helpful assistant.",
    context_providers=[HindsightProvider(bank_id="user-123")],
)

session = agent.create_session()
await agent.run("Remember that I prefer vegetarian food.", session=session)
# ...later, even in a new process:
await agent.run("Suggest a recipe.", session=session)  # recalls the preference

Set your API key once via the HINDSIGHT_API_KEY environment variable, or pass api_key=/hindsight_api_url= to HindsightProvider. For self-hosting:

pip install hindsight-all
export HINDSIGHT_API_LLM_API_KEY=your-openai-key
hindsight-api  # http://localhost:8888
HindsightProvider(bank_id="user-123", hindsight_api_url="http://localhost:8888")

How It Works

Hook Behavior
before_run Recall memories relevant to the user's message and inject them as a ## Memories block in the agent's instructions.
after_run Retain the user input + agent response so future runs build on them.

Memories live in a Hindsight bank (one per user/agent/session — you choose). Recall and retain are best-effort: a memory hiccup never blocks the agent.

Configuration

HindsightProvider(bank_id, ...) accepts: client, hindsight_api_url, api_key, budget (low/mid/high), max_tokens, context, tags, recall_tags, recall_tags_match, mission (creates the bank with a fact-extraction persona), auto_recall, auto_retain, source_id. You can also set process-wide defaults via configure(...).

Development

uv sync
uv run ruff check .
uv run pytest tests -v          # unit tests
uv run pytest tests -v -m requires_real_llm   # e2e (needs a live Hindsight server)

Metadata

Release files for hindsight-agent-framework 0.1.0

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-agent-framework 0.1.0
File Size Uploaded
hindsight_agent_framework-0.1.0.tar.gz 92.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hindsight-agent-framework 0.1.0
File Interpreter ABI Platform
hindsight_agent_framework-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 100.5 kB

Release files / hindsight_agent_framework-0.1.0.tar.gz

Download URL hindsight_agent_framework-0.1.0.tar.gz
Size 92.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e1cc8dfa1b2e3eed5b70266e4f50360dc63f55d7722e3e7f3088e2e3d6f071b6
BLAKE2b-256 checksum
How to use checksums
09315adc199ea7be1b18113940b750411b08ac307fd5a5d90568549750a89273
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 12, 2026.

Transparency log

Release files / hindsight_agent_framework-0.1.0-py3-none-any.whl

Download URL hindsight_agent_framework-0.1.0-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5e44f81037e570100332414ddba34a39759393aaea82bcba1b7928d46d91c682
BLAKE2b-256 checksum
How to use checksums
d189b6087f9a242ccb228be9df8d1a32f69c4468b740fa501d3a75abf70cc0cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 12, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

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