Cognee integration
Cognee is an open-source memory engine with a semantic graph at its core that provides observability for AI agents and semantic workflows. When integrated with Keywords AI, it offers comprehensive tracing and monitoring capabilities for complex AI systems.Original resources
Cognee Documentation
Official integration guide for Keywords AI with Cognee
Cognee Blog
Deep dive into observability for semantic workflows
Key features
- Single Decorator Observability: Use
@observe
to trace tasks and workflows - Pluggable Backends: Choose your monitoring tool via config or environment variables
- Zero Vendor Lock-in: The interface remains the same regardless of the telemetry provider
- Real-time Traces: Get logs and metrics across LLM calls and agent runs
- Semantic 7Graph Integration: Built-in support for knowledge graph operations
Installation
Install the Keywords AI integration for Cognee:Configuration
Set up your environment variables:Quick Start
Prerequisites
- Python 3.10+
- Keywords AI API key (Get yours here)
- LLM API key (e.g., OpenAI)
- A clean virtual environment
Basic Usage
Complete Example
How It Works
Unified Abstraction
Cognee exposes a single surface for observability:@observe
. This decorator works with:
- Tasks: Decorate with
@observe
- Workflows: Decorate with
@observe(workflow=True)
Backend Integration
The Keywords AI integration:- Patches Cognee’s
get_observe()
at import time - Maps
@observe
to Keywords AI’stask()
decorator - Maps
@observe(workflow=True)
to Keywords AI’sworkflow()
decorator - Initializes telemetry via
KeywordsAITelemetry()
once on import
Monitoring Dashboard
Once configured, you can:- Run your Cognee workflows with the
@observe
decorators - Open your Keywords AI dashboard
- Inspect spans across tasks and workflows
- Monitor token usage, latency, and error rates
- Debug issues with detailed trace information
Advanced Configuration
Environment Variables
Variable | Description | Required |
---|---|---|
MONITORING_TOOL | Set to keywordsai | Yes |
KEYWORDSAI_API_KEY | Your Keywords AI API key | Yes |
LLM_API_KEY | Your LLM provider API key | Optional |
Custom Span Names
You can customize span names by providing additional parameters:Community Integration
The Keywords AI integration is part of thecognee-community
extension hub, which provides:
- Independent Evolution: Adapters iterate at their own pace
- Slim Installs: Pull in only what you need
- Seamless Interoperability: Small registration shim wires into Cognee’s abstraction
- Predictable Layout: Consistent provider patterns under
packages/*
Troubleshooting
Common Issues
- Missing API Key: Ensure
KEYWORDSAI_API_KEY
is set - Wrong Monitoring Tool: Verify
MONITORING_TOOL=keywordsai
- Import Order: Import the integration package before using
get_observe()