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.
The actual response does not include metadata or skills fields (although they are listed in the field table). This example will be updated once the backend supports them.
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 .
event: user.messagedata: {"type":"user.message","content":"Write a Python function that computes the Fibonacci sequence and run a test."}event: session.status_runningdata: {"type":"session.status_running","status":"running"}event: heartbeatdata: {}event: span.model_request_startdata: {"type":"span.model_request_start"}event: agent.thinkingdata: {"type":"agent.thinking","content":"Let me write a Fibonacci function..."}event: agent.messagedata: {"type":"agent.message","content":[{"type":"text","text":"Here is an implementation of the Fibonacci sequence: ..."}]}event: agent.tool_usedata: {"type":"agent.tool_use","name":"Bash","input":{"command":"python3 fib.py"}}event: agent.tool_resultdata: {"type":"agent.tool_result","output":"..."}event: span.model_request_enddata: {"type":"span.model_request_end"}event: session.status_idledata: {"type":"session.status_idle","status":"idle"}
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.
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: Recommended: save the id field of the last event received before disconnection (e.g. evt_...), then reconnect with ?after_id=<last_event_id> query parameter. The server will resume pushing from after that event, without losing intermediate events. If not saved, use GET /sessions/{id}/events?order=desc to replay recent events before opening the stream.Q: GET /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.