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:18The 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.
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();{
"name": "stream-tool-ts",
"private": true,
"type": "module",
"scripts": { "start": "tsx index.ts" },
"dependencies": { "@camelai/run": "^0.11.0" },
"devDependencies": { "tsx": "^4.20.0" }
}$ 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).
$ 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.
- 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
# Oslo trip, October 17–20
- Waterproof jacket
- Warm layers for 4–9°C
- Walking shoes
- Compact umbrella (rain Saturday)
- Gloves for 3°C mornings
- Power adapter, type F
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.
Weekends in Lisbon and Oslo: rain, warmth, what to pack.
data: {"type":"event",
data: {"type":"event",
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, andagent.fileslists, 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 undervolumes/. Self-host the open-source runtime, and the same memory stays on your own servers.
More on AI agent memory
- OverviewcamelRunThe hosted runtime for AI agents: the loop, history, tools, channels and pricing.
- camelRunDurable AI agentsAgents whose history, files and unfinished work live in camelRun, so a turn carries on through deploys and crashes without sending a tool call twice.
- CompareLetta AI alternativecamelRun next to Letta AI for stateful agents: every message kept in the agent's history, files your code can read, and a path for agents on Letta's retired V1 server API.
- camelRunMulti-tenant AI agentsGive every user or conversation of your app its own AI agent. Each tool call says whom it is for, browsers read only their own agent, and each customer can bring its own model keys.
- camelRunMulti-agent orchestrationAn AI agent fans out tasks to sub-agents that work in parallel or in the background, and every answer folds back into its reply.
- camelRunSelf-hosted AI agentsRun camelRun's open source agent runtime on your own servers with one container and Postgres, with the same SDK and API as the hosted service.
- CompareCloudflare Agents alternativecamelRun next to Cloudflare's Agents SDK: an AI agent per user, like a Durable Object. camelRun runs the loop and keeps history, files and schedules; your Worker serves the tools.
- GuideHow to Give AI Agents Memory That Survives RestartsWhat to store where, how compaction works, and a two-process test that proves it.
- GuideHow to Build Durable AI Agents That Survive Crashes and DeploysKeep state through crashes and deploys, and wait days for a person.
- PricingcamelRun pricingWhat history, files and agent time cost: prepaid, no subscription.
- DocscamelRun conceptsKeyed agents, runs, forking and waking later.
- DocsFiles and volumesThe workspace, the agent's file tools, volumes and signed links.
Give your AI
agent
a memory
Get an API key, run the example, and ask it a follow-up tomorrow.
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.