Skip to content

Automation

Zo Computer

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 (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.

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

pip install --pre 'surrealdb[memory]'
AGENT_MEMORY_ENDPOINT=https://api.spectron.example
AGENT_MEMORY_CONTEXT=acme-prod
AGENT_MEMORY_API_KEY=sk-spec-...
Zo conceptSurrealDB Agent Memory
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.memory import Memory

memory = Memory(
    endpoint=os.environ["AGENT_MEMORY_ENDPOINT"],
    context=os.environ["AGENT_MEMORY_CONTEXT"],
    api_key=os.environ["AGENT_MEMORY_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.

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

Was this page helpful?