Skip to content

Agent framework middleware

Astrocyte provides thin integration layers for popular agent frameworks. Each integration wires the Astrocyte API into the framework’s memory abstraction, giving every framework access to every memory provider through one adapter.

Without Astrocyte, each agent framework needs integrations with each memory provider (N x M). With Astrocyte, it’s N + M.

Scope: memory integration, not orchestration

Section titled “Scope: memory integration, not orchestration”

Astrocyte does not specify how an agent is structured (workflow graph, tools, checkpoints, retries, human-in-the-loop, multi-agent handoff). That is the job of LangGraph, CrewAI, Pydantic AI, AG2, the OpenAI / Claude agent SDKs, or your own app. This document only describes thin mappers from those frameworks’ memory hooks to Astrocyte.retain() / recall() / reflect() / … through the policy layer.

In harness vs context terms (see Architecture framework §1, Context engineering vs harness engineering): framework integrations and your app are harness—they decide when to call memory and how to run the loop; Astrocyte sits below that. Turning recall hits into the next system block or user message is context engineering, which the app still owns—Astrocyte returns governed hits and synthesized text, not the only valid prompt shape.

Integrations should treat sandbox id, environment (e.g. dev/staging/prod), or deployment tier as first-class inputs alongside the agent card when resolving principal and bank_id. See sandbox-awareness-and-exfiltration.md.


FrameworkGuidePattern
LangGraph / LangChainLangGraph integrationMemory store
CrewAICrewAI integrationCrew/agent memory
Pydantic AIPydantic AI integrationAgent tools
OpenAI Agents SDKOpenAI integrationFunction calling
Claude Agent SDKClaude Agent SDK integrationNative @tool + MCP
Google ADKGoogle ADK integrationAsync callables
AutoGen / AG2AutoGen integrationMemory + tools
Smolagents (HuggingFace)Smolagents integrationTool protocol
LlamaIndexLlamaIndex integrationMemory store
Strands Agents (AWS)Strands integrationSpec + handler
Semantic Kernel (Microsoft)Semantic Kernel integrationPlugin functions
DSPy (Stanford)DSPy integrationRetrieval model
CAMEL-AICAMEL-AI integrationRole-based memory
BeeAI (IBM)BeeAI integrationTool with run()
Microsoft Agent FrameworkMS Agent integrationOpenAI-compatible
LiveKit AgentsLiveKit integrationSession lifecycle
Haystack (deepset)Haystack integrationRetriever + Writer
MCP (Claude Code, Cursor)MCP serverMCP server (FastMCP)

All integrations are zero-dependency on the framework — they use duck typing, not base class inheritance. Testable and functional without installing the target framework.

All integration guides assume you have a configured Astrocyte instance:

from astrocyte import Astrocyte
brain = Astrocyte.from_config("astrocyte.yaml")

  • No business logic. Integrations are thin mappers. They translate framework-specific interfaces to Astrocyte API calls.
  • No policy bypass. All calls go through the full Astrocyte policy layer.
  • No framework-specific storage. Conversation history managed by the framework stays in the framework. Astrocyte stores long-term memory, not turn-by-turn chat logs.
  • No provider-specific code. Integrations talk to Astrocyte, never to providers directly.

Some integrations can automatically retain agent experiences:

memory = AstrocyteMemory(
brain,
bank_id="agent-123",
auto_retain=True, # Automatically retain after each task
auto_retain_filter="completions", # Only retain completed tasks, not failures
)

Auto-retain is opt-in and respects all policies (PII scanning, signal quality, quotas). It should not silently flood memory — the retain gating principles from the policy layer apply.


All integrations ship inside the astrocyte package — no separate packages to install. The integration modules use duck typing (not base class inheritance), so they work without installing the target framework. Install the framework only when you actually use the integration:

Terminal window
pip install astrocyte # All integrations included
pip install langgraph # Install framework when you use it
pip install crewai # etc.

openai_agents, google_adk, microsoft_agent, and claude_agent_sdk (tool definitions mode) produce plain dicts/functions — no extra install needed.