Skip to content

Latest commit

 

History

History
86 lines (64 loc) · 1.65 KB

quickstart.md

File metadata and controls

86 lines (64 loc) · 1.65 KB

Quick Start Guide

Get MemLens up and running in under 5 minutes.

Prerequisites

  • Python 3.9+
  • pip

Installation

pip install memlens

Start the Server

python -m memlens.api.main

The server will start at http://localhost:8000.

Verify Installation

curl http://localhost:8000/health

You should see:

{"status": "healthy", "version": "0.1.0"}

First Trace

Create a file first_trace.py:

import asyncio
from memlens.sdk import MemLensClient
from memlens.core.models import MemoryCandidate, MemoryType

async def main():
    client = MemLensClient("http://localhost:8000")

    # Create a write trace
    trace = await client.create_write_trace({
        "session_id": "session_123",
        "user_id": "user_456",
        "agent_id": "agent_1",
        "raw_input": "User prefers dark mode",
        "candidates": [
            {
                "content": "User prefers dark mode",
                "importance_score": 0.92,
                "memory_type": "pattern",
            }
        ],
        "stored_memories": [
            {
                "content": "User prefers dark mode",
                "importance_score": 0.92,
                "memory_type": "pattern",
            }
        ],
        "dropped_memories": [],
        "extraction_metadata": {"model": "gpt-4"},
    })

    print(f"Trace created: {trace['trace_id']}")

asyncio.run(main())

Run it:

python first_trace.py

Next Steps