---
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

- **2026-08-25** `00dce7d508a3` — 1 warning
  - added the new `SANDBOX_EGRESS` enum value to the `authenticationSuggestions/items/allOf[#/components/schemas/ServerToolBase]/requestType` response property for the response status `422`
- **2026-08-05** `7f38858e000e` — 1 breaking, 2 info
  - the response's body type/format changed from `string`/`` to `object`/`` for status `422`
  - added the required property `authenticationSuggestions` to the response with the `422` status
  - added the required property `message` to the response with the `422` status

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

---

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