Skip to main content

LangGraph Integration

AegisLangGraphMemory gives a LangGraph graph long-term, semantic memory backed by Aegis Memory. It provides the two primitives every stateful graph needs:
  • retrieve relevant memories into state before a node reasons, and
  • remember what a node produced after it runs.
Because LangGraph state is just a dict / TypedDict, the adapter operates on plain state dicts and imports no langgraph package — it works with any graph shape and adds no hard dependency.
This is a memory helper, not a checkpointer. AegisLangGraphMemory does not implement LangGraph’s BaseCheckpointSaver and does not save or restore graph execution state / thread history. Use LangGraph’s own checkpointer for execution persistence; use this adapter for durable, security-scanned semantic memory.

Installation

The adapter itself needs no LangGraph install; the extra is provided for convenience when you also want LangGraph in the same environment.

Basic Usage

API

retrieve(query, ...)

Returns a list of memory dicts relevant to query. Pass agent_id for cross-agent, scope-aware access control.

remember(content, ...)

Stores new memory. Content is security-scanned, embedded and (optionally) integrity-hashed by the server. Returns the memory ID.

load_into_state(state, query, ...)

Retrieves and writes results into state[key] (default aegis_memories), returning the mutated state — ideal as a node’s first line.

persist_from_state(state, content_key, ...)

Persists a value already in state (e.g. a node’s output). No-ops when the key is missing or empty.

Async graphs

For async LangGraph nodes, use AsyncAegisClient directly — it keeps API parity for add/query/vote/session/feature workflows while staying event-loop friendly:

Runnable example

A complete, server-free example (local mode, no API key) lives at examples/langgraph_basic.py.

Next Steps

ACE Patterns

Self-improvement patterns for multi-agent memory

Security

How content is scanned before it enters memory