Invoke Agent — POST /api/v1/agents/{agent_id}/invoke
Invoke Agent
Invoke one agent on a stored test run.
Endpoint: POST /api/v1/agents/{agent_id}/invoke
Authentication: Send a signed-in user’s access token in Authorization: Bearer <access token>, or an API key in X-API-Key: <API key>.
- Your role must be QA engineer or higher.
Parameters
Section titled “Parameters”| Name | In | Required | Type | Default | Description |
|---|---|---|---|---|---|
agent_id | path | yes | string | ||
Idempotency-Key | header | no | string or null | Client-generated key (UUID or ULID). The same key with the same request returns the invocation it created (200); with a different request, 422; while the first request is still being handled, 409. Scoped to your user, project, and agent route. | |
X-API-Key | header | no | string or null | API key, as an alternative to the access token (see Authentication). |
Request body
Section titled “Request body”| Content type | Body | Required |
|---|---|---|
application/json | AgentInvokeRequest | yes |
Responses
Section titled “Responses”| Status | Meaning | Body |
|---|---|---|
200 | Completed sync result or idempotent replay | AgentInvocationResponse (application/json) |
202 | Successful Response | AgentInvocationResponse (application/json) |
404 | Unknown agent or test run; for inline_input, anchor_run_not_found for every wrong anchor | Not documented |
409 | Invocation conflict or request still in flight | Not documented |
413 | inline_input is larger than 262144 bytes (inline_input_too_large) | Not documented |
422 | Invalid input or Idempotency-Key reuse | Not documented |
503 | Synchronous invocation capacity is full; Retry-After is returned | Not documented |
Errors this endpoint returns, read from its source code:
400, with the message “project_id does not match the test run’s project”403404, with the message “TestRun not found”409, with messages such as “A request with this Idempotency-Key is still being handled; retry shortly”, “This agent is already running on the test run under a different request; retry this Idempotency-Key after it finishes”422, with the message “config_overrides may only tighten the project agent configuration”503, with the message “All synchronous invocation slots are busy; retry shortly or invoke with mode=async”
It can also return 401 if your credential is missing or expired, 403 if your credential does not allow this request, and 404 if the item does not exist or you cannot see it. Your role, your project membership and the key’s scope decide what a credential allows. See Errors and retries.
More details
Section titled “More details”- Group: Agent Invocations
- Operation ID:
invoke_agent_api_v1_agents__agent_id__invoke_post - Source code:
backend/app/routers/agent_invoke.py, line 1047 - Specification: OpenAPI JSON