Microsoft Agent Framework integration for Hindsight - persistent memory for AI agents
Project description
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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hindsight_agent_framework-0.1.0.tar.gz.
File metadata
- Download URL: hindsight_agent_framework-0.1.0.tar.gz
- Upload date:
- Size: 92.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1cc8dfa1b2e3eed5b70266e4f50360dc63f55d7722e3e7f3088e2e3d6f071b6
|
|
| MD5 |
36cd5efadedd2e2f0316fd75b2c7f277
|
|
| BLAKE2b-256 |
09315adc199ea7be1b18113940b750411b08ac307fd5a5d90568549750a89273
|
Provenance
The following attestation bundles were made for hindsight_agent_framework-0.1.0.tar.gz:
Publisher:
release-integration.yml on vectorize-io/hindsight
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hindsight_agent_framework-0.1.0.tar.gz -
Subject digest:
e1cc8dfa1b2e3eed5b70266e4f50360dc63f55d7722e3e7f3088e2e3d6f071b6 - Sigstore transparency entry: 1802982942
- Sigstore integration time:
-
Permalink:
vectorize-io/hindsight@9a5aecd178067bc26dc6447523205a9c9a02f1df -
Branch / Tag:
refs/tags/integrations/agent-framework/v0.1.0 - Owner: https://github.com/vectorize-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-integration.yml@9a5aecd178067bc26dc6447523205a9c9a02f1df -
Trigger Event:
push
-
Statement type:
File details
Details for the file hindsight_agent_framework-0.1.0-py3-none-any.whl.
File metadata
- Download URL: hindsight_agent_framework-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e44f81037e570100332414ddba34a39759393aaea82bcba1b7928d46d91c682
|
|
| MD5 |
e4f2814cd163bb625e220da1adbae88e
|
|
| BLAKE2b-256 |
d189b6087f9a242ccb228be9df8d1a32f69c4468b740fa501d3a75abf70cc0cf
|
Provenance
The following attestation bundles were made for hindsight_agent_framework-0.1.0-py3-none-any.whl:
Publisher:
release-integration.yml on vectorize-io/hindsight
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hindsight_agent_framework-0.1.0-py3-none-any.whl -
Subject digest:
5e44f81037e570100332414ddba34a39759393aaea82bcba1b7928d46d91c682 - Sigstore transparency entry: 1802983058
- Sigstore integration time:
-
Permalink:
vectorize-io/hindsight@9a5aecd178067bc26dc6447523205a9c9a02f1df -
Branch / Tag:
refs/tags/integrations/agent-framework/v0.1.0 - Owner: https://github.com/vectorize-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-integration.yml@9a5aecd178067bc26dc6447523205a9c9a02f1df -
Trigger Event:
push
-
Statement type: