---
title: "Create agent run"
method: POST
path: "/api/agents/{agent_id}/runs"
tags: ["Agents"]
---

# Create agent run

`POST /api/agents/{agent_id}/runs`

Execute an agent run. Set `stream` to true to receive server-sent events; otherwise the response contains the final agent messages.

## Path parameters

- `agent_id` string, required

## Request body

- PlatformAgentRunCreateRequest — Request to run an agent. A request MUST supply either `messages` (a non-empty conversation) or `input` (for input-form triggered agents).
  - `input` object — Input fields for an input-form triggered agent.
  - `messages` PlatformMessage[] — Messages to pass to the agent. When provided, the array MUST contain at least one message and each message MUST specify a valid `role` and non-empty `content`.
    - `role` 'USER' | 'GLEAN_AI', required — Role of the message author.
    - `content` PlatformMessageTextBlock[], required — Content blocks in the message.
      - `text` string, required — Text content.
      - `type` 'text', required
  - `metadata` object — Metadata to pass to the agent.
  - `stream` boolean — Whether to stream the run response as server-sent events.

## Response `200`

Successful response.

- PlatformAgentRunWaitResponse
  - `run` PlatformAgentRun
    - `agent_id` string, required — ID of the agent being run.
    - `input` object — Input fields for an input-form triggered agent.
    - `messages` PlatformMessage[] — Messages passed to the agent.
      - `role` 'USER' | 'GLEAN_AI', required — Role of the message author.
      - `content` PlatformMessageTextBlock[], required — Content blocks in the message.
        - `text` string, required — Text content.
        - `type` 'text', required
    - `metadata` object — Metadata passed to the agent.
    - `status` 'error' | 'success', required — Status of the agent run.
  - `messages` PlatformMessage[] — Messages returned by the completed run.
    - `role` 'USER' | 'GLEAN_AI', required — Role of the message author.
    - `content` PlatformMessageTextBlock[], required — Content blocks in the message.
      - `text` string, required — Text content.
      - `type` 'text', required
  - `request_id` string, required — Platform-generated request ID for support correlation.

## Other responses

- `400` — Invalid request (malformed JSON, invalid parameter values, unknown fields).
- `401` — Missing or invalid authentication token.
- `403` — Token valid but lacks permission for the requested operation.
- `404` — Resource not found.
- `408` — Backend did not respond within the timeout window.
- `409` — Request conflicts with current state of the resource.
- `413` — Request body exceeds the maximum allowed size.
- `422` — Returned when the agent has tools the caller must authorize before the run can start. `authentication_suggestions` names each such tool; POST its `server_id` to the Client API's `/tool-servers/{serverId}/auth` with `returnUrl` in the request body to obtain an `authorizationUrl` to redirect the end user to, then retry the run once OAuth completes.
- `429` — Rate limit exceeded. Includes Retry-After header.
- `500` — Unexpected server-side failure.
- `503` — Backend temporarily unavailable.

## Changes

> 68 revisions in range; 13 could not be searched.

- **2026-07-02** `6f7d4c152b99` — 1 breaking
  - the `messages/items/content` request property's minItems was increased to `1`
- **2026-07-02** `8d67513963e9` — 18 warning, 1 info
  - added the new `request_too_large` enum value to the `code` response property for the response status `400`
  - added the new `request_too_large` enum value to the `code` response property for the response status `401`
  - added the new `request_too_large` enum value to the `code` response property for the response status `403`
  - added the new `request_too_large` enum value to the `code` response property for the response status `404`
  - …15 more
- **2026-07-01** `affb3c2f206c` — 9 info
  - added the optional property `errors` to the response with the `400` status
  - added the optional property `errors` to the response with the `401` status
  - added the optional property `errors` to the response with the `403` status
  - added the optional property `errors` to the response with the `404` status
  - …5 more

[Change history](https://skmtc.dev/gleanwork/apis/glean-platform-api/changes/api/agents/:agent_id/runs/post.md)

---

[API](https://skmtc.dev/gleanwork/apis/glean-platform-api.md) · [All operations](https://skmtc.dev/gleanwork/apis/glean-platform-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/gleanwork/glean-platform-api/revisions/46c121f70527/schema)
