camelRun by camelAI
Self-hosted AI agents
Run your AI agents on your own server with camelRun, the open source agent runtime. Their history and files stay there, and the same code runs on run.camelai.com.
docker compose up -d
[+] Running 0/2
Container agent-runtime-postgres-1StartingContainer agent-runtime-runtime-1 Startingset -a; . ./.env; set +a
cd ../../examples/quickstarts/hello-py
export CAMELAI_BASE_URL=http://localhost:8790
export CAMELAI_API_KEY="$AGENT_OPERATOR_TOKEN"
python main.py
Hello! ¡Hola! Bonjour!
Same SDK, same API
The same AI agent code, hosted or self-hosted
The SDKs find the runtime through CAMELAI_BASE_URL. Leave it unset and your agents run on run.camelai.com. Point it at your server and they run there. Nothing else in your code changes.
import asyncio
from camelai_run import Agents
async def main():
async with Agents() as agents: # reads CAMELAI_API_KEY
agent = await agents .upsert( "hello-py", model="openrouter/openai/gpt-6-luna")
print(( await agent .run( "Say hello in three languages.")) .text)
asyncio .run( main())set -a; . ./.env; set +aexport CAMELAI_BASE_URL=http://localhost:8790export CAMELAI_API_KEY="$AGENT_OPERATOR_TOKEN"export CAMELAI_API_KEY=art_...Run camelRun on your own server
The runtime is one container that runs beside your Postgres. Docker Compose brings both up, with a console of its own.
git clone https://github.com/ qaml-ai/ run
cd run/ deploy/ selfhost
cp .env.example .env # fill it in; generate secrets with: openssl rand -hex 32
# or fill every empty secret at once:
for v in AGENT_OPERATOR_TOKEN AGENT_SESSION_SECRET AGENT_SECRETS_KEY POSTGRES_PASSWORD; do
sed -i.bak "s/^$v=$/$v=$(openssl rand -hex 32)/" .env; done; rm .env.bak
docker compose up -d
curl -s localhost:8790/ healthz
{"ok":true}- Docker
- Compose v2, on linux/amd64 or linux/arm64
- Postgres
- 14 or later, or the one the Compose file runs
- Model keys
AGENT_TENANT_API_KEYS=with outbound HTTPS to your provider{"openrouter":"sk-or-..."}
Private by default
Keep your AI agents on your own network
The runtime doesn't need to be public. Your app calls it on your private network, and browsers read agents through your app. Agents call your own model server and tool server by their exact addresses, and nothing else on your network is in reach.
AGENT_PUBLIC_URL=http://runtime:8790
AGENT_BROWSER_URL=
AGENT_OUTBOUND_ALLOW_ORIGINS=http://app:3000,http://10.1.2.3:8000AGENT_PUBLIC_URL= http://runtime:8790
AGENT_BROWSER_URL=
AGENT_OUTBOUND_ALLOW_ORIGINS= http://app:3000, http://10.1.2.3:8000No lock-in
Move AI agents between hosted and self-hosted
Export your whole account as one zip, any time: every agent's configuration, its whole history, its files. On the other runtime, make each agent again under the same key and pass its history in. It picks up the conversation where it was.
- agents/
client_…/ agent.json upsert("hello-py", …) - agents/
client_…/ history/ 000000000.json initial_messages= - volumes/
…/ files/ … agent.files.upload(…)
curl -sf https://run.camelai.com/v1/account/export -H "Authorization: Bearer $CAMELAI_API_KEY" -o camelrun-export.zipcurl -sf https://run.camelai.com/ v1/ account/ export -H "Authorization: Bearer $CAMELAI_API_KEY" -o camelrun-export.zipAn open source AI agent platform you can read, run and fork
The runtime and its console are AGPL-3.0. The SDKs, UI kits, CLI and examples are MIT, so they go in any app. If the AGPL doesn't work for your organization, camelAI offers the runtime under a commercial license too.
- src/the runtime
- console/the console
- deploy/Docker Compose for self-hosting
- clients/TypeScript and Python SDKs
- sdk/@camelai/run on npm
- packages/CLI, React, Vue, Svelte, Solid
- examples/runnable examples
- plugins/the Codex plugin
Questions about self-hosted AI agents
Can I self-host an AI agent platform?
- Yes. camelRun by camelAI is an open source runtime for AI agents that runs on your own servers with Docker: one container and Postgres.
Where does my agents' data live when I self-host?
- On your own servers. Agents' history and files are on your runtime's Docker volume, or in your own S3-compatible bucket, with their indexes in your Postgres. Provider keys you store through the API are encrypted with a secret you generate. Model calls go to the provider you choose, or to your own model server.
Is camelRun open source?
- Yes. The runtime is AGPL-3.0, on GitHub at qaml-ai/run, and self-hosting is free under the AGPL. The SDKs, UI kits, CLI and examples are MIT, so they go in any app, and camelAI offers the runtime under a commercial license too.
What do I need to run camelRun myself?
- Docker with Compose v2 on linux/amd64 or linux/arm64, Postgres 14 or later (the Compose file runs one for you), and your model keys. The container needs no privileged mode and no Docker socket.
How do I upgrade a self-hosted camelRun?
- Back up, set the new image in
.envand rundocker compose up -d. The new container applies its migrations as it starts, and the old one gives runs in progress time to finish before it exits. Can I run self-hosted camelRun on more than one server?
- Yes. Point every node at the same Postgres and S3-compatible storage, give each the address the other nodes reach it at, and put a load balancer in front: it sends each request to any node, and nodes pass it to the one serving that agent.
Is the self-hosted API the same as the hosted one?
- Yes. Set
CAMELAI_BASE_URLto your runtime andCAMELAI_API_KEYto its operator token, and everything in the quickstart works unchanged. In code,Agents(url=…, api_key=…)does the same (new Agents({ url, apiKey })in TypeScript). Can I move my agents from run.camelai.com to my own server?
- Yes. Export your account as one zip from the console or the API, with every agent's configuration, history and files. On your runtime, make each agent again under the same key and pass its history in.
More on camelRun
- OverviewcamelRunThe runtime for AI agents: the loop, history, tools, channels and pricing.
- ComparisonClaude Managed Agents alternativecamelRun next to Claude Managed Agents: run your AI agent on Claude or any other model, with the open-source runtime hosted by camelAI or on your own servers.
- ComparisonLetta 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.
- camelRun featureDurable 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.
- camelRun featureMCP agentsAI agents that call remote MCP servers with credentials the model never sees, and that are MCP servers themselves for Claude, Cursor and other clients.
- camelRun featureMulti-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.
- ComparisonsManaged agents comparedA map of the managed agent platforms, from Claude Managed Agents, OpenAI's Agents API and Google's Managed Agents to AWS, Microsoft Foundry, LangSmith, Letta and Temporal, placed by the models each runs and where it runs, with camelRun's comparisons.
- From the blogcamelAI is going open source. Here's whyWhy camelAI opens its products' source, starting with camelCode.
- DocsSelf-host camelRunStart it, upgrade, back up, keep it private, and run more than one node.
Start hosted or on your own server
Get an API key and run the quickstart on run.camelai.com, or clone the repo and bring the runtime up on your own machine. Your agents can move between the two.