Cortex Documentation
The definitive guide to integrating the Cortex Intelligence Engine into your autonomous AI agents.
What is Cortex?
Cortex is a production-grade semantic memory and knowledge graph system designed explicitly for autonomous AI agents. Instead of simply dumping text into a vector database, Cortex intelligently extracts entities, constructs relationship graphs, and seamlessly blends dense vector search with graph traversal to give your agents "human-like" recall.
Why Choose Cortex?
- Sub-50ms Predictive Retrieval: Our custom Rust-backed indexing tier predicts what context your agent will need next and pre-warms the cache.
- Automated PII Redaction: Built-in Presidio analyzers scrub Social Security Numbers, Credit Cards, and emails before they ever hit the LLM.
- Infinite Context Illusion: By continuously summarizing and archiving older graph nodes, Cortex gives your agent infinite memory without exploding token costs.
Quickstart
Integrate Cortex into your Python backend in less than 5 minutes.
1. Install the SDK
pip install cortex-sdk
2. Initialize and Ingest
Connect to your workspace and push a new memory.
from cortex import Client
client = Client(api_key="crx_live_...", workspace_id="ws_01")
# Ingest a memory
response = client.memory.ingest(
text="The user prefers strict dark mode and uses Next.js.",
metadata={"source": "user_preferences"}
)
print(response.id)3. Retrieve Context
Query Cortex to give your agent context before generating a response.
# Retrieve relevant graph nodes and vectors
context = client.memory.search("What UI framework does the user like?")
for memory in context.results:
print(memory.text)
# Output: "The user prefers strict dark mode and uses Next.js."Ready to build?
Get your API keys from the dashboard.
