Agent frameworks

Camel AI

Adding Spectron memory to Camel AI agents with the Spectron SDK.

Camel AI is a multi-agent framework for Python. Spectron gives its ChatAgents shared long-term memory across runs and agents. There is no dedicated adapter. The Python SDK (surrealdb) supplies the memory operations, either as tools or wrapped around each step.

Note

This is an integration guide. It wires the Spectron SDK into Camel AI; adapt to your installed Camel AI version.

pip install camel-ai surrealdb
export SPECTRON_ENDPOINT="https://api.spectron.example"
export SPECTRON_CONTEXT="acme-prod"
export SPECTRON_API_KEY="sk-spec-..."

Expose Spectron through CAMEL's FunctionTool so an agent can recall and remember on its own:

import os
from camel.agents import ChatAgent
from camel.toolkits import FunctionTool
from surrealdb import Spectron

memory = Spectron(
    endpoint=os.environ["SPECTRON_ENDPOINT"],
    context=os.environ["SPECTRON_CONTEXT"],
    api_key=os.environ["SPECTRON_API_KEY"],
)
scope = ["org/acme/user/alice"]

def remember(text: str) -> str:
    """Store a durable fact for later recall."""
    memory.remember(text, scope=scope)
    return "stored"

def recall(query: str) -> str:
    """Retrieve relevant memory for a query."""
    return memory.query_context(query, k=8, scope=scope)

agent = ChatAgent(
    system_message="Use recall before answering and remember anything worth keeping.",
    tools=[FunctionTool(remember), FunctionTool(recall)],
)

response = agent.step("What do you know about Alice's role?")
print(response.msgs[0].content)

Recall relevant memory, prepend it to the system message, run the step, then store the exchange:

block = memory.query_context(user_message, k=8, scope=scope)

agent = ChatAgent(system_message=f"You are a helpful assistant.\n\n## Memory\n{block}")
response = agent.step(user_message)

memory.remember_many(
    [
        {"role": "user", "content": user_message},
        {"role": "assistant", "content": response.msgs[0].content},
    ],
    scope=scope,
)
Note

Camel AI's own AgentMemory (chat-history and vector memory) manages a single agent's context window. Spectron complements it with a durable, shared substrate: server-side extraction, hybrid recall, and provenance across agents.

Pass a scope on every call to isolate memory. A scope is a slash path or an array of paths, for example ["org/acme/user/alice"]. Register paths with spectron scopes create before first use.

Was this page helpful?