Skip to content

feat(agentcore): add hindsight-agentcore integration for Bedrock AgentCore Runtime#822

Open
benfrank241 wants to merge 3 commits intomainfrom
feat/agentcore-integration
Open

feat(agentcore): add hindsight-agentcore integration for Bedrock AgentCore Runtime#822
benfrank241 wants to merge 3 commits intomainfrom
feat/agentcore-integration

Conversation

@benfrank241
Copy link
Copy Markdown
Contributor

Summary

Adds hindsight-agentcore — a Python package providing durable cross-session memory for Amazon Bedrock AgentCore Runtime agents.

AgentCore Runtime sessions are explicitly ephemeral (terminate on inactivity, reprovision fresh). This adapter makes Hindsight the durable memory layer that survives session churn.

Key design decisions from the integration spec:

  • Memory is keyed to stable user identity, never runtimeSessionId — sessions expire, banks don't
  • Default bank format: tenant:{tenant_id}:user:{user_id}:agent:{agent_name}
  • Retention is async by default — never delays the turn response
  • Fails closed on bank resolution errors — no cross-user memory leakage
  • Graceful degradation everywhere — memory failures never surface to the user turn

Package structure

hindsight-integrations/agentcore/
├── hindsight_agentcore/
│   ├── __init__.py       # Public API
│   ├── adapter.py        # HindsightRuntimeAdapter (before_turn/after_turn/run_turn)
│   ├── bank.py           # TurnContext + bank resolution
│   ├── config.py         # configure() / get_config() / reset_config()
│   └── errors.py         # HindsightAgentCoreError, BankResolutionError
└── tests/
    ├── test_adapter.py   # 19 tests
    ├── test_bank.py      # 10 tests
    └── test_config.py    # 12 tests

API surface

from hindsight_agentcore import HindsightRuntimeAdapter, TurnContext, configure

configure(hindsight_api_url="...", api_key="...")

adapter = HindsightRuntimeAdapter(agent_name="support-agent")

# High-level: recall → execute → retain
result = await adapter.run_turn(context, payload, agent_callable=my_agent)

# Low-level hooks
memory_context = await adapter.before_turn(context, query=user_message)
result = await my_agent(payload, memory_context)
await adapter.after_turn(context, result=result["output"], query=user_message)

Test plan

  • uv run pytest — 41 tests pass
  • ruff check — clean
  • Integration smoke test against live Hindsight instance
  • End-to-end test with an actual AgentCore Runtime invocation
  • Docs page (follow-up PR)

@benfrank241 benfrank241 marked this pull request as draft March 31, 2026 19:49
@benfrank241 benfrank241 marked this pull request as ready for review April 1, 2026 19:24
Adds durable cross-session memory for Amazon Bedrock AgentCore Runtime
agents. Runtime sessions are ephemeral; this adapter persists memory
across session churn keyed to stable user identity.

- HindsightRuntimeAdapter with before_turn() / after_turn() / run_turn()
- TurnContext: maps AgentCore invocation identity to Hindsight banks
- default_bank_resolver: tenant:user:agent format (session ID never used)
- RecallPolicy: recall (default) or reflect mode with configurable budget
- RetentionPolicy: context label, tags, metadata, user message inclusion
- Async-by-default retention — never delays the turn response
- Graceful degradation throughout — memory failures never surface to user
- 41 unit tests covering adapter, bank resolution, and config
@benfrank241 benfrank241 force-pushed the feat/agentcore-integration branch from 30f2501 to 54e1826 Compare April 2, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant