Automation

Zo Computer

Adding Spectron memory to a Zo Computer skill.

Zo Computer is a cloud AI platform where users build reusable workflows called skills. Spectron gives those skills persistent memory across conversations. This is a skill-based integration. A Zo skill calls Spectron through the Python SDK (surrealdb), not through MCP.

Note

This is an integration guide. It shows three memory helpers a Zo skill can call, backed by Spectron; adapt them to your skill's structure.

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

pip install surrealdb
SPECTRON_ENDPOINT=https://api.spectron.example
SPECTRON_CONTEXT=acme-prod
SPECTRON_API_KEY=sk-spec-...
Zo conceptSpectron
AccountContext
UserScope path (for example user/alice)
ConversationSession

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

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},
        ],
        scope=[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, scope=[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, scope=[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.

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 Surrealist API keys as the SPECTRON_ENDPOINT.

Was this page helpful?