Skip to main content
Wrap any Band adapter in CogneeMemoryAdapter and every room your agent joins gets persistent, shared memory. Context is recalled before your adapter sees a message, the question and reply are stored after it answers, and a closed room is promoted into the permanent knowledge graph. Your adapter, prompts, and framework do not change.
The cognee-integration-band package is not published on PyPI yet. It ships from the open draft pull request #313 in cognee-integrations, so install it from that branch and expect details to move until the PR merges.

Why Use This Integration

  • One line of code: CogneeMemoryAdapter(inner) wraps an adapter you already built
  • Framework agnostic: works with every Band adapter — Anthropic, Claude SDK, LangGraph, CrewAI, Pydantic AI — because it imports nothing from band
  • Rooms become memory: Band room r1 maps to Cognee session band-r1 instead of a transcript that disappears
  • Shared brain: the default dataset is the one the Claude Code and Codex plugins use, so a Band agent can recall what a terminal session learned
  • Never breaks a turn: every memory failure is logged and swallowed

Install

You need a Band agent from the agent console, a reachable Cognee server, and Python 3.11+. The package declares 3.10, but band-sdk sets the real floor. Cognee can be Cloud, self-hosted, or local — this is a thin HTTP client and never starts a server for you.
Pick the band-sdk extra matching the adapter you plan to wrap. The memory package adds no runtime dependencies of its own.

Configure

Point at your Cognee server once in ~/.cognee/.env — the same file the Claude Code and Codex plugins read, so if you run either of those you are already done:
Precedence is exported environment variables, then this file, then defaults. Keep your Band and model credentials — BAND_AGENT_ID, BAND_AGENT_API_KEY, ANTHROPIC_API_KEY — exported in the shell instead.
The default URL is Cognee’s agent-mode port, where the Claude Code and Codex plugins bootstrap a local API. A standard local server listens on 8000, so set COGNEE_BASE_URL to match. Those plugins also mint an API key for you, while this integration only ever sends the COGNEE_API_KEY you give it.
Timeouts and the session prefix have no environment variables. Override those, or any other field, in code with CogneeSettings.resolve(recall_timeout=5.0, session_prefix="prod").

Quick Start

Wrap the adapter you already pass to Agent.create:
That is the whole integration. The wrapper forwards every attribute and lifecycle call to the adapter underneath, so the inner adapter never needs to know memory exists. To confirm it works, store a fact in one room and ask for it back in a different room — same-room recall could just be conversation history. For the demo worth showing someone, tell the Cognee Claude Code plugin a fact in a terminal, let it sync, then ask your Band agent. Both write to and recall from the same agent_sessions dataset, so the answer comes back.

Explicit Memory Tools

Automatic recall runs on every text message. To also let the model make deliberate memory calls, build one client and share it, which keeps the tools and the wrapper on one dataset:
This gives the model cognee_search(query), which searches the whole dataset rather than just the current room’s session, and cognee_remember(content), which writes durably under the band_memory node set. Include the prompt guidance above: without it the model may read the injected block as something the user said rather than as its own memory. cognee_tools works with any adapter that accepts additional_tools.
integrations/band/examples/memory_agent.py is a complete agent built this way. Its inline dependency header resolves cognee-integration-band from PyPI, so until the package is published, run it with the interpreter where you installed the package rather than through uv run.

How It Works

Recall is the only memory operation on the critical path, since the result is needed before your adapter runs. Writes never block the event loop. Non-text events pass through untouched and are never stored, so a room that only carried those is never bridged. The stored question is always the original one, so recalled context is not re-ingested turn after turn, and capture also runs when the inner adapter raises. This is what the model receives, and when recall finds nothing, nothing is injected:

Choosing Your Memory Scope

COGNEE_PLUGIN_DATASET is the isolation control. Recall reads exactly one dataset, so this is a hard boundary and not a ranking preference. Leave the default agent_sessions for one shared brain across every agent and coding harness, or set one dataset name per team or per agent to isolate them. Decide before your agents start writing, since moving content between datasets afterwards is a Cognee-side job.
Recalled memory is injected into the prompt sent to your model provider, so whatever sits in the dataset can reach that provider. The default is shared with the Claude Code, Codex, and OpenClaw plugins. Choose a shared dataset deliberately.

Troubleshooting

Memory degrades to a no-op and never breaks a turn, which means failures are quiet by design. Adapter problems are logged on the cognee_band logger and transport problems also write a [cognee-band] line to standard error, so configure logging before debugging anything below. Start with the line the wrapper logs at startup, cognee memory active: dataset=... server=..., which catches a wrong endpoint before you chase anything else.
Look for a warning on the cognee_band logger or a [cognee-band] line on standard error. No warning means the server searched and found nothing, which is expected on a cold dataset. An empty result is never confused with a failure.
For an unreachable server, check that COGNEE_BASE_URL works from the agent process, remembering that the default points at the agent-mode port. For an authorization failure, set COGNEE_API_KEY — this integration never mints one for you, localhost included.
Parsing never raises, so a malformed file is skipped silently. Check the format is KEY=VALUE, one per line, with an optional export prefix and optional quotes, and no interpolation. Check nothing in your shell already exports the same variable, since exports win. The file is read once per process, so restart the agent after editing it.
Replies are captured by proxying the adapter’s send_message call, so an adapter that emits output only through send_event is not captured.
Consolidation runs through improve in the background on the server, so give it time. Also confirm the agent shut down cleanly, since the shutdown path is what bridges rooms that were still open.

Current Limits

  • Only text messages are remembered. Tool calls and reasoning events are excluded, so a fact surfaces only if it reaches the reply text. The client has a trace-storing method for this, but the adapter does not drive it yet.
  • Session names can collide. Two agents on the same dataset serving the same room ID write to the same session. That is usually intended, but change session_prefix if you need them apart.
  • Recall adds latency to every text turn, up to the 20 second default timeout.
Band’s Jam Desktop bridges local Claude Code sessions onto Band. Those are real Claude Code sessions, so the Cognee plugin for Claude Code already gives them memory. This package is for agents you build on the Band SDK directly.

Integration Source

Read the adapter, client, and examples on the open pull request

Band

Learn about the Band agent platform