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.

~/run/deploy/selfhost
docker compose up -d

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.

main.py
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())
Your server
set -a; . ./.env; set +aexport CAMELAI_BASE_URL=http://localhost:8790export CAMELAI_API_KEY="$AGENT_OPERATOR_TOKEN"
run.camelai.com
export CAMELAI_API_KEY=art_...
The quickstart runs on both

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.

Runtimeghcr.io/qaml-ai/runPostgrespostgres:16
Your server
~
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={"openrouter":"sk-or-..."}with outbound HTTPS to your provider

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.

Your browser users reach your app, and your app calls the camelRun runtime on your own server at http://runtime:8790 on your private network, where the agent hello-py runs. The runtime uses your Postgres, calls your app's tool server back, calls your model server at http://10.1.2.3:8000 and your model provider over HTTPS, and refuses calls to other hosts on your network.
.env
AGENT_PUBLIC_URL=http://runtime:8790
AGENT_BROWSER_URL=
AGENT_OUTBOUND_ALLOW_ORIGINS=http://app:3000,http://10.1.2.3:8000

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

Exporting your data
camelrun-export.zip
In the zipOn your server
  • agents/client_…/agent.json
  • agents/client_…/history/000000000.json
  • volumes/…/files/…
~
curl -sf https://run.camelai.com/v1/account/export -H "Authorization: Bearer $CAMELAI_API_KEY" -o camelrun-export.zip

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

github.com/qaml-ai/runView source
The runtimeAGPL-3.0
  • src/the runtime
  • console/the console
  • deploy/Docker Compose for self-hosting
Use it anywhereMIT
  • 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

Run it yourself

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 .env and run docker 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.
Hosted and self-hosted

Is the self-hosted API the same as the hosted one?

Yes. Set CAMELAI_BASE_URL to your runtime and CAMELAI_API_KEY to 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

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.