Skip to content
← Blog

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.

The memory lives wherever you configure Mem0 to keep it, not on the Orgo computer, so destroying the computer does not erase it. 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.

What is agent memory?

Agent memory is information an agent keeps between tasks, such as a user's preferences or what happened last time, and recalls when it is relevant.

An Orgo computer is where the agent works: a full desktop with a browser, a terminal, and a file system, which your code drives through the Orgo API. It holds files and app state while it exists. What the agent knows about a person across sessions is a separate layer that you add on top.

How does memory work with an Orgo agent?

The loop has four steps:

  1. Search: before each task, ask Mem0 for memories related to it.
  2. Inject: add those memories to the prompt.
  3. Execute: the agent does the task on the Orgo computer with that context.
  4. Store: save the task and the result, so later tasks can use them.

The execute step here 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.

Where does the memory live?

LayerWhat it holdsKept after the computer is destroyed?
Mem0 memory, per user_idFacts Mem0 extracted from what you passed to memory.addYes. It lives wherever you configure Mem0.
Orgo computerFiles, apps, and browser state on that desktopNo. destroy() deletes the computer.
Chat threadA stored transcript of the agent's conversation on one computerNo. 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.

How do I set it up?

You need Python 3.10 or newer, an Orgo API key, and an OpenAI API key, because Mem0 uses OpenAI models by default. The SDK creates the computer on your plan, so you need a paid plan with room for one more computer. Each orgo-agent run spends Orgo AI credits.

bash
python -m pip install "mem0ai==2.2.1" "orgo==0.0.47" openai
export ORGO_API_KEY=sk_live_...
export OPENAI_API_KEY=sk-...

Then run the loop. It is adapted from the Orgo docs example and updated for Mem0 2.x, where search takes filters instead of user_id.

python
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 explicitly 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 instead of creating a new one each time. 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.

How do I view, search, or clear memories?

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

How do I keep memory separate for each 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.

What are the limits?

  • You store what you choose. Mem0 holds only what your code passes to memory.add. Nothing is captured from the screen automatically.
  • Mem0 rewrites what you store. By default each memory.add call asks an LLM to extract facts, and the stored memory is the extracted fact, not the raw text. Pass infer=False to store messages as they are.
  • Old facts stay until you delete them. In mem0ai 2.2.1, memory.add only 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 with memory.delete(memory_id).
  • Memory is context, not control. Recalled memories go into the prompt. 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, not in memory.

FAQ

Does Orgo have built-in long-term memory? No. The Orgo API gives your agent a computer, not a memory store. The Orgo docs add long-term memory with Mem0.

Does memory survive destroying the computer? Yes. The memory lives wherever you configure Mem0, not on the computer, so destroying the computer does not touch it. How long it lasts after that depends on the store: Mem0's default folder under /tmp can be cleared on restart.

Can I use my own agent loop instead of orgo-agent? Yes. You can drive an Orgo computer with your own agent, such as Claude computer use, through the SDK's screenshot(), left_click(), and type() calls (Claude example). The same loop applies: search Mem0 before you build the prompt, and store the result after the run.