Framework Adapters
Adapters integrate Hippocortex with popular AI agent frameworks. They automatically translate framework-specific events into Hippocortex event format so you get persistent memory without manual instrumentation.
Without an adapter, you call capture() manually after each agent action. With an adapter, capture happens automatically. Each adapter intercepts events from the framework (messages, tool calls, outcomes), translates them to Hippocortex events, captures them via the SDK, and provides a synthesize() hook for injecting memory into agent context.
Available Adapters
| Framework | Install | Language |
|---|---|---|
| OpenAI Agents | pip install hippocortex[openai] | Python |
| LangGraph | pip install hippocortex[langgraph] | Python |
| CrewAI | pip install hippocortex[crewai] | Python |
| AutoGen | pip install hippocortex[autogen] | Python |
| OpenClaw | pip install hippocortex[openclaw] | Python |
OpenAI Agents
For use with OpenAI's Agents SDK. The adapter wraps your agent runner, captures execution traces, and injects memory context.
from hippocortex import Hippocortex
from hippocortex.adapters.openai_agents import OpenAIAgentsAdapter
from agents import Runner
hx = Hippocortex(api_key="hx_live_...")
adapter = OpenAIAgentsAdapter(hx, session_id="sess-42")
# Get memory context before running
context = await adapter.get_context("deploy the API service")
# Add context.entries to agent instructions
# Run the agent
result = runner.run_sync("deploy the API service")
# Capture the execution trace
await adapter.capture_trace(result)
Auto-captured events: messages (user, assistant, system), tool calls with parameters, tool results, and final outcomes.
LangGraph
For use with LangChain's LangGraph framework. The adapter works as a LangGraph callback handler.
from hippocortex import Hippocortex
from hippocortex.adapters.langgraph import LangGraphAdapter
hx = Hippocortex(api_key="hx_live_...")
adapter = LangGraphAdapter(hx, session_id="sess-42")
# Use as a LangGraph callback
app = create_graph()
result = await app.ainvoke(
{"messages": [{"role": "user", "content": "Deploy API"}]},
config={"callbacks": [adapter]}
)
Auto-captured events: node entries and exits, tool invocations, LLM calls, and graph state transitions.
CrewAI
For use with the CrewAI framework. Wraps crew execution to capture task completions and agent interactions.
from hippocortex import Hippocortex
from hippocortex.adapters.crewai import CrewAIAdapter
hx = Hippocortex(api_key="hx_live_...")
adapter = CrewAIAdapter(hx, session_id="sess-42")
# Wrap your crew
crew = adapter.wrap(my_crew)
result = crew.kickoff()
Auto-captured events: task delegations, agent conversations, tool usage, and task completions.
AutoGen
For use with Microsoft's AutoGen framework. Captures multi-agent conversations.
from hippocortex import Hippocortex
from hippocortex.adapters.autogen import AutoGenAdapter
hx = Hippocortex(api_key="hx_live_...")
adapter = AutoGenAdapter(hx, session_id="sess-42")
# Register with your agents
adapter.register(assistant_agent)
adapter.register(user_proxy)
Auto-captured events: inter-agent messages, function calls, and conversation turns.
OpenClaw
For use with OpenClaw agents. Captures tool calls, file operations, and agent decisions.
from hippocortex import Hippocortex
from hippocortex.adapters.openclaw import OpenClawAdapter
hx = Hippocortex(api_key="hx_live_...")
adapter = OpenClawAdapter(hx, session_id="sess-42")
Auto-captured events: tool invocations, file reads/writes, shell commands, and agent decisions.
Writing a Custom Adapter
If your framework is not listed, you can build a custom adapter using the manual client. The pattern is:
- Initialize a
Hippocortexclient - Hook into your framework's event system
- Map events to Hippocortex event types
- Call
hx.capture()for each event - Call
hx.synthesize()before agent decisions
from hippocortex import Hippocortex
hx = Hippocortex()
# In your framework's event hook:
async def on_tool_call(tool_name, args, result):
await hx.capture(
type="tool_call",
session_id=current_session_id,
payload={"tool": tool_name, "args": args}
)
await hx.capture(
type="tool_result",
session_id=current_session_id,
payload={"tool": tool_name, "result": result}
)
Next Steps
- JavaScript SDK for TypeScript reference
- Python SDK for Python reference
- Integration Guide for production setup