> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mage.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Run agent

> Trigger an agent backing pipeline and receive stream metadata.

Only in Mage Pro.

Try our fully managed solution to access this advanced feature.

[Get started for free](https://cloud.mage.ai/sign-up?source=agents-api)

## Stream a published agent

The agent's **Endpoint** page shows the streaming POST URL after an API trigger is available. Edit the JSON request body on that page and select **Run agent** to submit it to this endpoint and follow the response stream in the UI:

```http theme={"system"}
POST /api/triggers/{pipeline_schedule_id}/streams
Authorization: Bearer <trigger_token>
Content-Type: application/json
```

```json theme={"system"}
{
  "pipeline_run": {
    "variables": {
      "message": "Summarize yesterday's support tickets."
    }
  }
}
```

Use the active API trigger's schedule ID and token. This request runs the backing pipeline's last agent block and returns server-sent events (SSE), including run metadata and agent output, on the same connection. Include your deployment's URL prefix before `/api` when applicable.

## Start a run with a Mage session

```http theme={"system"}
POST /api/agents/{agent_uuid}/runs
```

```json theme={"system"}
{
  "agent_run": {
    "message": "Summarize yesterday's support tickets."
  }
}
```

The response includes the pipeline run ID, schedule ID, and stream URL.

```json theme={"system"}
{
  "agent_run": {
    "agent_uuid": "customer_support_agent_a1b2",
    "pipeline_run_id": 7,
    "pipeline_schedule_id": 42,
    "run_id": 7,
    "stream_url": "/api/triggers/42/streams/7"
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.