Cognee Integration with Future AGI for Memory Tracing
Send Cognee's native OpenTelemetry traces to Future AGI.
Inspect Cognee memory operations, searches, and model calls in Future AGI using Cognee’s native traces.
Install
Use Python 3.10–3.13. Install Cognee and the Future AGI adapter, then configure Cognee’s model and embedding providers as described in the Cognee documentation.
pip install "cognee[tracing]==1.6.6" "traceai-cognee==0.1.1"
Configure tracing
Set your Future AGI API and secret keys and enable Cognee’s native tracing before starting your application. Configure the adapter before the first Cognee operation; do not add a second Cognee or LiteLLM instrumentor.
export FI_API_KEY="YOUR_FI_API_KEY"
export FI_SECRET_KEY="YOUR_FI_SECRET_KEY"
export FI_PROJECT_NAME="my-cognee-app"
export COGNEE_TRACING_ENABLED=true
Leave OTEL_EXPORTER_OTLP_ENDPOINT unset for this setup. Cognee also uses it to enable log and metric exporters, which are not filtered by this adapter.
Run Cognee
import asyncio
import os
from traceai_cognee import configure
handle = configure(project_name=os.environ["FI_PROJECT_NAME"])
import cognee
async def main():
await cognee.add("Ada works on the Lighthouse project.")
await cognee.cognify()
answer = await cognee.search(
"Who works on Lighthouse?", query_type=cognee.SearchType.GRAPH_COMPLETION
)
print(answer)
try:
with handle.provider.get_tracer(__name__).start_as_current_span("remember_and_ask"):
asyncio.run(main())
handle.force_flush()
finally:
handle.shutdown()
Open Observe → Tracing in Future AGI and select my-cognee-app to inspect memory operations, searches, and model calls.
Request and response content is excluded by default. To include approved application data, set capture_content=True in configure. Recognized credential fields are redacted, but free text is not scanned for secrets. Error descriptions and stack traces remain excluded in both modes. Keep sensitive data out of span names and apply your data policy to any other exporters configured in your application.
Troubleshooting
- No Cognee spans: set
COGNEE_TRACING_ENABLED=truebefore the first Cognee operation and configure the adapter before that operation. - Spans missing at exit: end application spans and call
handle.force_flush()beforehandle.shutdown(). Spans still open at shutdown are not exported. - Tracing stops in other parts of your app: avoid
cognee.disable_tracing()andcognee.shutdown_tracing()while application tracing is active; they shut down the shared provider. - Missing-collection errors: the adapter preserves Cognee’s native error statuses, including vector-search probes for collections that do not exist yet.
Questions & Discussion