Skip to content

Quickstart

Push a repo and stream an answer with curl.

Updated

This page takes you from an empty folder to a streamed answer. You need git, curl and an org on run.cloudraker.com.

  1. Create an API key

    Open the API keys page of Dash and select Create key. Select the Live environment, because Run has no test mode. Give the key the scopes run, read and git. Dash shows the value once. Copy it.

    export ORG="your-org"          # the subdomain of your org
    export RUN_TOKEN="crk_live_…"  # the value from Dash

    In the Run API reference, expand Try it to send a request. Sign in to Dash to fill the organization slug. Enter your live key when you send a protected request.

    Never write the key into a file in the repo. A push that contains a secret fails.

  2. Write an agent

    An agent is a folder with an AGENTS.md. The agent.yml next to it sets the options. It is optional, and each key has a default.

    mkdir -p hello-agents/hello && cd hello-agents
    
    cat > hello/AGENTS.md <<'EOF'
    # hello
    
    Greet the caller.
    
    1. Send a short greeting with the `message` tool.
    2. Call `done` with `{ "greeting": "<the greeting>" }`.
    EOF
    
    cat > hello/agent.yml <<'EOF'
    mode: zeroshot
    model:
      id: anthropic/claude-sonnet-5-5
      max_output_tokens: 1000
    limits:
      max_steps: 5
    timeout: 2m
    EOF
  3. Push the repo

    The repo URL is https://{org}.cloudraker.run/_git/{repo}. The token goes in an HTTP header, not in the URL.

    git init -q -b main
    git add . && git commit -qm "hello agent"
    git -c http.extraHeader="Authorization: Bearer $RUN_TOKEN" \
      push "https://$ORG.cloudraker.run/_git/hello-agents" main

    The push is the deploy. The gateway lints every file first. If the lint fails, git prints ! [remote rejected] main (<reason>). The reason names the file, the line and the rule. Fix it and push again.

  4. Start a run and stream it

    The URL is https://{org}.cloudraker.run/{base}/{agent}. The base path is the repo name until you change it in the repo settings.

    curl -N -X POST "https://$ORG.cloudraker.run/hello-agents/hello" \
      -H "Authorization: Bearer $RUN_TOKEN" \
      -H "Accept: text/event-stream" \
      -H "Content-Type: application/json" \
      -d '{ "input": "Say hello to the team." }'

    -N turns off the curl buffer, so each event shows when it arrives. The stream ends after the terminal event:

    id: 1
    event: run.started
    data: {"id":"evt_01K7…","seq":1,"type":"run.started","run_id":"run_01K7…","agent":"hello","turn":1,…}
    
    id: 2
    event: message
    data: {"id":"evt_01K7…","seq":2,"type":"message","data":{"text":"Hello, team!"},…}
    
    id: 3
    event: run.completed
    data: {"id":"evt_01K7…","seq":3,"type":"run.completed","data":{"result":{"greeting":"Hello, team!"},"usage":{…}},…}
  5. Replay the run

    Every event stays in the run until retention (30 days by default). Copy the run_id from any event. The streamed answer also carries it in the x-run-id header (curl -i shows it). Replay all events:

    export RUN_ID="run_01K7…"
    curl -N "https://$ORG.cloudraker.run/_run/$RUN_ID" \
      -H "Authorization: Bearer $RUN_TOKEN" \
      -H "Accept: text/event-stream"

    Resume after an event with Last-Event-ID: <seq>. Without Accept: text/event-stream, the same URL returns the run object as JSON, with status, result and usage.

Without a stream

Leave out Accept: text/event-stream. The start answers 202 with the run object at once:

curl -s -X POST "https://$ORG.cloudraker.run/hello-agents/hello" \
  -H "Authorization: Bearer $RUN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "input": "Say hello." }'
{
  "id": "run_01K7…",
  "agent": "hello",
  "mode": "zeroshot",
  "status": "queued",
  "turn": 1,
  "read_token": "rrt_…",
  "stream_url": "https://your-org.cloudraker.run/_run/run_01K7…",
  "result": null,
  "error": null
}

read_token reads this run only. You can give it to a browser that shows the run. Keep the crk_ key on your server.

To start an agent through the CloudRaker API, with one Job object and Prefer delivery, read API v2.

Talk to the agent

A run from POST /{base}/{agent} is for your backend. To let people chat with the agent, add a front door. Set mode: turns in hello/agent.yml, then add doors/hello.yml:

name: Hello
entry: hello
channels:
  console: {}
  web:
    origins: [https://www.example.com]

Push again. Open a test chat on the console channel:

npx rakerun conversation start --door hello-agents/hello --input "Hi" --stream

For a chat on your site, create an embed key and add the snippet. Read Front doors and Web chat.

If it fails

You see Do this
401 unauthorized Send the key as Authorization: Bearer crk_live_…. Query-string keys are refused.
403 forbidden Give the key the missing scope (run, read or git).
403 test_key_not_allowed Run has no test mode. Use a live key.
404 agent_not_found Check the folder name. The folder needs an AGENTS.md. Read Repo layout.
503 agent_undeployed The default branch has no valid deployment. Push to main again.
A run.failed event Read data.code. The codes are in Events and webhooks.

Start from a template

The console can import a ready-made agent from a template:

  1. Go to Agents and select Create agent.
  2. Select Start from a template. Choose a template from the catalog.
  3. The console imports the template files into your open change. A template with a phone, email or Slack channel also adds a front door under doors/. Review the files, then deploy.
  4. If the template uses connectors, go to Connectors and connect each one.

The templates are public. Read them in CloudRaker/run-agents-templates.

Next steps

  • Add instructions, skills and APIs: Repo layout.
  • Ask the caller a question: set mode: turns. Read Events and webhooks.
  • Get events on your server: add webhooks: to agent.yml.
  • Give the agent Markdown files to search: Knowledge.
  • Let people reach the agent by web chat, phone, email, Slack or Teams: Front doors.
  • Let callers phone the agent: Phone numbers.

Type to search…

↑↓ navigate↵ selectEsc close