camelRun by camelAI

AI agent memory that keeps every message

camelRun by camelAI runs AI agents that remember. Give each one a key and it keeps every message and file, with no memory service to run.camelRun by camelAI is a hosted runtime for AI agents that remember. Give each agent a key and it keeps every message, and the files it writes, with no memory service to run. Come back days later with the same key and it picks up where you left off.

stream-tool-tsthe key · index.ts:18
What the model readsthe summary and every message after itWhat history keepsevery message, from 0
Historystream-tool-ts
Asleep
Oct 918:02Now
431YouWhat about this weekend?
432Agentweather({"city":"Lisbon"}) weather({"city":"Oslo"})
433·434ToolResult of weather ×2
435AgentFor this weekend (October 10–11), take an umbrella to Oslo: rain is likely on Saturday (80%) and possible on Sunday (45%). Lisbon stays dry, at 5% and 10%.
Asleep 8 days
Oct 109:14
426YouDo I need an umbrella in Lisbon or Oslo this weekend?
427Agentweather({"city":"Lisbon"}) weather({"city":"Oslo"})
428·429ToolResult of weather ×2
430AgentFor this weekend (October 3–4), an umbrella looks unlikely to be needed in either city. Rain chances are low in Lisbon (9% Saturday, 17% Sunday) and modest in Oslo (22% both days).
Sep 24
402–425YouIs it warmer in Lisbon or Oslo on Saturday?
Sep 17
378–401YouWill it rain in Oslo on Sunday?
Sep 10
353–377YouLisbon this weekend: beach or museums?
Aug toSep 3
Summary the model reads

The user plans weekends in Lisbon and Oslo and asks about rain, warmth and what to pack. Lisbon has mostly been dry; Oslo is cooler, with rain most weekends.

Messages 0 to 352 · kept in history
The model reads the summary and every message after it. History keeps every message.
What the model readsWhat history keeps

Oct 1toOct 9

AI agents that remember across runs

These two files are the whole program. Run it on Thursday and the process exits. Run it again eight days later with a follow-up, and the agent already knows which cities you meant. There is no memory code: the same key brings back the same agent, with its history, from any process.

import { Agents, schema, tool } from "@camelai/run";

// A real tool: runs here, in this process, and calls Open-Meteo (free, no key).
const weather = tool({
  description: "Current weather and a 7-day forecast for a city",
  input: schema.Object({ city: schema.String() }),
  execute: async ({ city }) => {
    const geo = await (await fetch(`https://geocoding-api.open-meteo.com/v1/search?count=1&name=${encodeURIComponent(city)}`)).json();
    const place = geo.results?.[0];
    if (!place) throw new Error(`No place called ${city}`);
    const url = `https://api.open-meteo.com/v1/forecast?latitude=${place.latitude}&longitude=${place.longitude}` +
      "&current=temperature_2m,precipitation,wind_speed_10m&daily=temperature_2m_max,temperature_2m_min,precipitation_probability_max&forecast_days=7&timezone=auto";
    return { place: `${place.name}, ${place.country}`, ...(await (await fetch(url)).json()) };
  },
});

const agents = new Agents();
const agent = await agents.upsert("stream-tool-ts", {
  model: "openrouter/openai/gpt-6-luna",
  instructions: "You are a concise weather assistant. Use the weather tool; never guess.",
  tools: { weather },
});

const question = process.argv.slice(2).join(" ") || "Do I need an umbrella in Lisbon or Oslo this weekend?";
for await (const part of agent.stream(question)) {
  if (part.type === "text") process.stdout.write(part.text);
  if (part.type === "tool_call") console.log(`→ ${part.name}(${JSON.stringify(part.arguments)})`);
}
console.log();
await agents.close();
~/stream-tool-ts
Thu Oct 1 · 09:14

$ npm install

$ export CAMELAI_API_KEY=art_...

$ npm start -- "Do I need an umbrella in Lisbon or Oslo this weekend?"

> start

> tsx index.ts Do I need an umbrella in Lisbon or Oslo this weekend?

→ weather({"city":"Lisbon"})

→ weather({"city":"Oslo"})

For this weekend (October 3–4), an umbrella looks unlikely to be needed in either city. Rain chances are low in Lisbon (9% Saturday, 17% Sunday) and modest in Oslo (22% both days).

~/stream-tool-ts
Fri Oct 9 · 18:02

$ export CAMELAI_API_KEY=art_...

$ npm start -- "What about this weekend?"

> start

> tsx index.ts What about this weekend?

→ weather({"city":"Lisbon"})

→ weather({"city":"Oslo"})

For this weekend (October 10–11), take an umbrella to Oslo: rain is likely on Saturday (80%) and possible on Sunday (45%). Lisbon stays dry, at 5% and 10%.

Oct 14Oct 16

Persistent memory in files your AI agent writes

Ask it to keep notes and it writes a file in its workspace, where it stays for any later run to open. Your code reads the same files with agent.files.

