Background coding agent APIs, compared for CI and scripts
Eight coding agent APIs compared: how each hosted agent authenticates, starts a run, streams or polls, takes messages, stops, and handles retries.
Every hosted coding agent can be started from a button in its web app. Fewer have a coding agent API you can call from a CI job or an internal tool, and the ones that do disagree about most things after the first POST. They authenticate differently, only Cursor streams the run, only some let you message the agent once it has started, and only Cursor and Sinatra make a retried start safe.
This is a reference for the engineer wiring one of them up. It covers the hosted agents whose vendors document an HTTP API that starts a run from a task you write. It skips two things that often get mixed in: local agent wrappers that expose a CLI over HTTP on your own machine, and tracker APIs that create an issue so that some other trigger picks it up. If you'd rather start tasks from a chat window than from code, the claude.ai and ChatGPT post covers the MCP side.
Sinatra is ours, and it has one of these APIs. Several of the others are further along, and the table says where.
Product details checked October 2026 against each vendor's own API reference and docs, linked below. Most of these APIs are labeled beta, alpha or experimental by their own vendors and can change without much notice.
Coding agent APIs at a glance
| Agent | Status | Auth | Start a run | Follow it | Message a run | Stop | Retry-safe start |
|---|---|---|---|---|---|---|---|
| GitHub Copilot | Public preview | Fine-grained PAT or GitHub App user token | POST /agents/repos/{owner}/{repo}/tasks | Poll | Not in the API | Not in the API | Not documented |
| Cursor | Public beta | API key | POST /v1/agents | Stream (SSE) or poll | New run after the current one ends | Cancel a run | Yes, client-chosen agentId |
| Devin | v3 | Service user key or personal token | POST /v3/organizations/{org_id}/sessions | Poll | Yes | Terminate | Not documented |
| Google Jules | Alpha | API key | POST /v1alpha/sessions | Poll | Yes, during an active session | Delete only | Not documented |
| Claude Code routines | Experimental | Per-routine token | POST .../routines/{id}/fire | Not in the API | No | No | No |
| OpenHands Cloud | V1 | API key | POST /api/v1/app-conversations | Poll | Yes, while running | Pause or delete | Not documented |
| Factory | Selected organizations | API key | POST /api/v0/sessions, then a message | Poll | Yes | Interrupt | Not documented |
| Sinatra | Live | Personal access token | POST /v1/workspaces/:id/tasks | Poll | Yes, as the next turn | Stop the turn | Yes, Idempotency-Key |
OpenAI's Codex cloud isn't in the table because OpenAI documents no HTTP API for starting a cloud task. The CLI reference has codex cloud exec, which "submits a task directly," and the Codex SDK starts "local Codex threads," not cloud ones. To reach Codex cloud from a script, you shell out to the CLI.
GitHub Copilot
The agent tasks REST API is "in public preview and is subject to change." You POST to /agents/repos/{owner}/{repo}/tasks with a prompt, and optionally a model, a base_ref, a head_ref to commit to an existing branch, and create_pull_request, which defaults to false. That default catches people. Set it, or the agent does the work without opening a PR.
Following a task means polling it. GET returns the task with its sessions and a state such as queued, in_progress, waiting_for_user or completed. The REST reference has five endpoints, for listing, getting and starting tasks, and none for sending a message or cancelling; steering happens in the web session log. GitHub's cloud agent docs also cap each session at 59 minutes, a limit that "cannot be extended or bypassed."
GitHub's own pages disagree on plans. A June changelog says Pro, Pro+ and Max users "can now programmatically start and track Copilot cloud agent tasks," while the REST reference still says Business and Enterprise only. Runs bill AI credits. GitHub's automations docs add that each cloud agent session an automation starts "uses GitHub Actions minutes and GitHub AI Credits."
Cursor
The Cloud Agents API v1 is "in public beta." It takes a user or service account API key as Basic or Bearer auth. POST /v1/agents takes the prompt, a model (leave it out for your default), repositories with a starting ref, and autoCreatePR.
Cursor is the only one here that streams. GET /v1/agents/{id}/runs/{runId}/stream is a server-sent event stream of status, assistant, tool call and result events, and you can resume it with Last-Event-ID. Webhooks exist only on the older v0 API, for finished and errored runs. A follow-up is a new run on the same agent, and "only one run can be active per agent," so posting one while another is running returns 409 agent_busy. Cancelling a run is final. You can also choose the agent's id yourself, and a retried create then returns 409 agent_id_conflict instead of making a duplicate.
Cursor's API overview lists the Cloud Agents API under "Standard rate limiting" and says "Unless an endpoint documents a different limit, the default is 20 requests per minute." The same page labels the API "Beta (All Plans)", but Cursor's pricing page only includes cloud agents from Premium, at $30 a month, upward. Runs are charged "at API pricing for the selected model," against a spend limit you set.
Devin
Devin's v3 API is the current version; v1 and v2 are deprecated. Credentials start with cog_ and belong either to a service user or to a person. You start a session with POST /v3/organizations/{org_id}/sessions and a prompt, plus optional repositories, a playbook, an ACU limit and a structured output schema. Devin's common flows say to "monitor the session by polling for messages."
You can send a message to a session, and a sleeping session wakes up for it. You can terminate a session or archive it. Devin's pricing page lists concurrent sessions as "Up to 10" on Pro and Max and unlimited on Teams and Enterprise. Self-serve plans use their included quota first and then prepaid credits, and Enterprise is billed in ACUs. Besides sessions, Devin's API covers playbooks, knowledge and scheduled automations, more than any other API in this list.
Google Jules
The Jules REST API is "in an alpha release, which means it is experimental." You create an API key in Jules settings, up to three at a time, and send it in X-Goog-Api-Key. POST /v1alpha/sessions takes the prompt and a source with a starting branch. Check two fields before your first call. Without requirePlanApproval, "plans are auto-approved," and you have to set automationMode to AUTO_CREATE_PR because "by default, no PR will be automatically created."
You poll the session and its activities. sendMessage gives "additional instructions to Jules during an active session," and approvePlan approves a pending plan. The only way to end a session from the API is to delete it. Each task counts against the plan's daily and concurrent limits: 15 a day and 3 at once on the base Jules plan, 100 and 15 on Pro, 300 and 60 on Ultra. Google's docs don't say which plans can use the API.
Claude Code routines
Routines aren't a general task API, and Anthropic doesn't present them as one. A routine is a saved prompt with its repositories and settings, and its API trigger is a /fire endpoint that runs it, with optional extra text of up to 65,536 characters. The token belongs to one routine, is created in the Claude Code web UI, and can only fire that routine.
The response gives you a session URL, and the API stops there. It "does not stream session output or wait for the session to complete," and no endpoint reads the result, sends a follow-up or cancels. There's "no idempotency key" either, so "if a webhook caller retries, the endpoint creates multiple sessions." Each routine accepts up to 30 fires an hour and each account up to 100. It needs a Pro, Max, Team or Enterprise plan, and "the resulting sessions draw down the same Claude Code subscription usage as interactive sessions."
OpenHands Cloud
OpenHands' Cloud API uses an API key from settings as a Bearer token. POST /api/v1/app-conversations takes the first message and the repository, with an optional branch and model. There's no PR flag, and the documented example asks for the PR in the prompt. You poll for status, you can send a message to a running conversation, and you can pause its sandbox or delete the conversation.
The pricing page includes API access on the free Individual plan, with up to 10 conversations a day, and model use runs on your own key or on OpenHands' providers at cost. OpenHands is also the only open-source agent in this table. The OpenHands review goes further.
Factory
Factory's Sessions API "is enabled for selected organizations only," so most teams can't use it yet. You create a session, send the task as a message, and the message call can wait for the agent to finish. You can interrupt a running agent. Sessions consume Factory credits and compute.
Sinatra's task API
Sinatra's HTTP API is the same one its CLI and MCP server use, so anything you can do from sinatra in a terminal you can do with curl.
Authentication is a personal access token. You create one on the CLI & API page of the dashboard, pick an expiry of 30, 90 or 365 days, and copy it once; it starts with sntr_, and Sinatra stores only a hash. The token acts as you in every workspace you belong to, with your role in each, and stops working in a workspace you leave. GET /v1/me returns your workspaces and their ids.
To start a task, POST /v1/workspaces/:id/tasks with a prompt, an optional title, and an optional repo as owner/name. Leave repo out and the agent picks from the workspace's connected repositories. The response is 202 with the task and the id of your first message.
curl -s -X POST "https://api.sinatra.dev/v1/workspaces/$WS/tasks" \
-H "Authorization: Bearer $SINATRA_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: ci-run-8812-flaky-retry" \
-d '{"prompt": "The retry test failed on CI run 8812 with a timeout. Find the cause and fix it.", "repo": "acme/web"}'
In automation, always send an Idempotency-Key header. A start retried with the same key returns the same task and never starts a second one, and the same key with a different prompt is refused with 409 idempotency_conflict. If Sinatra saves the request but can't hand it to the agent yet, it answers 503 unavailable with the new task's id in the body, and a retry with the same key finishes the job. For a CI job that might run twice, derive the key from the run id and you get one task per failure however many times the step retries.
Following a task means polling. There's no stream and no outgoing webhook. GET .../tasks/:taskId returns the status and, once there is one, the pull request URL. GET .../tasks/:taskId/messages?after=<id> returns the conversation since the last message you read. The conversation holds the agent's answer for each turn, or its question when it needs input, plus Sinatra's own notices such as errors and refusals. It doesn't hold progress. A turn is done when the task stops working, for example when it reaches replied or pr_open. The CLI polls every three seconds, and a script can do the same.
Follow-ups go to POST .../tasks/:taskId/messages with {"text": "..."}, with the same idempotency rules. Any member of the workspace can follow up on a task started from the API, CLI or MCP. A message sent while the agent is working doesn't change the current turn. It waits and runs as the next one. Stopping is POST .../tasks/:taskId/stop, which stops the running turn and keeps the task, and it works on any task in the workspace, including ones that started on Linear, GitHub or Slack.
When the workspace's queue is full, a start returns 409 capacity_full with the same message the dashboard shows, including the upgrade link on Free. The request rate is 600 GET and 120 POST or DELETE requests a minute per token and endpoint. Prompts and messages can be up to 100,000 characters.
On cost, an API task counts against the workspace's plan like any other task. Free is 1 task at a time, plus 1 queued, with no daily limit and no card. Pro is $20 a month for the whole workspace: 3 tasks at a time, plus 10 queued, any number of people. The model bill goes to whatever subscription or API key runs the task. Sinatra never bills for model usage.
Calling a coding agent API from CI, alerts and cron
A failing CI job can open its own task. Add a step that runs only on failure and calls POST .../tasks with the log excerpt in the prompt and an Idempotency-Key built from the run id, so a re-run of the step doesn't start a second task. The job doesn't have to wait for the result. It can exit and leave the conversation to whoever opens the dashboard. When the failure is on a PR Sinatra opened itself, you don't need any of this, because it already handles failed checks as their own turn.
For error tracker alerts you need a small handler in the middle, because none of these agents take a Sentry or Datadog webhook directly. It receives the alert, decides whether it deserves a task, and starts one with the alert id as the idempotency key. Claude Code routines fit this shape well if you never need to read the answer back.
For a nightly sweep, a cron job lists the issues you'd hand off and starts a task for each. On Sinatra, start as many as the plan's queue holds (2 on Free, 13 on Pro), or fewer if teammates' tasks are already in it, since the plan's limits are shared by the whole workspace. Past that a start returns 409 capacity_full. Poll, and start the next as each one finishes its turn. On Jules, the plan's concurrent and daily limits do the same job.
What a coding agent API run costs
Copilot, Cursor, Factory, and Devin once its allowance is used up, bill the run itself, in AI credits, model tokens at API prices, or credits, so a long session costs more than a short one and the bill comes from the agent vendor. Jules and Claude Code routines draw on a plan you already pay for, through task quotas or subscription usage, and running more costs nothing extra until you reach the limit.
OpenHands and Sinatra can put model use on a provider account you control. OpenHands takes your own key, or runs models through its own providers at cost. Sinatra runs every task on a Claude or ChatGPT subscription or an API key your team connects, and charges a flat price for the workspace, so a task from the API costs the same as one from Linear: nothing on Sinatra's side beyond the plan. For a small team the cheapest honest path is the subscriptions you already pay for, plus $20 a month for the whole workspace.
Where the other APIs are ahead
If you need a live log inside your own tool, use Cursor. It streams run events, it has a real cancel, and a client-chosen agent id makes its creates safe to retry. Devin's API has playbooks, knowledge and scheduled automations alongside sessions. Copilot's lives inside GitHub, with the repository permissions and audit trail your organization already has, on a plan many teams already pay for. OpenHands is open source and lists API support on its free Individual plan.
Sinatra's API has no streaming and no webhooks, and its conversation holds answers and questions rather than progress. A message sent mid-turn waits for the next turn instead of reaching the running agent, unlike a Linear, GitHub or Slack task, where it does reach it. If you need live progress from code, Cursor is the closer fit today. Devin, Jules, OpenHands and Factory document a way to message a running agent.
Common questions
Is there an API for OpenAI's Codex cloud?
Not an HTTP one that OpenAI documents. codex cloud exec in the Codex CLI submits a cloud task, and codex cloud list returns recent tasks for scripting. The Codex SDK runs local threads.
Which coding agent APIs can stream progress?
Cursor's v1 API streams run events over server-sent events. The others, Sinatra included, are poll-based.
Can I send a message to an agent while it's running?
Devin, Jules, OpenHands and Factory document sending a message to a live session. Cursor takes a follow-up as a new run once the current one ends, and Sinatra's API runs it as the next turn. Copilot's REST API and Claude Code routines have no message endpoint.
Which ones are safe to retry?
Sinatra's Idempotency-Key and Cursor's client-chosen agentId both stop a retried start from creating a second run. Claude Code routines say outright that a retry creates another session. The rest don't document it either way, so treat a retry as a possible duplicate.
Does a task started from the API cost more than one from the UI?
None of these vendors document a separate API price. On Sinatra it counts against the same plan as any other task.
To try Sinatra's API, start free, create a token on the CLI & API page, and send the curl above against a repository you've connected. The API reference lists every endpoint and error. The background agents roundup and the Copilot, Cursor, Devin, Jules and OpenHands comparisons cover the rest of each product.