/api/v1/agentsCreate a new agent run
Queue a new AI agent to execute a task on your GitHub repository.
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"
modelstringAI model to use. If not specified, uses your default model. Model validation is performed by OpenCode.
Example: "claude-opus-4.5"
providerstringAI provider. If not specified, uses your default provider.
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"Agent runtime to use. 'opencode' (default) or 'claude-code'. If not specified, uses your default agent provider.
Example: "opencode"
toolsToolDefinition[]External HTTP tools the agent can call during execution. 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"