The Missing Piece in Agent Frameworks
Agent frameworks like LangGraph and CrewAI excel at orchestrating multi-step reasoning and tool use. But they typically lack one critical capability: persistent, structured memory that survives across sessions and evolves over time.
CogMem fills this gap as a framework-agnostic knowledge layer that any agent can plug into.
Architecture Overview
CogMem exposes two primary integration points:
- REST API — Standard HTTP endpoints for ingestion, search, and entity operations
- MCP Server — Model Context Protocol server for direct LLM integration
Quick Start: Ingesting Knowledge
First, let's add some documents to CogMem:
import httpx
API_BASE = "http://localhost:8000"
async def ingest_document(title: str, content: str):
async with httpx.AsyncClient() as client:
response = await client.post(
f"{API_BASE}/items",
json={
"tenant_id": "my-agent",
"user_id": "agent-1",
"title": title,
"content_text": content,
"content_type": "document",
"source": "agent",
},
)
return response.json()
CogMem automatically chunks the document, generates embeddings, extracts entities, and creates structured claims — all through the Knowledge Kernel's agent pipeline.
Searching Knowledge
When your agent needs to recall information:
async def search_knowledge(query: str):
async with httpx.AsyncClient() as client:
response = await client.post(
f"{API_BASE}/search",
json={
"tenant_id": "my-agent",
"query": query,
"limit": 10,
},
)
results = response.json()
return results["hits"]
The search API returns highlighted results, faceted filters, and related entities — far richer than simple vector similarity.
LangGraph Integration
For LangGraph agents, CogMem can be integrated as a tool node:
from langgraph.graph import StateGraph
def search_memory(state):
results = search_knowledge(state["query"])
return {"context": results}
def ingest_memory(state):
ingest_document(state["title"], state["content"])
return {"status": "ingested"}
graph = StateGraph()
graph.add_node("search", search_memory)
graph.add_node("ingest", ingest_memory)
Key Benefits
Persistent Across Sessions
Unlike in-memory state, CogMem persists knowledge to disk. Your agent picks up exactly where it left off.
Structured, Not Just Text
CogMem extracts entities, claims, and relationships — giving your agent structured knowledge to reason over, not just text chunks.
Self-Evolving
The Adaptive Cognitive Plane learns how to organize knowledge for your specific use case. No manual tuning required.
Multi-Agent Compatible
Multiple agents can share the same CogMem instance, building on each other's knowledge while maintaining provenance tracking.
What's Next
We're building native adapters for popular frameworks to make integration even simpler. In the meantime, the REST API provides everything you need to give your agents persistent, structured memory.
Check out our documentation at cogmem.ai for the full API reference and more integration examples.