Historystream-tool-ts
  • 461YouI fly to Oslo on the 17th. Keep a packing list for the trip in a file.Oct 14 20:31
  • 467YouAnything to add to my packing list?Oct 16 07:50
/workspace/oslo-packing-list.md179 B · v2
464 · Oct 14write({"path":"/workspace/oslo-packing-list.md","content":"# Oslo trip, October 17–20\n\n- Waterproof jacket\n- Warm layers for 4–9°C\n- Walking shoes\n- Power adapter, type F\n"})
# Oslo trip, October 17–20

- Waterproof jacket
- Warm layers for 4–9°C
- Walking shoes
471 · Oct 16edit({"path":"/workspace/oslo-packing-list.md","old":"- Walking shoes\n","new":"- Walking shoes\n- Compact umbrella (rain Saturday)\n- Gloves for 3°C mornings\n"})
- Compact umbrella (rain Saturday)
- Gloves for 3°C mornings
464 · Oct 14
- Power adapter, type F
  • Notes outlast any summary

    A summary changes only what the model is sent from the history. The files stay exactly as the agent wrote them.

  • Forks keep the memory

    A fork copies the agent's history and its workspace files. From then on, each one remembers its own way.

  • Shared between agents

    Mount one volume in several agents to share files, read-only or read-write.

Oct 21 on

Long-term memory that outlasts the context window

When a conversation gets close to what the model can read, camelRun summarizes the older messages in the background. The agent keeps working and the next run starts right away. The model reads the summary and the recent messages, and the history still has every one.

Context and historystream-tool-ts
Summarizing
The model readsHistory keeps
753Agent22 km/h right now.
752ToolResult of weather
751Agentweather({"city":"Lisbon"})
750YouWindy in Lisbon right now?
749AgentOnly Thursday, at 40%.
748ToolResult of weather
747Agentweather({"city":"Lisbon"})
746YouAny rain in Lisbon this week?
745Agent21°C and a 10% chance of rain.
744ToolResult of weather
743Agentweather({"city":"Lisbon"})
742YouHow warm is Lisbon on Sunday?
706 to 741 · 36 more
353 to 705 · 353 more messages
Summary of messages 0 to 352

Weekends in Lisbon and Oslo: rain, warmth, what to pack.

Events · /v1/agents/{id}/events

data: {"type":"event","requestId":"","event":{"type":"compaction_end","reason":"threshold","background":true,"tokensBefore":167412,"keptMessages":48,"summarizedMessages":353}}

data: {"type":"event","requestId":"","event":{"type":"compaction_start","reason":"threshold","background":true}}

  • Summarized in the background

    The summary is written between runs or while the agent works, so the next run starts right away.

  • Every message kept

    agent.history() returns the whole conversation, oldest first.

  • Switch models, keep the memory

    A new model, instructions or tools take effect between turns, and the history carries over.

FAQ

AI agent memory questions

01What are different types of memory in AI agents?
Short-term memory is what the model reads this turn, episodic memory is past conversations, and semantic memory is facts the agent keeps, such as notes. On camelRun the model reads the whole conversation, or a summary plus the recent messages once it outgrows the context window; the history keeps every message, and the agent writes its notes to files.
02How to improve AI agent memory?
Give each user or conversation its own keyed agent, so everything lands in one history. Ask the agent to keep a notes file for facts it should hold onto, and mount a shared volume for documents several agents need. camelRun summarizes long conversations for the model on its own.
03What is the best memory for AI agent?
One that keeps everything and shows the model what fits. camelRun keeps the full history, summarizes older messages when a conversation outgrows the model, and keeps the agent's files in its own workspace, with no separate memory service for you to run.
04Do I need a database to give my AI agent memory?
No. The agent's key is its memory: upsert the same key from any process and you get the same agent, with its history and files. They stay in camelRun until you delete the agent.
05What happens when a conversation is longer than the model's context window?
Before it gets there, camelRun summarizes the older messages in the background while the agent keeps working. The model then reads the summary and the recent messages, and the history keeps every message.
06Can my code read what my agent remembers?
Yes. agent.history() returns every message, oldest first, and agent.files lists, downloads and signs links to the files in its workspace. The console shows the same conversation and files.
07How much does AI agent memory cost?
Storage is $0.10 per GB-month for history and files, and idle and sleeping agents cost only storage. Agent time is $0.01 per agent-hour, only while an agent is in a run, and tokens on your own provider keys cost $0.
08Can I export my agents' memory?
Yes. Account → Export data in the console, or GET /v1/account/export, gives you one zip: each agent's history as JSON, one page of whole turns per file, named by its first message's index, and every workspace's files under volumes/. Self-host the open-source runtime, and the same memory stays on your own servers.

More on AI agent memory

Give your AI
agent
a memory

Get an API key, run the example, and ask it a follow-up tomorrow.

Historystream-tool-ts
Asleep
Tomorrow
754YouYour next message
Set up with your coding agent

Read https://run.camelai.com/SKILL.md and set up camelRun in this project. Ask me what the agent should do.

Paste into Claude Code, Codex, Cursor or any coding agent. It asks what your agent should do, then builds it.