Skip to main content

Claude Agent SDK integration for Hindsight - persistent memory tools and hooks for Claude agents

Project description

hindsight-claude-agent-sdk

Persistent memory tools and hooks for the Claude Agent SDK, powered by Hindsight.

Installation

pip install hindsight-claude-agent-sdk

Quick Start

Tools (explicit memory)

Give your Claude agent retain/recall/reflect tools so it can decide when to use memory:

from claude_agent_sdk import query, ClaudeAgentOptions
from hindsight_claude_agent_sdk import create_hindsight_server

server = create_hindsight_server(
    bank_id="my-agent",
    hindsight_api_url="http://localhost:8888",
)

async for msg in query(
    prompt="Remember that I prefer dark mode. Then check what you know about me.",
    options=ClaudeAgentOptions(
        mcp_servers={"hindsight": server},
        allowed_tools=["mcp__hindsight__*"],
    ),
):
    print(msg)

Hooks (automatic memory)

Auto-recall relevant memories before each prompt and auto-retain results after each session:

from claude_agent_sdk import query, ClaudeAgentOptions
from hindsight_claude_agent_sdk import create_hindsight_server, create_memory_hooks

server = create_hindsight_server(bank_id="my-agent", hindsight_api_url="http://localhost:8888")
hooks = create_memory_hooks(bank_id="my-agent", hindsight_api_url="http://localhost:8888")

async for msg in query(
    prompt="Help me refactor the auth module.",
    options=ClaudeAgentOptions(
        mcp_servers={"hindsight": server},
        allowed_tools=["mcp__hindsight__*"],
        hooks=hooks,
    ),
):
    print(msg)

Global configuration

from hindsight_claude_agent_sdk import configure

configure(
    hindsight_api_url="http://localhost:8888",
    api_key="your-api-key",
    budget="mid",
)

Hook Configuration

Fine-tune automatic memory behavior:

from hindsight_claude_agent_sdk import MemoryHookConfig, create_memory_hooks

hooks = create_memory_hooks(
    bank_id="my-agent",
    hook_config=MemoryHookConfig(
        auto_recall=True,           # inject memories before each prompt
        auto_retain=True,           # save results after each session
        retain_on_tools=["Bash"],   # also retain notable Bash outputs
        recall_max_results=5,       # max memories to inject
        retain_tags=["source:my-app"],
    ),
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hindsight_claude_agent_sdk-0.1.0.tar.gz (120.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hindsight_claude_agent_sdk-0.1.0-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file hindsight_claude_agent_sdk-0.1.0.tar.gz.

File metadata

File hashes

Hashes for hindsight_claude_agent_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d92c743fc6a7b5bff4048e29c9fde763d1eecbd445d85eb9e4719ecc3ffc764e
MD5 7999bda44fa294a36aff4f7f150f894a
BLAKE2b-256 f2a7b64ef65c9864f742186c626d6f2f970f67b57952e83c7c53185665f86253

See more details on using hashes here.

Provenance

The following attestation bundles were made for hindsight_claude_agent_sdk-0.1.0.tar.gz:

Publisher: release-integration.yml on vectorize-io/hindsight

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hindsight_claude_agent_sdk-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for hindsight_claude_agent_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0dab63c7c5bad823d0891d2890fcab0b433f091ed670259d822bab0c89adde37
MD5 5bc76edea512566d98e93c8d8f0152e6
BLAKE2b-256 e4d22fa26d8c28fc5dfa4cdd06d5ec496392ca1553b60bd7b25524aecc0f428b

See more details on using hashes here.

Provenance

The following attestation bundles were made for hindsight_claude_agent_sdk-0.1.0-py3-none-any.whl:

Publisher: release-integration.yml on vectorize-io/hindsight

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page