Quick start
Create an agent App, try it locally, then deploy it. Cantelop handles routing, Sandbox lifecycle, and persistent storage.
Prerequisites#
- Node.js 22 or newer and Bun
- An API key for whichever agent SDK you pick below.
- Docker with
linux/amd64build support, when deploying or using local container mode. - A Cantelop account, when you're ready to deploy. Local development needs no login.
Run it locally#
-
Install the CLI#
$ brew install stepandel/tap/cantelopHomebrew is recommended. The alternative installer supports macOS and Linux; follow its instructions to put
cantelopon your PATH. -
Create a project#
In an empty directory, choose the agent SDK your Session runtime will use:
$ cantelop init -app hello -provider openai $ npm install-app hellois the App slug this project deploys to. It need not exist yet, andinitdoes not require a login. Four files are written, and none are overwritten:cantelop.json app slug, entrypoints, environment declarations src/api.ts your public HTTP API src/session.ts your agent package.json the SDK and your agent SDK -
Add your provider key#
cantelop devreads a.envbesidecantelop.jsonand passes it to both entrypoints:.envCODEX_API_KEY=sk-...Local only. Production values are set against the App and are never uploaded from your project. Names beginning with
CANTELOP_are reserved. -
Run it#
Terminal$ cantelop dev → http://127.0.0.1:8787Then, in another terminal:
Terminal$ curl -X POST http://127.0.0.1:8787/sessions \ -H 'Content-Type: application/json' \ -d '{"userId":"ada"}' → {"sessionId":"ses_..."}Copy the returned
sessionIdinto the next request:Terminal$ curl -i -X POST http://127.0.0.1:8787/messages \ -H 'Content-Type: application/json' \ -d '{"userId":"ada","sessionId":"ses_...","prompt":"write hello.txt"}' → HTTP/1.1 202 Accepted202 Acceptedconfirms delivery was accepted, not that the agent has finished. The first message starts a Sandbox. Once the agent completes the task, look forhello.txtin.cantelop/dev/workspaces/.The starter opens one Workspace per
userId. Reuse the returnedsessionIdto continue the same Session. In a production API, derive the user's identity from authentication rather than trusting the request body.Leave
devrunning: it rebuilds as you edit, and a failed build keeps the last good one serving. For Docker mode and its differences, see local development. To add live agent output, see SSE and WebSocket.
What you just ran#
- The Edge API (
src/api.ts) receives HTTP requests and dispatches messages. - The Session runtime (
src/session.ts) runs your agent inside an isolated Sandbox and handles messages one at a time. - A Session keeps its identity when its Sandbox is released. A later message starts a fresh Sandbox; in-memory state must be restored by your agent.
- A Workspace holds persistent files shared by its Sessions. This starter
creates one per user. Add
.cantelop/to your.gitignoreto exclude local data.
See architecture for the Agent model and runtime lifecycle.
Deploy it#
-
Sign the CLI in#
Terminal$ cantelop loginAuthorize the CLI in the browser tab it prints.
-
Create the App#
Terminal$ cantelop app create -slug hello → app_0123456789abcdef0123456789abcdefThe slug must match
appincantelop.json— that is how a deploy finds its App, so generated IDs stay out of your source. It also names the App's public URL,https://hello.cantelop.dev. Choose your own available slug and update the manifest ifhellois already taken. -
Set the production environment#
Replace
APP_IDbelow with the ID returned byapp create. Set the secret for your selected provider; the command reads its value from stdin:$ cantelop app secret set APP_ID CODEX_API_KEYPaste the key, then press Enter and Ctrl-D. For Pi, use the credential name for your chosen provider. To set a non-secret variable:
Terminal$ cantelop app env set APP_ID LOG_LEVEL=debugSecrets are write-only. Variables and secrets are shared by the API and new Sessions. Local
.envvalues are never uploaded; see environments for required declarations and defaults. -
Deploy#
Terminal$ cantelop doctor $ cantelop deploydoctorchecks your toolchain, project, and the configuration your manifest marks required, and exits non-zero if anything fails.deploybuilds and uploads both components, then activates the release only when both succeed. Try the two requests above again withhttps://hello.cantelop.devin place of the local address, using the new Session ID returned by the deployed App.cantelop deploy --dry-runruns the same build with no login and no release. Use it to catch build problems before deploying.
After deploying#
Open the console to inspect the App. See deployment for release behavior and the CLI reference for logs, Session inspection, and rollback.
You should see#
cantelop devanswering onhttp://127.0.0.1:8787.- A
202 Acceptedresponse from/messagesandhello.txtin the local Workspace once the agent finishes. cantelop doctorreporting[pass]on every line.cantelop deployreporting bothapiandsession_runtimesucceeded.- Requests accepted by your deployed App at
https://hello.cantelop.dev.