Skip to main content
Give your LangGraph agents persistent semantic memory that survives across sessions. Store data in cognee’s knowledge graph and retrieve it via natural language—no manual state management required.

Why Use This Integration

  • Cross-Session Memory: Context persists across agent instances and conversation sessions
  • Semantic Recall: Retrieve information using natural language queries
  • Session Isolation: Multi-tenant support with per-user data separation
  • Drop-in tools: add_tool and search_tool work with LangGraph agents out of the box

Installation

Quick Start

Before using the integration, configure your environment variables:
Add memory tools to your LangGraph agent. Tools are built per session and the agent must be invoked asynchronously with ainvoke():

Tools

get_sessionized_cognee_tools(session_id=None, include_persist_tool=False, user=None) returns the memory tools:

Session Management

Pass a session_id to isolate memory per user or organization:
Session isolation is implemented by scoping data with node_set=[session_id] for add_tool, and injecting the session_id into search_tool. Data added outside a session forms separate clusters.

How It Works

  1. Add Tool: Stores data in cognee’s knowledge graph with embeddings
  2. Search Tool: Retrieves relevant information via cognee’s recall pipeline
  3. Auto-Processing: cognee extracts entities, relationships, and context automatically
  4. Session Scoping: Data is organized by session clusters but globally accessible

Use Cases

Build domain knowledge incrementally over multiple sessions:
Maintain user context across work sessions:
Isolate data per user/organization while sharing global knowledge:

GitHub Repository

View source code and examples

Examples

Runnable example scripts