Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/vectorize-io/hindsight/llms.txt

Use this file to discover all available pages before exploring further.

Hindsight integrates with the two most widely used multi-agent frameworks: CrewAI and AutoGen (including the AG2 community fork). Both integrations expose retain, recall, and reflect as framework-native constructs — a storage backend for CrewAI and tool functions for AutoGen and AG2.

CrewAI

The hindsight-crewai package implements CrewAI’s Storage interface for ExternalMemory. CrewAI automatically calls search() at the start of each task and save() after each task completes — your crew learns across runs with no extra code.

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

configure(
    hindsight_api_url="https://api.hindsight.vectorize.io",
    api_key="hsk_...",  # or set HINDSIGHT_API_KEY env var
)

crew = Crew(
    agents=[Agent(role="Researcher", goal="Find information", backstory="...")],
    tasks=[Task(description="Research AI trends", expected_output="Report")],
    external_memory=ExternalMemory(
        storage=HindsightStorage(bank_id="my-crew")
    ),
)

crew.kickoff()
That’s it. Memories persist across kickoff() calls, so the crew builds on prior findings over time.

How it works

CrewAIHindsightWhat happens
save(value, metadata, agent)retain(bank_id, content, ...)Task output is stored — Hindsight extracts facts, entities, and relationships
search(query, limit)recall(bank_id, query, ...)Semantic search, BM25, graph traversal, and reranking
reset()delete_bank(bank_id)Wipes the bank and recreates it with its original mission

Configuration

from hindsight_crewai import configure

configure(
    hindsight_api_url="https://api.hindsight.vectorize.io",
    api_key="your-api-key",
    budget="mid",                    # low / mid / high
    max_tokens=4096,
    tags=["env:prod"],
    recall_tags=["scope:global"],
    recall_tags_match="any",         # any / all / any_strict / all_strict
    verbose=True,
)
Per-storage overrides take precedence over global config:
storage = HindsightStorage(
    bank_id="my-crew",
    budget="high",
    max_tokens=8192,
    tags=["team:alpha"],
)

Bank mission

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.",
)

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 resolver for full control:
storage = HindsightStorage(
    bank_id="my-crew",
    bank_resolver=lambda base, agent: f"{base}-{agent.lower()}" if agent else base,
)
When per_agent_banks=True, the automatic search() at task start queries the base bank (shared context), since CrewAI’s search() method does not receive the agent parameter. For per-agent search isolation, create separate HindsightStorage instances per agent.

Reflect tool

CrewAI’s storage interface only covers save, search, and reset. To give agents access to Hindsight’s disposition-aware reflection, add HindsightReflectTool as an agent 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],
)

Full example

A research crew that remembers findings across runs:
from hindsight_crewai import configure, HindsightStorage, HindsightReflectTool
from crewai.memory.external.external_memory import ExternalMemory
from crewai import Agent, Crew, Task

configure(
    hindsight_api_url="https://api.hindsight.vectorize.io",
    api_key="hsk_...",
)

storage = HindsightStorage(
    bank_id="research-crew",
    mission="Track technology research findings and comparisons.",
)
reflect_tool = HindsightReflectTool(bank_id="research-crew", budget="mid")

researcher = Agent(
    role="Researcher",
    goal="Research topics, building on prior knowledge.",
    backstory="Before starting, use hindsight_reflect to check what you already know.",
    tools=[reflect_tool],
)
writer = Agent(
    role="Writer",
    goal="Write summaries incorporating prior findings.",
    backstory="Use hindsight_reflect to recall prior research.",
    tools=[reflect_tool],
)

crew = Crew(
    agents=[researcher, writer],
    tasks=[
        Task(description="Research the benefits of Rust", expected_output="Analysis", agent=researcher),
        Task(description="Write an executive summary", expected_output="Summary", agent=writer),
    ],
    external_memory=ExternalMemory(storage=storage),
)

# Run 1: researches Rust, stores findings
crew.kickoff()

# Run 2: recalls Rust research when comparing with Go
crew.tasks[0].description = "Compare Rust with Go"
crew.kickoff()

Requirements

  • Python >= 3.10
  • crewai >= 0.86.0
  • A running Hindsight API server

Build docs developers (and LLMs) love