/api/v1/agentsCreate a new agent run
Queue a Claude Code, Codex, or OpenCode agent to execute a task on your GitHub repository. Set agent_provider to choose the runtime and agent_auth_method to use a connected Claude / ChatGPT subscription or a provider API key.
Request Body
repostringGitHub repository in format: owner/repo. If not specified, uses your default repository.
Example: "username/repo-name"
promptstringrequiredThe instruction/task for the AI agent to execute
Example: "Add a new endpoint to handle user authentication"
system_promptstringOptional replacement for the OpenCode system prompt. If provided, this prompt is sent as the full system prompt for the run instead of Codecloud's default.
Example: "You are a concise repository assistant. Follow the user prompt exactly."
modelstringAI model to use. If not specified, uses your default model. Claude Code requires an Anthropic or Bedrock model; Codex requires an OpenAI model.
Example: "claude-opus-4.5"
providerstringAI provider. If not specified, uses your default provider. Claude Code supports anthropic and amazon-bedrock; Codex supports openai.
Example: "anthropic"
branchstringGit branch to use (defaults to repo's default branch)
Example: "main"
webhook_urlstringURL to receive webhook notifications when the run completes
Example: "https://example.com/webhooks/agent-complete"
mode"execute" | "plan"Run mode: 'execute' runs the agent normally, 'plan' returns a plan without making changes
Example: "execute"
auto_create_prbooleanIf true, automatically create a GitHub PR with the agent's changes after completion
Example: true
blank_workspacebooleanIf true, the agent runs in a blank workspace with no repository. The repo, branch, and auto_create_pr fields are ignored. No code will be read or written — use this for tool-only workflows, Q&A, or other non-code tasks.
agent_provider"opencode" | "claude-code" | "codex"Agent runtime: 'claude-code' (Anthropic CLI), 'codex' (OpenAI CLI), or 'opencode' (default). If omitted, uses your default runtime.
Example: "claude-code"
agent_auth_method"subscription" | "api-key"For Claude Code or Codex: 'subscription' uses a connected Claude or ChatGPT subscription; 'api-key' uses a provider key. If omitted, uses the method saved on your account.
Example: "subscription"
toolsToolDefinition[]External HTTP tools the agent can call during execution. Supported on OpenCode only. Each tool defines its own endpoint and auth headers.
Array items:
namestringrequiredTool name (used as identifier)
Example: "search_inventory"
descriptionstringrequiredWhat the tool does
Example: "Search product inventory"
parametersobjectrequiredTool parameters in JSON Schema format
propertiesobjectrequiredParameter definitions keyed by name
Example: {"query":{"type":"string","description":"Search query"},"limit":{"type":"number","description":"Max results"}}
requiredstring[]Required parameter names
endpointobjectrequiredurlstringrequiredThe HTTP endpoint URL to call (must be a public URL, no localhost or private IPs)
Example: "https://api.example.com/search"
method"GET" | "POST" | "PUT" | "PATCH" | "DELETE"requiredHTTP method
Example: "POST"
headersobjectCustom headers to include (e.g. Authorization, API keys)
Example: {"Authorization":"Bearer token-abc"}
agentsobject[]Subagent definitions available to the parent agent during execution. Each subagent has a focused prompt and tool subset.
Array items:
namestringrequireddescriptionstringrequiredmode"subagent"requiredpromptstringrequiredtoolsobjectrequiredmax_turnsintegerResponses
idstringrequiredUnique identifier for the agent run
titlestringAuto-generated run title
status"queued"requiredInitial status of a new run
messagestringrequiredSuccess message
Errors(3)
errorstringrequiredError type
Example: "Validation Error"
messagestringrequiredDetailed error message
Example: "repo: repo must be in format: owner/repo"
errorstringrequiredError type
Example: "Validation Error"
messagestringrequiredDetailed error message
Example: "repo: repo must be in format: owner/repo"
errorstringrequiredError type
Example: "Validation Error"
messagestringrequiredDetailed error message
Example: "repo: repo must be in format: owner/repo"