AI agent memory on Orgo with Mem0
Give a computer use agent long-term memory with Mem0.
Each request to a computer use agent starts fresh. The agent does not know what it learned about a user last time unless you give it memory. The Orgo docs add that memory with Mem0: search Mem0 before each task, put what it finds into the prompt, run the task on an Orgo computer, then store the exchange for next time.
Orgo has no built-in long-term memory. The Orgo API gives your agent a computer, a desktop with a browser, a terminal and a file system, which holds files and app state while it exists. What the agent knows about a person across sessions is a separate layer. The memory lives wherever you configure Mem0 to keep it, so deleting the computer does not erase it, and each Mem0 user_id has its own memory, so one agent can serve many users.
This example targets mem0ai 2.2.1 and Orgo Python SDK 0.0.47.
The loop
- Search. Before each task, ask Mem0 for memories related to it.
- Inject. Add those memories to the prompt.
- Execute. The agent does the task on the Orgo computer with that context.
- Store. Save the task and the result for later tasks.
The execute step uses Orgo's computer use endpoint, POST /api/v1/chat/completions. It accepts the OpenAI chat completions format, so the OpenAI Python client works with base_url="https://www.orgo.ai/api/v1". Pass the model orgo-agent, Orgo's computer use engine, and the computer_id of the computer to work on (API reference). The computer use API post covers the endpoint in more detail.
You can use your own agent loop instead, such as Claude computer use through the SDK's screenshot(), left_click() and type() calls (Claude example). The same steps apply: search Mem0 before you build the prompt, and store the result after the run.
Where the memory lives
| Layer | What it holds | Kept after the computer is destroyed? |
|---|---|---|
Mem0 memory, per user_id | Facts Mem0 extracted from what you passed to memory.add | Yes. It lives wherever you configure Mem0. |
| Orgo computer | Files, apps and browser state on that desktop | No. destroy() deletes the computer. |
| Chat thread | A stored transcript of the agent's conversation on one computer | No. A thread belongs to its computer and is deleted with it. |
A thread is a record, not a memory: passing a thread_id does not replay earlier messages to the model. Mem0 is what lets the agent recall a fact from a different session, found by meaning, for a given user.
With no configuration, Mem0's open-source Memory() keeps its vectors in a local Qdrant folder at /tmp/qdrant and its history in ~/.mem0/history.db, on the machine that runs your script (Mem0 quickstart). /tmp is often cleared on restart. For memory that lasts, configure a persistent vector store or use Mem0's hosted platform.
Setup
You need Python 3.10 or newer, an Orgo API key, and an OpenAI API key, because Mem0 uses OpenAI models by default. On a paid plan, the SDK creates the computer on your plan. With no plan, the same call runs a Medium Linux computer by the hour from your credit. Each orgo-agent run spends Orgo AI credits.
python -m pip install "mem0ai==2.2.1" "orgo==0.0.47" openai
export ORGO_API_KEY=sk_live_...
export OPENAI_API_KEY=sk-...The loop below is adapted from the Orgo docs example and updated for Mem0 2.x, where search takes filters instead of user_id.
import os
from mem0 import Memory
from openai import OpenAI
from orgo import Computer
memory = Memory()
user_id = "alice"
# Facts from earlier sessions.
memory.add("I live in Chicago", user_id=user_id)
memory.add("I search the web with DuckDuckGo", user_id=user_id)
client = OpenAI(
base_url="https://www.orgo.ai/api/v1",
api_key=os.environ["ORGO_API_KEY"],
max_retries=0,
)
computer = Computer(workspace="memory-demo", ram=4, cpu=1)
try:
task = "Find tomorrow's weather forecast where I live."
# Search, then inject what Mem0 found into the prompt.
found = memory.search(task, filters={"user_id": user_id}, top_k=5)
context = "\n".join(f"- {m['memory']}" for m in found.get("results", []))
# Execute on the Orgo computer.
response = client.chat.completions.create(
model="orgo-agent",
messages=[{
"role": "user",
"content": f"About the user:\n{context}\n\nTask: {task}",
}],
extra_body={"computer_id": computer.computer_id},
)
reply = response.choices[0].message.content
print(reply)
# Store the exchange for next time.
memory.add(
[
{"role": "user", "content": task},
{"role": "assistant", "content": reply},
],
user_id=user_id,
)
finally:
computer.destroy()The computer's size is set because older Orgo SDK versions, such as 0.0.46, ask for 2 GB by default, which the API refuses. workspace="memory-demo" reuses one workspace across runs. max_retries=0 stops the OpenAI client from sending the request again after a timeout or a retryable error, which would run the task a second time on the computer. The example stores the agent's actual reply, so the next session builds on what happened.
Viewing, searching and clearing memories
from mem0 import Memory
memory = Memory()
# List memories (20 by default; pass top_k for more)
for m in memory.get_all(filters={"user_id": "alice"})["results"]:
print(m["memory"])
# Search
found = memory.search("weather", filters={"user_id": "alice"}, top_k=5)
# Clear
memory.delete_all(user_id="alice")delete_all removes a user's memories, so search and get_all no longer return them. In mem0ai 2.2.1 the history database still keeps the text of each deleted memory and the last 10 messages you passed to memory.add for that user, so when a user asks you to forget them, clean that up as well. memory.reset() clears the vector store and the history for every user at once.
One memory per user
Use a different user_id for each person or context. The Orgo docs give "work" and "personal" as examples of separate contexts. This pairs with giving each user their own computer (Scale to thousands): one computer per user for files and apps, one user_id per user for memory.
Limits
- Mem0 holds only what your code passes to
memory.add. Nothing is captured from the screen. - Mem0 rewrites what you store. By default each
memory.addcall asks an LLM to extract facts, and the stored memory is the extracted fact, not the raw text. Passinfer=Falseto store messages as they are. - Old facts stay until you delete them. In mem0ai 2.2.1,
memory.addonly adds memories and never changes or removes one. If a user moves from Chicago to Denver, the memory that they live in Chicago stays, so delete it withmemory.delete(memory_id). - Memory is context, not control. Recalled memories go into the prompt, and the model can still ignore or misread them.
- Mem0 is a separate dependency. You install and configure it, or use Mem0's platform, and by default it calls OpenAI.
- Files belong elsewhere. If the agent needs a document or app state, keep it on a computer or upload it to the workspace with the Files API.