Python SDK for Cilow AI Agent Platform - SOTA Memory Layer for AI
Project description
Cilow Python SDK
SOTA Memory Layer for AI Agents - Beat the competition on LongMemEval benchmarks.
Features
- 🧠 Multi-tier Memory - Hot/Warm/Cold storage with automatic FRR ranking
- 🔍 Semantic Search - HNSW-powered vector search with >95% recall
- ⏱️ Temporal Reasoning - Bi-temporal graph for time-aware queries
- 🤖 Agent Integration - ReAct agents with memory-augmented reasoning
- 📊 90% Token Reduction - FRR ranking minimizes context usage
- 🔐 Production Ready - Auth, rate limiting, OWASP LLM Top-10 security
Installation
pip install cilow
Quick Start
import asyncio
from cilow import CilowClient
async def main():
async with CilowClient(base_url="http://localhost:8080") as client:
# Add memories
memory_id = await client.add_memory(
"User prefers Python over JavaScript",
tags=["preference", "programming"]
)
# Semantic search
results = await client.search_memories("programming language preference")
for result in results:
print(f"[{result.score:.2f}] {result.memory.content}")
# Create an AI agent
agent_id = await client.create_agent("assistant", agent_type="react")
# Execute tasks with memory context
response = await client.execute_task(
agent_id,
"What programming language does the user prefer?"
)
print(response.response)
asyncio.run(main())
Synchronous API
For simple scripts without async:
from cilow import add_memory_sync, search_memories_sync
# Add a memory
memory_id = add_memory_sync("I love building AI applications")
# Search memories
results = search_memories_sync("AI development")
Key Concepts
Multi-Tier Storage
Cilow automatically manages memory across three tiers:
| Tier | Latency | Use Case |
|---|---|---|
| Hot | <1ms | Frequently accessed, recent memories |
| Warm | 8-10ms | Semantic search via HNSW |
| Cold | ~100ms | Historical, compressed memories |
FRR Ranking
Memories are ranked by Frequency-Recency-Relevance scoring:
Score = 0.3 × Frequency + 0.3 × Recency + 0.4 × Relevance
This ensures the most important memories are always accessible while reducing token usage by 90%.
Temporal Reasoning
Query memories across time:
# Add temporal context
await client.add_memory("Moved to NYC", metadata={"date": "2020-01-01"})
await client.add_memory("Moved to SF", metadata={"date": "2023-06-01"})
# Temporal query (handled by bi-temporal graph)
results = await client.search_memories("Where did I live in 2021?")
API Reference
CilowClient
class CilowClient:
def __init__(
self,
base_url: str = "http://localhost:8080",
api_key: Optional[str] = None,
timeout: float = 30.0,
)
Memory Operations
| Method | Description |
|---|---|
add_memory(content, metadata, tags) |
Add new memory |
get_memory(memory_id) |
Retrieve specific memory |
update_memory(memory_id, content, metadata, tags) |
Update memory |
delete_memory(memory_id) |
Delete memory |
search_memories(query, limit, tags, min_relevance) |
Semantic search |
get_memory_stats() |
Get system statistics |
Agent Operations
| Method | Description |
|---|---|
create_agent(name, agent_type, config) |
Create AI agent |
get_agent(agent_id) |
Get agent details |
execute_task(agent_id, task, context_limit) |
Execute task |
Fact Extraction
facts = await client.extract_facts(
"John works at Acme Corp and loves hiking on weekends"
)
for fact in facts:
print(f"[{fact.fact_type}] {fact.statement} ({fact.confidence:.0%})")
Benchmarks
Cilow achieves SOTA performance on LongMemEval:
| Metric | Cilow | Emergence AI | Zep |
|---|---|---|---|
| Turn Recall | >87% | 86% | 71.2% |
| Token Reduction | 90% | - | - |
| Vector Recall | >95% | - | - |
Error Handling
from cilow import CilowError, NotFoundError, RateLimitError
try:
memory = await client.get_memory("invalid-id")
except NotFoundError:
print("Memory not found")
except RateLimitError:
print("Rate limit exceeded, retry later")
except CilowError as e:
print(f"API error: {e}")
Configuration
Environment variables:
CILOW_API_URL=http://localhost:8080
CILOW_API_KEY=your-api-key
License
MIT License - see LICENSE for details.
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cilow-0.2.0.tar.gz.
File metadata
- Download URL: cilow-0.2.0.tar.gz
- Upload date:
- Size: 63.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0cf0cb5cdfdbc43bf35ffa49a903b846a8b4d850bfcb07080813c3266f721536
|
|
| MD5 |
bde9b06f8afdbfc35bac42c196455328
|
|
| BLAKE2b-256 |
a7b0938cdf01899f5a6e9a670de07fbf955b200696ddb333cd3ef5e0b28446c2
|
File details
Details for the file cilow-0.2.0-py3-none-any.whl.
File metadata
- Download URL: cilow-0.2.0-py3-none-any.whl
- Upload date:
- Size: 61.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ccf123c6880c28f7a59ef83499dc05a2f41078d20166e19159fcf7e583f2b495
|
|
| MD5 |
c7ea2ee108bb31f1ba32769969954761
|
|
| BLAKE2b-256 |
00291e05d4cfbb45a992e191da157bedb8adf71d3e0a637e3d98e1c9aafbb1b6
|