{"openapi":"3.1.0","info":{"title":"g2b Public API","description":"Create tasks, follow durable runs, steer active work, and inspect results through the public g2b API.","version":"1.0.0","summary":"Run coding agents from GitHub repositories."},"servers":[{"url":"https://g2b.freenikki.com/api","description":"Production"}],"tags":[{"name":"Work","description":"Repository workspaces and their active threads."},{"name":"GitHub","description":"GitHub App connection and repository discovery."},{"name":"Tasks","description":"Durable coding tasks."},{"name":"Messages","description":"Task conversation and run controls."},{"name":"Runs","description":"Agent run state and resumable events."}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"g2b API key","description":"Create an API key in g2b Settings, then send it as a Bearer token."}},"schemas":{"WorkList":{"type":"object","required":["projects"],"properties":{"projects":{"type":"array","items":{"type":"object","required":["id","name","repository","branch","threads"],"properties":{"id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256},"name":{"type":"string"},"repository":{"type":"string"},"branch":{"type":"string"},"threads":{"type":"array","items":{"type":"object","required":["id","status","prompt","harness","model","latest_run"],"properties":{"id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256},"status":{"type":"string"},"prompt":{"anyOf":[{"type":"string"},{"type":"null"}]},"harness":{"type":"string"},"model":{"type":"string"},"latest_run":{"anyOf":[{"type":"object","required":["id","status"],"properties":{"id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256},"status":{"type":"string"}},"additionalProperties":false},{"type":"null"}]}},"additionalProperties":false}}},"additionalProperties":false}}},"additionalProperties":false},"ApiError":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"additionalProperties":false}},"additionalProperties":false},"UnauthorizedError":{"type":"object","required":["error"],"properties":{"error":{"type":"string","enum":["Unauthorized"]}},"additionalProperties":false},"GitHubConnection":{"type":"object","required":["installations","installation_requests"],"properties":{"status":{"type":"string"},"message":{"type":"string"},"app_slug":{"type":"string"},"install_url":{"type":"string"},"user":{"type":"object","required":["id","login","avatar_url"],"properties":{"id":{"anyOf":[{"type":"number"},{"type":"string"}]},"login":{"type":"string"},"avatar_url":{"type":"string"}},"additionalProperties":false},"installations":{"type":"array","items":{"type":"object","required":["id","account","avatar_url","target_type","repository_selection","suspended","manage_url"],"properties":{"id":{"anyOf":[{"type":"number"},{"type":"string"}]},"account":{"type":"string"},"avatar_url":{"type":"string"},"target_type":{"type":"string"},"repository_selection":{"type":"string"},"suspended":{"type":"boolean"},"manage_url":{"type":"string"}},"additionalProperties":false}},"installation_requests":{"type":"array","items":{"type":"object","required":["id","account","avatar_url","target_type","requested_at"],"properties":{"id":{"anyOf":[{"type":"number"},{"type":"string"}]},"account":{"type":"string"},"avatar_url":{"type":"string"},"target_type":{"type":"string"},"requested_at":{"type":"string"}},"additionalProperties":false}},"installation_requests_status":{"type":"string"}},"additionalProperties":false},"RepositoryList":{"type":"object","required":["repositories"],"properties":{"repositories":{"type":"array","items":{"type":"object","required":["repository_id","installation_id","owner","name","full_name","url","avatar_url","private","default_branch"],"properties":{"repository_id":{"type":"number"},"installation_id":{"type":"number"},"owner":{"type":"string"},"name":{"type":"string"},"full_name":{"type":"string"},"url":{"type":"string"},"avatar_url":{"type":"string"},"private":{"type":"boolean"},"default_branch":{"type":"string"}},"additionalProperties":false}}},"additionalProperties":false},"GitHubInstallSession":{"type":"object","required":["install_url","expires_at"],"properties":{"install_url":{"type":"string"},"expires_at":{"type":"string"}},"additionalProperties":false},"TaskWithRun":{"type":"object","required":["id","project_id","status","created_at","run_id","run_status","message_id","run_url","events_url"],"properties":{"id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256},"project_id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string"},"sandbox_status":{"anyOf":[{"type":"string"},{"type":"null"}]},"github_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"branch":{"anyOf":[{"type":"string"},{"type":"null"}]},"messages":{"type":"array","items":{"$ref":"#/components/schemas/JsonValue"}},"created_at":{"type":"string"},"updated_at":{"type":"string"},"run_id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256},"run_status":{"type":"string"},"message_id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256},"run_url":{"type":"string"},"events_url":{"type":"string"}},"additionalProperties":false},"JsonValue":{"anyOf":[{"type":"null"},{"type":"boolean"},{"type":"number"},{"type":"string"},{"type":"array","items":{"$ref":"#/components/schemas/JsonValue"}},{"type":"object","required":[],"properties":{},"additionalProperties":{"$ref":"#/components/schemas/JsonValue"}}]},"TaskList":{"type":"object","required":["tasks"],"properties":{"tasks":{"type":"array","items":{"type":"object","required":["id","project_id","status","created_at"],"properties":{"id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256},"project_id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string"},"sandbox_status":{"anyOf":[{"type":"string"},{"type":"null"}]},"github_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"branch":{"anyOf":[{"type":"string"},{"type":"null"}]},"messages":{"type":"array","items":{"$ref":"#/components/schemas/JsonValue"}},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"additionalProperties":false}}},"additionalProperties":false},"Task":{"type":"object","required":["id","project_id","status","created_at"],"properties":{"id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256},"project_id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string"},"sandbox_status":{"anyOf":[{"type":"string"},{"type":"null"}]},"github_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"branch":{"anyOf":[{"type":"string"},{"type":"null"}]},"messages":{"type":"array","items":{"$ref":"#/components/schemas/JsonValue"}},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"additionalProperties":false},"ResumableRun":{"type":"object","required":["run_id"],"properties":{"run_id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256}},"additionalProperties":false},"MessagePage":{"type":"object","required":["messages","next_cursor"],"properties":{"messages":{"type":"array","items":{"type":"object","required":["id","role","parts","created_at"],"properties":{"id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256},"role":{"type":"string"},"parts":{"type":"array","items":{"$ref":"#/components/schemas/JsonValue"}},"created_at":{"type":"string"}},"additionalProperties":false}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"additionalProperties":false},"RunControlSubmission":{"type":"object","required":["control","run"],"properties":{"control":{"type":"object","required":["id","task_id","kind","status","prompt","target_run_id","created_run_id","created_at","applied_at"],"properties":{"id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256},"task_id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256},"kind":{"type":"string","enum":["queue","steer"]},"status":{"type":"string","enum":["pending","applied"]},"prompt":{"type":"string"},"target_run_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_run_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string"},"applied_at":{"anyOf":[{"type":"string"},{"type":"null"}]}},"additionalProperties":false},"run":{"anyOf":[{"type":"object","required":["run_id","run_status","message_id","run_url","events_url"],"properties":{"run_id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256},"run_status":{"type":"string"},"message_id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256},"run_url":{"type":"string"},"events_url":{"type":"string"}},"additionalProperties":false},{"type":"null"}]}},"additionalProperties":false},"RunControlList":{"type":"object","required":["controls"],"properties":{"controls":{"type":"array","items":{"type":"object","required":["id","task_id","kind","status","prompt","target_run_id","created_run_id","created_at","applied_at"],"properties":{"id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256},"task_id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256},"kind":{"type":"string","enum":["queue","steer"]},"status":{"type":"string","enum":["pending","applied"]},"prompt":{"type":"string"},"target_run_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_run_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string"},"applied_at":{"anyOf":[{"type":"string"},{"type":"null"}]}},"additionalProperties":false}}},"additionalProperties":false},"MessageAccepted":{"type":"object","required":["status","run_id","run_status","message_id","run_url","events_url"],"properties":{"status":{"type":"string","enum":["accepted"]},"run_id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256},"run_status":{"type":"string"},"message_id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256},"run_url":{"type":"string"},"events_url":{"type":"string"}},"additionalProperties":false},"Run":{"type":"object","required":["id","task_id","project_id","message_id","status","attempt","sandbox_id","error","usage","created_at","updated_at","started_at","completed_at","terminal"],"properties":{"id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256},"task_id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256},"project_id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256},"message_id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256},"status":{"type":"string"},"attempt":{"type":"integer","description":"a non-negative number","title":"greaterThanOrEqualTo(0)","minimum":0},"sandbox_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"error":{"anyOf":[{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"detail":{"type":"string"}},"additionalProperties":false},{"type":"null"}]},"usage":{"anyOf":[{"type":"object","required":[],"properties":{"inputTokens":{"type":"number"},"outputTokens":{"type":"number"},"totalTokens":{"type":"number"}},"additionalProperties":false},{"type":"null"}]},"created_at":{"type":"string"},"updated_at":{"type":"string"},"started_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"completed_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"terminal":{"type":"boolean"}},"additionalProperties":false},"RunEventPage":{"type":"object","required":["events","next_sequence","status","terminal","error"],"properties":{"events":{"type":"array","items":{"type":"object","required":["sequence","chunk","created_at"],"properties":{"sequence":{"type":"number"},"chunk":{"$ref":"#/components/schemas/JsonValue"},"created_at":{"type":"string"}},"additionalProperties":false}},"next_sequence":{"type":"number"},"status":{"type":"string"},"terminal":{"type":"boolean"},"error":{"anyOf":[{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"detail":{"type":"string"}},"additionalProperties":false},{"type":"null"}]}},"additionalProperties":false}}},"paths":{"/v1/work":{"get":{"operationId":"listWork","tags":["Work"],"summary":"List workspaces and threads","description":"Returns the repositories, branches, threads, and latest runs visible to the caller.","responses":{"200":{"description":"The caller’s current work.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkList"}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"The API key or browser session is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"404":{"description":"The requested resource does not exist for this user.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"The request failed unexpectedly.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"security":[{"bearerAuth":[]}]}},"/v1/github/connection":{"get":{"operationId":"getGitHubConnection","tags":["GitHub"],"summary":"Inspect the GitHub connection","description":"Returns the caller’s GitHub App installation and authorization state.","responses":{"200":{"description":"The current GitHub connection state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitHubConnection"}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"The API key or browser session is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"404":{"description":"The requested resource does not exist for this user.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"The request failed unexpectedly.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"security":[{"bearerAuth":[]}]}},"/v1/github/repositories":{"get":{"operationId":"listRepositories","tags":["GitHub"],"summary":"List available repositories","description":"Lists repositories available through the caller’s GitHub App installations.","responses":{"200":{"description":"Repositories matching the optional query.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RepositoryList"}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"The API key or browser session is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"404":{"description":"The requested resource does not exist for this user.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"The request failed unexpectedly.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"security":[{"bearerAuth":[]}],"parameters":[{"in":"query","name":"q","schema":{"type":"string","title":"maxLength(256)","maxLength":256},"description":"a string at most 256 character(s) long"}]}},"/v1/github/install-session":{"post":{"operationId":"createGitHubInstallSession","tags":["GitHub"],"summary":"Create a GitHub install session","description":"Creates a short-lived, single-use GitHub App installation URL for the native app.","responses":{"201":{"description":"A short-lived installation session.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitHubInstallSession"}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"The API key or browser session is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"404":{"description":"The requested resource does not exist for this user.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"The request failed unexpectedly.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["return_to"],"properties":{"return_to":{"type":"string","enum":["g2b://github/setup"]}},"additionalProperties":false}}}}}},"/v1/tasks":{"post":{"operationId":"createTask","tags":["Tasks"],"summary":"Create a task","description":"Creates a task for a repository and admits its first durable agent run.","responses":{"202":{"description":"The task and admitted run.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskWithRun"}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"The API key or browser session is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"404":{"description":"The requested resource does not exist for this user.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"The request failed unexpectedly.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["repository_id","prompt"],"properties":{"repository_id":{"type":"integer","description":"a positive number","title":"positive","exclusiveMinimum":0},"prompt":{"type":"string","description":"a string at most 4096 character(s) long","title":"maxLength(4096)","minLength":1,"maxLength":4096},"model":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256},"harness":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256},"reasoning_effort":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256},"client_request_id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256},"message_id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256}},"additionalProperties":false}}}}},"get":{"operationId":"listTasks","tags":["Tasks"],"summary":"List tasks","description":"Lists tasks owned by the caller.","responses":{"200":{"description":"The caller’s tasks.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskList"}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"The API key or browser session is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"404":{"description":"The requested resource does not exist for this user.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"The request failed unexpectedly.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"security":[{"bearerAuth":[]}]}},"/v1/tasks/{id}":{"get":{"operationId":"getTask","tags":["Tasks"],"summary":"Get a task","description":"Returns one caller-owned task and its current durable state.","responses":{"200":{"description":"The requested task.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Task"}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"The API key or browser session is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"404":{"description":"The requested resource does not exist for this user.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"The request failed unexpectedly.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"security":[{"bearerAuth":[]}],"parameters":[{"in":"path","name":"id","schema":{"type":"string","title":"maxLength(256)","minLength":1,"maxLength":256},"required":true,"description":"a string at most 256 character(s) long"}]}},"/v1/tasks/{id}/runs/resumable":{"get":{"operationId":"getResumableRun","tags":["Tasks"],"summary":"Find a resumable run","description":"Returns the active run that a client should resume, or an empty response when none exists.","responses":{"200":{"description":"The run to resume.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResumableRun"}}}},"204":{"description":"No resumable run exists."},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"The API key or browser session is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"404":{"description":"The requested resource does not exist for this user.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"The request failed unexpectedly.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"security":[{"bearerAuth":[]}],"parameters":[{"in":"path","name":"id","schema":{"type":"string","title":"maxLength(256)","minLength":1,"maxLength":256},"required":true,"description":"a string at most 256 character(s) long"}]}},"/v1/tasks/{id}/messages":{"get":{"operationId":"listMessages","tags":["Messages"],"summary":"List task messages","description":"Returns a cursor-paginated window of durable task messages.","responses":{"200":{"description":"A message window and its next cursor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessagePage"}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"The API key or browser session is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"404":{"description":"The requested resource does not exist for this user.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"The request failed unexpectedly.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"security":[{"bearerAuth":[]}],"parameters":[{"in":"path","name":"id","schema":{"type":"string","title":"maxLength(256)","minLength":1,"maxLength":256},"required":true,"description":"a string at most 256 character(s) long"},{"in":"query","name":"cursor","schema":{"type":"string","title":"maxLength(1024)","maxLength":1024},"description":"a string at most 1024 character(s) long"},{"in":"query","name":"limit","schema":{"type":"string","title":"lessThanOrEqualTo(200)"},"description":"a number less than or equal to 200"}]},"post":{"operationId":"sendMessage","tags":["Messages"],"summary":"Send a message","description":"Appends a message to an idle task and admits a new durable agent run.","responses":{"202":{"description":"The admitted run.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageAccepted"}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"The API key or browser session is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"404":{"description":"The requested resource does not exist for this user.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"The request failed unexpectedly.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"security":[{"bearerAuth":[]}],"parameters":[{"in":"path","name":"id","schema":{"type":"string","title":"maxLength(256)","minLength":1,"maxLength":256},"required":true,"description":"a string at most 256 character(s) long"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["prompt"],"properties":{"prompt":{"type":"string","description":"a string at most 4096 character(s) long","title":"maxLength(4096)","minLength":1,"maxLength":4096},"model":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256},"client_request_id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256},"message_id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256}},"additionalProperties":false}}}}}},"/v1/tasks/{id}/queue":{"post":{"operationId":"queueMessage","tags":["Messages"],"summary":"Queue the next message","description":"Queues a message behind the current run and may admit the next run immediately.","responses":{"202":{"description":"The queued control and optional admitted run.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunControlSubmission"}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"The API key or browser session is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"404":{"description":"The requested resource does not exist for this user.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"The request failed unexpectedly.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"security":[{"bearerAuth":[]}],"parameters":[{"in":"path","name":"id","schema":{"type":"string","title":"maxLength(256)","minLength":1,"maxLength":256},"required":true,"description":"a string at most 256 character(s) long"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["prompt","client_request_id","message_id"],"properties":{"prompt":{"type":"string","description":"a string at most 4096 character(s) long","title":"maxLength(4096)","minLength":1,"maxLength":4096},"client_request_id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256},"message_id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256}},"additionalProperties":false}}}}}},"/v1/tasks/{id}/steer":{"post":{"operationId":"steerMessage","tags":["Messages"],"summary":"Steer the current run","description":"Adds a steering instruction to the active run without creating a new run.","responses":{"202":{"description":"The accepted steering control.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunControlSubmission"}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"The API key or browser session is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"404":{"description":"The requested resource does not exist for this user.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"The request failed unexpectedly.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"security":[{"bearerAuth":[]}],"parameters":[{"in":"path","name":"id","schema":{"type":"string","title":"maxLength(256)","minLength":1,"maxLength":256},"required":true,"description":"a string at most 256 character(s) long"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["prompt","client_request_id"],"properties":{"prompt":{"type":"string","description":"a string at most 4096 character(s) long","title":"maxLength(4096)","minLength":1,"maxLength":4096},"client_request_id":{"type":"string","description":"a string at most 256 character(s) long","title":"maxLength(256)","minLength":1,"maxLength":256}},"additionalProperties":false}}}}}},"/v1/tasks/{id}/controls":{"get":{"operationId":"listRunControls","tags":["Messages"],"summary":"List queued and steering controls","description":"Returns the task’s durable control queue in creation order.","responses":{"200":{"description":"The task’s run controls.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunControlList"}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"The API key or browser session is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"404":{"description":"The requested resource does not exist for this user.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"The request failed unexpectedly.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"security":[{"bearerAuth":[]}],"parameters":[{"in":"path","name":"id","schema":{"type":"string","title":"maxLength(256)","minLength":1,"maxLength":256},"required":true,"description":"a string at most 256 character(s) long"}]}},"/v1/runs/{id}":{"get":{"operationId":"getRun","tags":["Runs"],"summary":"Get a run","description":"Returns one durable agent run, including status, timestamps, usage, and terminal state.","responses":{"200":{"description":"The requested run.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Run"}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"The API key or browser session is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"404":{"description":"The requested resource does not exist for this user.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"The request failed unexpectedly.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"security":[{"bearerAuth":[]}],"parameters":[{"in":"path","name":"id","schema":{"type":"string","title":"maxLength(256)","minLength":1,"maxLength":256},"required":true,"description":"a string at most 256 character(s) long"}]}},"/v1/runs/{id}/events":{"get":{"operationId":"listRunEvents","tags":["Runs"],"summary":"Read run events","description":"Long-polls the durable event log after a sequence cursor for resumable clients.","responses":{"200":{"description":"Events after the requested cursor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunEventPage"}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"The API key or browser session is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"404":{"description":"The requested resource does not exist for this user.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"The request failed unexpectedly.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"security":[{"bearerAuth":[]}],"parameters":[{"in":"path","name":"id","schema":{"type":"string","title":"maxLength(256)","minLength":1,"maxLength":256},"required":true,"description":"a string at most 256 character(s) long"},{"in":"query","name":"after","schema":{"type":"string","title":"greaterThanOrEqualTo(0)"},"description":"a non-negative number"},{"in":"query","name":"waitMs","schema":{"type":"string","title":"lessThanOrEqualTo(25000)"},"description":"a number less than or equal to 25000"}]}},"/v1/runs/{id}/cancel":{"post":{"operationId":"cancelRun","tags":["Runs"],"summary":"Cancel a run","description":"Requests cancellation and returns the latest durable run state.","responses":{"202":{"description":"The run after accepting cancellation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Run"}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"The API key or browser session is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"404":{"description":"The requested resource does not exist for this user.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"The request failed unexpectedly.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"security":[{"bearerAuth":[]}],"parameters":[{"in":"path","name":"id","schema":{"type":"string","title":"maxLength(256)","minLength":1,"maxLength":256},"required":true,"description":"a string at most 256 character(s) long"}]}}}}