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.
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:
Send a user message to the Session, then receive Agent responses live over SSE:
# Send a message (note: the request body wraps events in an array)curl -s -X POST "https://api.qoder.com/api/v1/cloud/sessions/$SESSION_ID/events" \ -H "Authorization: Bearer $QODER_PAT" \ -H "Content-Type: application/json" \ -d '{ "events": [ { "type": "user.message", "content": [{"type": "text", "text": "Write a Python function that computes the Fibonacci sequence and run a test."}] } ] }' | jq .
id: evt_019ef515680d7a0ebd3160ca45ec5484event: user.messagedata: {"content":[{"text":"Write a Python function that computes the Fibonacci sequence and run a test.","type":"text"}],"id":"evt_019ef515680d7a0ebd3160ca45ec5484","processed_at":"2026-06-23T15:24:41.357659669Z","type":"user.message"}id: evt_019ef515681a7c52a0b45aa87625f121event: session.status_runningdata: {"id":"evt_019ef515681a7c52a0b45aa87625f121","processed_at":"2026-06-23T15:24:41.357659669Z","type":"session.status_running"}event: heartbeatdata: {}id: evt_49dce735a4ab4fc4event: agent.thinkingdata: {"id":"evt_49dce735a4ab4fc4","processed_at":"2026-06-23T15:24:49.357659Z","type":"agent.thinking"}id: evt_02f80c5a8c245e04event: agent.messagedata: {"content":[{"text":"I'll create a Python module with the Fibonacci function and comprehensive tests.","type":"text"}],"id":"evt_02f80c5a8c245e04","processed_at":"2026-06-23T15:24:49.357659Z","type":"agent.message"}id: evt_50739b167fb7c6d3event: agent.tool_usedata: {"evaluated_permission":"allow","id":"evt_50739b167fb7c6d3","input":{"content":"def fibonacci(n): ...","file_path":"/data/fibonacci.py"},"name":"Write","processed_at":"2026-06-23T15:24:49.357659Z","type":"agent.tool_use"}id: evt_e7c375f3605ff156event: agent.tool_resultdata: {"content":[{"text":"Write file /data/fibonacci.py successfully","type":"text"}],"id":"evt_e7c375f3605ff156","is_error":false,"processed_at":"2026-06-23T15:25:01.853844Z","type":"agent.tool_result"}id: evt_60eba1483797a419event: session.status_idledata: {"id":"evt_60eba1483797a419","processed_at":"2026-06-23T15:25:24.436729Z","stop_reason":{"type":"end_turn"},"type":"session.status_idle"}
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.
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.