Skip to content

Ask an agent to review a ticket's pull request now

POST
/tasks/{id}/agent-reviews
Code sample: Shell / cURL
curl --request POST \
--url https://example.com/api/v1/tasks/example/agent-reviews \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "again": true, "kind": "code_review" }'

Starts a code review (code_review) or a QA pass (qa) of the ticket’s pull request at its current commit, even when the project’s review switches are off: those only start reviews on their own. It SPENDS MONEY, up to the review limit and the ticket limit that getProjectAgentReviews shows, and the caller answers for it. The pull request is the newest one an agent delivered, else the ticket’s Pull request field; it must be in the ticket’s repository, ready for review and into the project’s pull request branch, else 422 says what is missing. A review of the same commit the ticket already has is returned with outcome existing and nothing is spent; send again true to review a finished one again. 409 while another ticket’s review of the same commit runs. The report is an internal comment on the ticket. Requires tasks.delegate and a ticket the caller reaches.

id
required

Resource identifier (CUID2).

string
>= 1 characters

Resource identifier (CUID2).

Media typeapplication/json
object
again

True to review again a commit the ticket already has a finished review of (reported, skipped or failed), which spends money again; omit to get that review back

boolean
kind
required

Code_review for the Code review agent, qa for the QA agent checking the acceptance criteria

string
Allowed values: code_review qa

The ticket’s review of this commit, already there; nothing was spent.

Media typeapplication/json
object
data
required

The review a person asked an agent for on a ticket’s pull request.

object
outcome
required

Queued: a session will run; skipped: it could not run and the ticket got a note naming the cause; existing: the ticket already has a review of this commit and nothing was spent

string
Allowed values: queued skipped existing
review
required
object
attempt
required

1 for the first review of this commit, higher for each review again

integer
>= -9007199254740991 <= 9007199254740991
createdAt
required
string format: date-time
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$/
headSha
required

The commit reviewed

string
id
required
string
kind
required
string
Allowed values: code_review qa
prUrl
required

The pull request reviewed

string | null
projectId
required
string
skipCode
required

Why a skipped or released review did not run

string | null
skipNote
required
string | null
status
required

Where the review is; its report is an internal comment on the ticket

string
Allowed values: QUEUED RUNNING REPORTED SKIPPED SUPERSEDED FAILED

Example

{
"data": {
"outcome": "queued",
"review": {
"kind": "code_review",
"status": "QUEUED"
}
}
}

The review asked for: queued, or skipped with its cause.

Media typeapplication/json
object
data
required

The review a person asked an agent for on a ticket’s pull request.

object
outcome
required

Queued: a session will run; skipped: it could not run and the ticket got a note naming the cause; existing: the ticket already has a review of this commit and nothing was spent

string
Allowed values: queued skipped existing
review
required
object
attempt
required

1 for the first review of this commit, higher for each review again

integer
>= -9007199254740991 <= 9007199254740991
createdAt
required
string format: date-time
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$/
headSha
required

The commit reviewed

string
id
required
string
kind
required
string
Allowed values: code_review qa
prUrl
required

The pull request reviewed

string | null
projectId
required
string
skipCode
required

Why a skipped or released review did not run

string | null
skipNote
required
string | null
status
required

Where the review is; its report is an internal comment on the ticket

string
Allowed values: QUEUED RUNNING REPORTED SKIPPED SUPERSEDED FAILED

Example

{
"data": {
"outcome": "queued",
"review": {
"kind": "code_review",
"status": "QUEUED"
}
}
}

Validation error. Parse failures include field paths and expectations.

Media typeapplication/json

Validation error with safe field paths and expected values; submitted values are never returned.

object
error
required
object
code
required

Stable machine-readable error code.

string
issues
Array<object>
object
expected
required
string
message
required
string
path
required
Array<string | number>
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Unauthorized.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Forbidden.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Not found.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Conflict.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Invalid input.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Rate limit exceeded. Wait for Retry-After before retrying.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}
RateLimit-Limit
string
/^\d+$/

Maximum requests in the current quota window.

RateLimit-Policy
string

Quota policy in requests and window seconds, for example 60;w=60.

RateLimit-Remaining
string
/^\d+$/

Requests left in this quota window (zero when blocked).

RateLimit-Reset
string
/^\d+$/

Seconds until the current quota window resets, when available from the rate-limit store.

Retry-After
string
/^\d+$/

Seconds until another request may be attempted.