---
title: "Create an agent run and stream the response"
method: POST
path: "/rest/api/v1/agents/runs/stream"
tags: ["Agents"]
---

# Create an agent run and stream the response

`POST /rest/api/v1/agents/runs/stream`

Executes an [agent](https://developers.glean.com/agents/agents-api) run and returns the result as a stream of server-sent events (SSE). **Note**: If the agent uses an input form trigger, all form fields (including optional fields) must be included in the `input` object.

## Request body

- AgentRunCreate — Payload for creating a run. **Important**: If the agent uses an input form trigger, the `input` field is required and must include all fields defined in the form schema. Even fields marked as optional in the UI must be included in the request—use an empty string (`""`) for optional fields without values. Omitting required form fields will result in a 500 error.
  - `agent_id` string, required — The ID of the agent to run.
  - `input` object — The input to the agent. Required when the agent uses an input form trigger.
  - `messages` Message[] — The messages to pass an input to the agent.
    - `role` string — The role of the message.
    - `content` object[] — The content of the message.
      - `text` string, required
      - `type` 'text', required
  - `metadata` object — The metadata to pass to the agent.

## Response `200`

Success

## Other responses

- `400` — Bad request
- `403` — Forbidden
- `404` — Not Found
- `409` — Conflict
- `422` — Returned when the agent has tools the caller has not authorized. The response body enumerates the tools that need connecting.
- `500` — Internal server error

## Changes

> 92 revisions in range; 8 could not be searched.

- **2026-07-22** `12f321ae935e` — 1 info
  - the endpoint scheme security `APIToken` was added to the API
- **2026-07-22** `90948cb39546` — 1 info
  - the endpoint scheme security `APIToken` was removed from the API
- **2026-07-21** `972a5118199e` — 1 info
  - the endpoint scheme security `APIToken` was added to the API
- **2026-07-21** `2d62172604d1` — 1 info
  - the endpoint scheme security `APIToken` was removed from the API
- **2026-06-22** `08c17c9175d0` — 1 info
  - the endpoint scheme security `APIToken` was added to the API

[Full history](https://skmtc.dev/gleanwork/apis/glean-api/changes/rest/api/v1/agents/runs/stream/post.md)

---

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