Camel AI is a multi-agent framework for Python. SurrealDB Agent Memory 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.
This is an integration guide. It wires the SurrealDB Agent Memory SDK into Camel AI; adapt to your installed Camel AI version.
Installation
pip install camel-ai
pip install --pre 'surrealdb[memory]'export AGENT_MEMORY_ENDPOINT="https://api.spectron.example"
export AGENT_MEMORY_CONTEXT="acme-prod"
export AGENT_MEMORY_API_KEY="sk-spec-..."Memory as function tools
Expose SurrealDB Agent Memory 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.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"],
)
scope = ["org/acme/user/alice"]
def remember(text: str) -> str:
"""Store a durable fact for later recall."""
memory.remember(text, scopes=scope)
return "stored"
def recall(query: str) -> str:
"""Retrieve relevant memory for a query."""
return memory.query_context(query, k=8, lens=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 around a step
Recall relevant memory, prepend it to the system message, run the step, then store the exchange:
block = memory.query_context(user_message, k=8, lens=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},
],
scopes=scope,
) Camel AI's own AgentMemory (chat-history and vector memory) manages a single agent's context window. SurrealDB Agent Memory complements it with a durable, shared substrate: server-side extraction, hybrid recall, and provenance across agents.
Scope per user
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 agent-memory scopes create before first use.
Next steps
Python SDK: the full client surface
MCP server: if your host speaks MCP instead