# Resume Team Run Stream (/reference-api/schema/teams/resume-team-run-stream)

## Team storage and identity [#team-storage-and-identity]

Use the database-backed [example Team server](/reference-api/schema/teams/create-team-run#example-team-server). Keep the Team run's returned `run_id` and `session_id`; a nested member run is not interchangeable with the Team run. Stored run, checkpoint and session operations require the configured database.

JWT user isolation is opt-in; non-admin service-account PAT callers always self-scope. Scoped callers need their own matching Team session and run, while configured resource authorization also applies. Run and checkpoint lookups return **404** for inaccessible or mismatched records. For factories, retain any `factory_input` needed by endpoints that reconstruct the Team.

## Resume delivery [#resume-delivery]

Reconnect to a background streaming run with the original session and the last `event_index` actually received:

```bash
RUN_ID="returned-run-id"
SESSION_ID="returned-session-id"
curl --fail-with-body --no-buffer \
  "http://127.0.0.1:7777/teams/reference-team/runs/$RUN_ID/resume" \
  -H "Authorization: Bearer $OS_SECURITY_KEY" \
  -F "session_id=$SESSION_ID" -F 'last_event_index=7'
```

Replace `7` with the last observed index, or omit it to request all available events. An index is not a count. Scoped callers require `session_id`; supplying it also enables database fallback. Factories and remote Teams do not support resumption (**400**).

The default live buffer is process-local. [Multiple replicas](/agent-os/background-execution/multi-replica) need a shared event stream for live reconnection. Fallback replays saved events only; the example server enables event storage. A run with no stored events returns replay metadata rather than reconstructed output. HTTP **200** can contain an SSE error frame.

Resuming delivery does not restart a run or resolve human review. Use [Continue Team Run](/reference-api/schema/teams/continue-team-run) for decisions, and poll non-streaming background runs for their output.

## `POST /teams/{team_id}/runs/{run_id}/resume`

**Summary:** Resume Team Run Stream

**Description:** Resume an SSE stream for a team run after disconnection.

Sends missed events since `last_event_index`, then continues streaming live events if the run is still active.

**Three reconnection paths:**
1. **Run still active**: Sends catch-up events + continues live streaming
2. **Run completed (in buffer)**: Replays missed buffered events
3. **Run completed (in database)**: Replays events from database

**Client usage:**
Track `event_index` from each SSE event. On reconnection, pass the last received `event_index` as `last_event_index`.

### Authentication

- Option 1: `HTTPBearer` — HTTP bearer

### Parameters
- `run_id` (path; string; required)
- `team_id` (path; string; required)

### Request body

Required: no.

#### `application/x-www-form-urlencoded`

Schema `Body_resume_team_run_stream` (object).

**Top-level fields**
- `last_event_index` (integer | null; optional) — Index of last event received by client (0-based)
- `session_id` (string | null; optional) — Session ID for database fallback

### Responses

#### `200`

SSE stream of catch-up and/or live events

**`application/json`**

Type `unspecified`.

**`text/event-stream`**

#### Other responses

- `400` — Not supported for remote teams `application/json`: Schema `BadRequestResponse` (object).
- `401` — Unauthorized `application/json`: Schema `UnauthenticatedResponse` (object).
- `404` — Team not found `application/json`: Schema `NotFoundResponse` (object).
- `422` — Validation Error `application/json`: Schema `ValidationErrorResponse` (object).
- `500` — Internal Server Error `application/json`: Schema `InternalServerErrorResponse` (object).