# Zo Computer

Adding SurrealDB Agent Memory to a Zo Computer skill.

[Zo Computer](https://zo.computer/) is a cloud AI platform where users build reusable workflows called **skills**. SurrealDB Agent Memory gives those skills persistent memory across conversations. This is a skill-based integration. A Zo skill calls SurrealDB Agent Memory through the [Python SDK](/docs/agent-memory/integrations/sdks/python.md) (`surrealdb`), not through MCP.

> [!NOTE]
> This is an integration guide. It shows three memory helpers a Zo skill can call, backed by SurrealDB Agent Memory; adapt them to your skill's structure.

## Installation

> [!NOTE]
> `Spectron` was the project name for SurrealDB Agent Memory. These type names
> will be renamed in a future release.

Add the dependency to your skill and set the connection details as environment variables in Zo:

```bash
pip install --pre surrealdb
```

```bash
SPECTRON_ENDPOINT=https://api.spectron.example
SPECTRON_CONTEXT=acme-prod
SPECTRON_API_KEY=sk-spec-...
```

## Mapping Zo concepts to SurrealDB Agent Memory

| Zo concept | SurrealDB Agent Memory |
| --- | --- |
| Account | Context |
| User | Scope path (for example `user/alice`) |
| Conversation | Session |

## Memory helpers for a skill

Expose three functions a Zo workflow can call: store a turn, ask a question of memory, and fetch a context block for a prompt:

```python
import os
from surrealdb import Spectron

memory = Spectron(
    endpoint=os.environ["SPECTRON_ENDPOINT"],
    context=os.environ["SPECTRON_CONTEXT"],
    api_key=os.environ["SPECTRON_API_KEY"],
)

def save_memory(user_id: str, user_message: str, assistant_message: str) -> None:
    """Persist a conversation turn."""
    memory.remember_many(
        [
            {"role": "user", "content": user_message},
            {"role": "assistant", "content": assistant_message},
        ],
        scopes=[f"user/{user_id}"],
    )

def query_memory(user_id: str, question: str) -> str:
    """Answer a natural-language question from stored memory."""
    return memory.chat(question, scopes=[f"user/{user_id}"]).reply

def get_context(user_id: str, query: str) -> str:
    """Return a formatted context block for an LLM prompt."""
    return memory.query_context(query, k=8, lens=[f"user/{user_id}"])
```

A skill recalls context with `get_context()` before it answers, then records the exchange with `save_memory()` so the next run of the skill has it.

## Scope per user

Each helper scopes to the Zo user with a slash path such as `user/alice`. Register paths with `spectron scopes create` before first use. On **SurrealDB Cloud**, use your context host from SurrealDB Studio **API keys** as the `SPECTRON_ENDPOINT`.

## Next steps

- [Python SDK](/docs/agent-memory/integrations/sdks/python.md): the full client surface
- [REST API](/docs/agent-memory/integrations/surfaces/rest.md): if your skill runtime is not Python
