CrewAI memory integration via Hindsight - persistent memory for AI agent crews
Project description
hindsight-crewai
Persistent memory for AI agent crews via Hindsight. Give your CrewAI crews long-term memory with fact extraction, entity tracking, and temporal awareness.
Features
- Drop-in Storage Backend - Implements CrewAI's
Storageinterface forExternalMemory - Automatic Memory Flow - CrewAI automatically stores task outputs and retrieves relevant memories
- Per-Agent Banks - Optionally give each agent its own isolated memory bank
- Reflect Tool - Agents can explicitly reason over memories with disposition-aware synthesis
- Simple Configuration - Configure once, use everywhere
Installation
pip install hindsight-crewai
Quick Start
from hindsight_crewai import configure, HindsightStorage
from crewai.memory.external.external_memory import ExternalMemory
from crewai import Agent, Crew, Task
# Step 1: Configure connection
configure(hindsight_api_url="http://localhost:8888")
# Step 2: Create crew with Hindsight-backed memory
crew = Crew(
agents=[
Agent(role="Researcher", goal="Find information", backstory="..."),
Agent(role="Writer", goal="Write reports", backstory="..."),
],
tasks=[
Task(description="Research AI trends", expected_output="Report"),
],
external_memory=ExternalMemory(
storage=HindsightStorage(bank_id="my-crew")
),
)
crew.kickoff()
That's it. CrewAI will automatically:
- Query memories at the start of each task
- Store task outputs to Hindsight after each task completes
Memories persist across crew runs, so your crew learns over time.
Per-Agent Memory Banks
Give each agent its own isolated memory bank:
storage = HindsightStorage(
bank_id="my-crew",
per_agent_banks=True, # Researcher -> "my-crew-researcher", Writer -> "my-crew-writer"
)
Or use a custom bank resolver for full control:
storage = HindsightStorage(
bank_id="my-crew",
bank_resolver=lambda base, agent: f"{base}-{agent.lower()}" if agent else base,
)
Reflect Tool
CrewAI's storage interface only supports save/search/reset. To give agents access to Hindsight's reflect (disposition-aware memory synthesis), add it as a tool:
from hindsight_crewai import HindsightReflectTool
reflect_tool = HindsightReflectTool(
bank_id="my-crew",
budget="mid",
reflect_context="You are helping a software team track decisions.",
)
agent = Agent(
role="Analyst",
goal="Analyze project history",
backstory="...",
tools=[reflect_tool],
)
When the agent calls this tool, it gets a synthesized, contextual answer based on all relevant memories — not just raw facts.
Bank Missions
Set a mission to guide how Hindsight processes and organizes memories:
storage = HindsightStorage(
bank_id="my-crew",
mission="Track software architecture decisions, technical debt, and team preferences.",
)
Configuration
Global Configuration
from hindsight_crewai import configure
configure(
hindsight_api_url="http://localhost:8888", # Default: production API
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
verbose=True, # Enable logging
)
Per-Storage Overrides
Constructor arguments override global configuration:
storage = HindsightStorage(
bank_id="my-crew",
budget="high", # Override global budget
max_tokens=8192, # Override global max_tokens
tags=["team:alpha"], # Override global tags
)
Examples
See the CrewAI memory example in the Hindsight Cookbook for a complete working demo with a Researcher + Writer crew.
Configuration Reference
| Parameter | Default | Description |
|---|---|---|
hindsight_api_url |
Production API | Hindsight API URL |
api_key |
HINDSIGHT_API_KEY env |
API key for authentication |
budget |
"mid" |
Recall 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 |
per_agent_banks |
False |
Give each agent its own bank |
bank_resolver |
None |
Custom (bank_id, agent) -> bank_id function |
mission |
None |
Bank mission for memory organization |
verbose |
False |
Enable verbose logging |
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_crewai-0.4.20.tar.gz.
File metadata
- Download URL: hindsight_crewai-0.4.20.tar.gz
- Upload date:
- Size: 268.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e7c8bc8bbd963d4186c4793171ef648f62e682c00ff3ad1f0a7d77283960619
|
|
| MD5 |
09f1c4493e3a11c3b6190ef764883b2d
|
|
| BLAKE2b-256 |
2c955b2e2543e1f14341c98265e7fe2cb6e738811e3daef5a73ce5c0e204f725
|
Provenance
The following attestation bundles were made for hindsight_crewai-0.4.20.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_crewai-0.4.20.tar.gz -
Subject digest:
2e7c8bc8bbd963d4186c4793171ef648f62e682c00ff3ad1f0a7d77283960619 - Sigstore transparency entry: 1306278499
- Sigstore integration time:
-
Permalink:
vectorize-io/hindsight@9f41d98172304e15459f1a07cbba3be1164dafcd -
Branch / Tag:
refs/tags/integrations/crewai/v0.4.20 - Owner: https://github.com/vectorize-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-integration.yml@9f41d98172304e15459f1a07cbba3be1164dafcd -
Trigger Event:
push
-
Statement type:
File details
Details for the file hindsight_crewai-0.4.20-py3-none-any.whl.
File metadata
- Download URL: hindsight_crewai-0.4.20-py3-none-any.whl
- Upload date:
- Size: 11.4 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 |
e96eac51225f009a2c87b24df5205025e163c149ad087ac77fde1b70acdeae49
|
|
| MD5 |
ad13facddfa6453f660f6a5cd3873296
|
|
| BLAKE2b-256 |
ddd2b695f34b612a91c44a569e8db3bd17053639a0b110669d620bd7bb495796
|
Provenance
The following attestation bundles were made for hindsight_crewai-0.4.20-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_crewai-0.4.20-py3-none-any.whl -
Subject digest:
e96eac51225f009a2c87b24df5205025e163c149ad087ac77fde1b70acdeae49 - Sigstore transparency entry: 1306278570
- Sigstore integration time:
-
Permalink:
vectorize-io/hindsight@9f41d98172304e15459f1a07cbba3be1164dafcd -
Branch / Tag:
refs/tags/integrations/crewai/v0.4.20 - Owner: https://github.com/vectorize-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-integration.yml@9f41d98172304e15459f1a07cbba3be1164dafcd -
Trigger Event:
push
-
Statement type: