Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions examples/tiamat_connector/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# TIAMAT Memory Connector for MemOS

Lightweight HTTP-based memory connector that bridges MemOS with TIAMAT's cloud memory API. Use TIAMAT for persistent, searchable memory without deploying the full MemOS infrastructure.

## When to Use

- **Quick prototyping** — no database or infrastructure setup needed
- **Cloud deployments** — persistent memory without volume mounts
- **Multi-agent systems** — shared memory across agent instances
- **Hybrid setups** — TIAMAT for cloud backup, MemOS for local processing

## Quick Start

```bash
pip install httpx

# Get a free API key
curl -X POST https://memory.tiamat.live/api/keys/register \
-H "Content-Type: application/json" \
-d '{"agent_name": "my-agent", "purpose": "memory"}'

export TIAMAT_API_KEY="your-key"
python example.py
```

## Features

| Feature | MemOS (full) | TIAMAT Connector |
|---------|-------------|-----------------|
| Setup | Full stack deployment | `pip install httpx` |
| Storage | Local DB + embeddings | Cloud API |
| Search | Vector + semantic | FTS5 full-text |
| Knowledge triples | Yes | Yes |
| Memory types | Textual, Parametric, Activation | All via tags |
| Import/Export | Native | MemOS-compatible format |

## API

```python
from tiamat_connector import TiamatConnector

c = TiamatConnector(api_key="key", user_id="user-1")

# Store
c.add_memory("content", tags=["tag"], importance=0.8)

# Search
c.search("query", limit=10)

# Knowledge triples
c.learn("subject", "predicate", "object")

# MemOS interop
c.import_textual_memories(textual_items)
c.export_as_textual_items(limit=100)
```

## About TIAMAT

Built and operated by an autonomous AI agent: https://tiamat.live
79 changes: 79 additions & 0 deletions examples/tiamat_connector/example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
"""Example: Using TIAMAT as a lightweight memory backend for MemOS.

Demonstrates how to use TIAMAT's cloud memory API as a simple,
infrastructure-free alternative to the full MemOS stack.

Setup:
pip install httpx

# Get a free API key:
curl -X POST https://memory.tiamat.live/api/keys/register \
-H "Content-Type: application/json" \
-d '{"agent_name": "memos-demo", "purpose": "memory connector"}'

export TIAMAT_API_KEY="your-key"
"""

import os

from tiamat_connector import TiamatConnector


def main():
api_key = os.environ.get("TIAMAT_API_KEY")
if not api_key:
print("Set TIAMAT_API_KEY environment variable.")
print("Get a free key: POST https://memory.tiamat.live/api/keys/register")
return

connector = TiamatConnector(api_key=api_key, user_id="demo-user")

# Check health
if not connector.health():
print("Cannot reach TIAMAT Memory API")
return

print("=== MemOS + TIAMAT Memory Connector ===\n")

# Store memories
print("Storing memories...")
connector.add_memory(
"User is a machine learning engineer at a startup",
tags=["profile"],
importance=0.9,
)
connector.add_memory(
"Prefers PyTorch over TensorFlow for prototyping",
tags=["preference", "ml"],
importance=0.7,
)
connector.add_memory(
"Working on a recommendation system using transformers",
tags=["project", "ml"],
importance=0.8,
)

# Store knowledge triples
print("Storing knowledge triples...")
connector.learn("user", "role", "ML engineer")
connector.learn("user", "prefers", "PyTorch")
connector.learn("user", "working_on", "recommendation system")

# Search
print("\nSearching for 'machine learning'...")
results = connector.search("machine learning", limit=5)
for r in results:
print(f" - {r.get('content', '')[:80]}")

# Stats
stats = connector.stats()
print(f"\nMemory stats: {stats}")

print("\n=== Done ===")
print("All memories persisted at https://memory.tiamat.live")

connector.close()


if __name__ == "__main__":
main()
Loading