Cognee

Cognee is an open-source memory engine with a semantic graph at its core that provides observability for AI agents and semantic workflows. The Cognee–Respan integration patches Cognee’s @observe decorator so every task and workflow run becomes a Respan span automatically.

Create an account at platform.respan.ai and grab an API key.

Run npx @respan/cli setup to set up with your coding agent.

Setup

1

Install packages

pip install respan-ai cognee-community-observability-respan
2

Set environment variables

export MONITORING_TOOL="respan"
export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"
export LLM_API_KEY="YOUR_OPENAI_API_KEY"

MONITORING_TOOL=respan tells Cognee to use Respan as its observability backend. LLM_API_KEY is required if your pipeline calls LLMs.

3

Initialize and run

import asyncio
import cognee_community_observability_respan # noqa: F401 — patches Cognee on import
from cognee.modules.observability.get_observe import get_observe
observe = get_observe() # returns Respan-backed decorator
@observe
def process_documents(documents: list[str]):
return [f"Processed: {doc}" for doc in documents]
@observe
def create_knowledge_graph(processed_docs: list[str]):
return [{"id": i, "content": doc} for i, doc in enumerate(processed_docs)]
@observe(workflow=True)
async def semantic_workflow():
documents = ["Document 1", "Document 2", "Document 3"]
processed = process_documents(documents)
return create_knowledge_graph(processed)
result = asyncio.run(semantic_workflow())
print(f"Created knowledge graph with {len(result)} nodes")
4

View your trace

Open the Traces page to see your Cognee workflow with task spans, knowledge graph operations, and LLM calls.

How it works

The Respan integration patches Cognee’s get_observe() at import time so:

  • @observe maps to Respan’s task() decorator.
  • @observe(workflow=True) maps to Respan’s workflow() decorator.
  • Telemetry is initialized once via RespanTelemetry() on import.

Configuration

VariableDescriptionRequired
MONITORING_TOOLSet to respanYes
RESPAN_API_KEYYour Respan API keyYes
LLM_API_KEYYour LLM provider API keyOptional

Custom span names

@observe(name="custom_task_name")
def my_task():
pass
@observe(workflow=True, name="custom_workflow_name")
async def my_workflow():
pass

Troubleshooting

IssueSolution
No tracesEnsure RESPAN_API_KEY is set and MONITORING_TOOL=respan.
Decorators don’t fireImport cognee_community_observability_respan before calling get_observe().