Metadata-Version: 2.4
Name: strata-memory
Version: 0.1.0
Summary: Python SDK for Strata — persistent memory for AI agents
Project-URL: Homepage, https://strata.kytheros.dev
Project-URL: Repository, https://github.com/kytheros/strata
Project-URL: Documentation, https://strata.kytheros.dev/docs/python-sdk
Author-email: Kytheros LLC <hello@kytheros.dev>
License-Expression: MIT
Keywords: agents,ai,crewai,langchain,mcp,memory
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Requires-Dist: mcp>=1.26
Requires-Dist: pydantic>=2.0
Provides-Extra: crewai
Requires-Dist: crewai>=0.80; extra == 'crewai'
Provides-Extra: dev
Requires-Dist: mypy>=1.13; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.8; extra == 'dev'
Provides-Extra: distill
Requires-Dist: datasets>=3.0; extra == 'distill'
Requires-Dist: pyyaml>=6.0; extra == 'distill'
Requires-Dist: torch>=2.4; extra == 'distill'
Requires-Dist: transformers>=4.45; extra == 'distill'
Requires-Dist: trl>=0.12; extra == 'distill'
Requires-Dist: unsloth>=2025.3; extra == 'distill'
Provides-Extra: langchain
Requires-Dist: langchain-core>=0.3; extra == 'langchain'
Provides-Extra: llamaindex
Requires-Dist: llama-index-core>=0.11; extra == 'llamaindex'
Description-Content-Type: text/markdown

# strata-memory

Python SDK for [Strata](https://strata.kytheros.dev) — persistent memory for AI agents.

Works locally (no API keys) or remotely via HTTP. Drop-in alternative to Mem0.

## Quickstart

```bash
pip install strata-memory
```

```python
from strata import StrataClient

s = StrataClient()

# Store a memory
mem = s.add("Use React Server Components for data fetching", type="decision")

# Search
results = s.search("data fetching patterns", limit=5)
for r in results:
    print(f"[{r.score:.2f}] {r.text[:80]}")

# Update
s.update(mem.id, summary="Prefer RSC for data fetching; useEffect for client-side only")

# Delete
s.delete(mem.id)
```

## Async

```python
from strata import AsyncStrataClient

async with AsyncStrataClient() as s:
    results = await s.search("auth patterns")
```

## Remote Server

```python
s = StrataClient(url="https://your-strata-server.run.app/mcp", token="your-token")
```

Or via environment variables:

```bash
export STRATA_URL=https://your-strata-server.run.app/mcp
export STRATA_TOKEN=your-token
```

```python
s = StrataClient.from_env()
```

## Strata-Specific Features

Beyond Mem0's CRUD, Strata provides:

```python
# Ingest a full conversation
result = s.ingest(
    messages=[
        {"role": "user", "text": "Fix the CORS error"},
        {"role": "assistant", "text": "Added proxy config to vite.config.ts"},
    ],
    agent="my-agent",
    project="web-app",
)

# Find solutions to errors
solutions = s.find_solutions("CORS error in fetch")

# Discover patterns
patterns = s.find_patterns("deployment issues")

# Find procedures
procedures = s.find_procedures("deploy to Cloud Run")

# Search entities
entities = s.search_entities("React", type="library")

# Store a procedure
s.store_procedure("Deploy to GCR", ["Build image", "Push", "Deploy"])

# Project context
ctx = s.get_project_context("web-app")
projects = s.list_projects()
```

## Framework Integrations

### LangChain

```bash
pip install strata-memory[langchain]
```

```python
from strata import StrataClient
from strata.integrations.langchain import StrataRetriever

s = StrataClient()
retriever = StrataRetriever(client=s, search_kwargs={"limit": 5})

# Use with RetrievalQA, ConversationalRetrievalChain, etc.
docs = retriever.invoke("How did we fix auth last time?")
```

### CrewAI

```bash
pip install strata-memory[crewai]
```

```python
from strata import StrataClient
from strata.integrations.crewai import StrataCrewMemory

s = StrataClient()
memory = StrataCrewMemory(client=s, project="research-crew")

memory.store("React 19 uses compiler optimizations")
results = memory.search("React optimizations")
```

### LlamaIndex

```bash
pip install strata-memory[llamaindex]
```

```python
from strata import StrataClient
from strata.integrations.llamaindex import StrataMemoryStore

s = StrataClient()
store = StrataMemoryStore(client=s, project="my-index")

store.put("Server Components handle data fetching server-side")
results = store.query("data fetching")
```

## Migration from Mem0

```python
# Before (Mem0)
from mem0 import Memory
m = Memory()
m.add("User prefers dark mode", user_id="alice")
results = m.search("preferences", user_id="alice")

# After (Strata)
from strata import StrataClient
s = StrataClient()
s.add("User prefers dark mode", user="alice")        # user_id= also works
results = s.search("preferences", user="alice")
```

| Mem0 | Strata | Notes |
|---|---|---|
| `Memory()` | `StrataClient()` | Local subprocess, no API keys |
| `user_id=` | `user=` | Both accepted (alias) |
| Requires `OPENAI_API_KEY` | No API key needed | Pro features need license |
| Cloud only for teams | Local + cloud | Team features via license |

## Local Model Distillation

Fine-tune a private model from your own coding sessions. Requires a GPU.

```bash
pip install strata-memory[distill]

# Check readiness
strata-distill status --db ~/.strata/strata.db

# Fine-tune (requires GPU + ~1,000 training pairs)
strata-distill start --task extraction

# Evaluate
strata-distill eval --model strata-extraction-7b

# Export GGUF
strata-distill export --output ./my-model.gguf
```

See the [distillation spec](../specs/strata-local-model-distillation.md) for full documentation.

## Requirements

- Python 3.10+
- Node.js (for local `strata-mcp` subprocess) — not needed for HTTP transport
