# Invoke once and stream

POST /v1/agents/{agent_name}/runs: Create a session and stream one run in a single request.

POST<code>/v1/agents/&#123;agent_name&#125;/runs</code>

Create a session and stream one run in a single request. The `200 OK` server-sent event stream carries `X-Session-ID` and `X-Run-ID` response headers; store both before processing events so the resources stay inspectable after a disconnect. This shortcut gives a retrying client no stable session boundary: use an explicit session for retry-safe admission, multiple runs, file attachments, durable human interaction, or independent reconnection.

Generated from the Platform API specification on 2026-09-04.

## Path parameters

| Parameter | Type | Description |
|---|---|---|
| `agent_name` | string | An agent enabled for the selected tenant, from List agents. |

## Headers

| Header | Required | Description |
|---|---|---|
| `Authorization` | yes | `Bearer` plus a short-lived OAuth access token issued for the Tanomis API audience. Backends obtain tokens with an [organization automation client](/guides/run/authenticate-your-backend); the CLI's human login is not an application credential. |
| `X-Organization-ID` | yes | The `organization_id` from the workspace projection you selected in `GET /v1/me/workspaces`. |
| `X-Workspace-Tenant-ID` | yes | The nested `tenant_id` from the same projection. A header cannot widen what the token grants. Some single-workspace or self-hosted environments take `X-Tenant-ID` instead, as supplied by their administrator. |
| `Accept` | yes | Send `text/event-stream`. |

## Request body

| Field | Type | Required | Description |
|---|---|---|---|
| `input` | object | required | Passed to the agent as JSON. The shape is defined by your agent's entrypoint. |

## Responses

| Status | Meaning |
|---|---|
| `200` | A server-sent event stream of the run's events; see Stream run events for the frame format and terminal events. |

## Request

```bash
curl -X POST "https://api.tanomis.com/v1/agents/support-copilot/runs" \
  -H "Authorization: Bearer $TANOMIS_TOKEN" \
  -H "X-Organization-ID: $TANOMIS_ORG" \
  -H "X-Workspace-Tenant-ID: $TANOMIS_WORKSPACE" \
  -H "Accept: text/event-stream" \
  -H "Content-Type: application/json" \
  -d '{
    "input": {
      "prompt": "Summarize the open customer issue."
    }
  }'
```

```python
import httpx

response = httpx.post(
    f"https://api.tanomis.com/v1/agents/{agent_name}/runs",
    headers={
        "Authorization": f"Bearer {token}",
        "X-Organization-ID": organization_id,
        "X-Workspace-Tenant-ID": tenant_id,
        "Accept": "text/event-stream",
    },
    json={
        "input": {
            "prompt": "Summarize the open customer issue.",
        },
    },
)
for line in response.iter_lines():
    print(line)
```

```typescript
const response = await fetch(`https://api.tanomis.com/v1/agents/${agentName}/runs`, {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${token}`,
    "X-Organization-ID": organizationId,
    "X-Workspace-Tenant-ID": tenantId,
    "Accept": "text/event-stream",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "input": {
      "prompt": "Summarize the open customer issue."
    }
  }),
});
const reader = response.body.getReader();
// Decode server-sent events from the stream; see Stream and replay events.
```
