Skip to main content
Get your first Qoder Cloud Agent running in five steps: obtain a token, pick an environment, create an Agent, create a Session, and exchange messages. The whole flow uses only curl — no SDK required.

Prerequisites

  • A Qoder account
  • A terminal (macOS, Linux, or WSL)
  • curl, plus jq (optional, for formatting JSON)

Windows users

The commands in this guide use bash syntax. Windows users should use one of the following:
  • Git Bash (recommended): included with Git for Windows
  • WSL: install via wsl --install
If using PowerShell, note these differences:
  • Set environment variables: $env:QODER_PAT="your-token" (not export)
  • Use real curl: type curl.exe (PowerShell aliases curl to Invoke-WebRequest)
  • Install jq separately: winget install jqlang.jq

Step 1: Obtain a PAT

  1. Sign in to the Qoder console.
  2. Open “Settings → Personal Access Tokens”.
  3. Click “Create Token”, set a name and expiration.
  4. Copy the token and export it as an environment variable:
The token is shown only once at creation. Save it immediately — adding it to ~/.bashrc or ~/.zshrc is recommended.

Step 2: Pick an Environment

List the available environments and capture the ID:
Example response:
If the response returns "data": [] (empty array), your account has no environments yet. Create one first:

Step 3: Create an Agent

Define a general-purpose Agent with a shell tool:
Example response:

Step 4: Create a Session

Creating a Session requires two parameters: agent (Agent ID or object) and environment_id (Environment ID). Bind the Agent to the Environment to create a runtime instance:
Example response:
The Session starts in idle status. It will only begin processing once you send a message in the next step.

Step 5: Send a Message and Stream Events

Send a user message to the Session, then receive Agent responses live over SSE:
Example event stream output:
  • Every event (except heartbeat) includes an id: line and the JSON payload contains id, type, and processed_at fields.
  • heartbeat events are sent approximately every 15 seconds to keep the connection alive.
  • The content field in agent.message uses the [{"type":"text","text":"..."}] array format.
  • session.status_running / session.status_idle carry no extra fields beyond id, type, processed_at, and (for idle) stop_reason.
  • agent.thinking signals that the model is reasoning but contains no content or text field.

End-to-End Script

The whole flow combined into a single runnable script:

FAQ

Q: I’m getting 401 Unauthorized. A: Check that $QODER_PAT is set correctly and the token has not expired. Recreate the token and update the environment variable. Q: Creating an Agent returns 400 Bad Request. A: Verify the request JSON. The model field must be a valid value (such as "ultimate"), and tools must be an array. Q: The Session stays in idle and emits no events. A: A newly created Session starts in idle status. You must send a user.message event (Step 5) to trigger Agent execution. Q: My SSE stream disconnected. A: The stream endpoint supports the Last-Event-ID header for reconnection replay. Pass the last event id you received; the stream resumes from the event after that ID. Event-type query filters are not currently supported. Q: GET /api/v1/cloud/environments returns an empty array. A: New accounts may not have a pre-provisioned environment. Follow the tip in Step 2 to create one manually.

Next steps

Agent setup

Every field in the Agent configuration.

Cloud environment setup

Customize the runtime environment.

Start a session

Manage Session lifecycle in depth.

Agent Skills

Attach domain expertise to your Agent for better task performance.