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

# Live Digest

> Generate periodic narrative summaries via SSE streaming

Starts a summary-oriented monitoring job that samples the stream and emits narrative summaries.

Use this when you need trend-level understanding over time, not binary trigger detection.

## Delivery Mode Selection

`POST /live-digest` selects response mode by request shape:

1. `Accept: text/event-stream` and no `webhook_url` -> SSE mode
2. `webhook_url` present -> webhook mode
3. otherwise -> polling mode

## Response Semantics by Mode

### Polling mode

Returns a job response (`job_id`, `status`, `created_at`, `job_type`, `stream_url`, optional `message`).

Follow with `GET /jobs/{job_id}` for runtime details and summary outcomes.

### Webhook mode

Returns a job response immediately, then delivers async summary/status events.

Common webhook `type` values:

* `job_started`
* `summary_generated`
* `job_stopped`
* `error`

### SSE mode

Returns live text events.

Common event names:

* `started`
* `progress`
* `summary`
* `stopped`
* `error`

Treat `stopped` and `error` as terminal events for that stream session.

## Tuning Semantics

* `window_minutes`: coverage duration per summary
* `capture_interval_seconds`: sampling cadence
* `max_windows`: optional cap on total windows

Tune these together with your latency/cost requirements.

## Related

* Tuning patterns: [Tune Monitoring for Latency, Accuracy, and Cost](/guides/configuring-live-digest)
* Job state details: [Get Job Details](/api-reference/jobs-get)
* Workflow chooser: [Choose Your Workflow](/start-here/choose-workflow)


## OpenAPI

````yaml POST /live-digest
openapi: 3.1.0
info:
  title: Trio API
  description: Reality as an API - Monitor YouTube Live streams with vision models
  version: 1.0.0
servers:
  - url: https://trio.machinefi.com/api
security: []
paths:
  /live-digest:
    post:
      tags:
        - Monitoring
      summary: Live Digest
      description: Generate periodic narrative summaries via SSE streaming
      operationId: start_live_digest_live_digest_post
      parameters:
        - name: accept
          in: header
          required: false
          schema:
            type: string
            default: application/json
            title: Accept
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LiveDigestRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JobResponse'
        '400':
          description: Stream offline, invalid URL, or validation failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
            text/plain:
              example: Invalid HTTP request received.
        '422':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - HTTPBearer: []
components:
  schemas:
    LiveDigestRequest:
      properties:
        stream_url:
          type: string
          maxLength: 500
          minLength: 1
          title: Stream Url
          description: YouTube Live URL or RTSP stream to digest
        window_minutes:
          type: integer
          maximum: 60
          minimum: 1
          title: Window Minutes
          description: Time window in minutes
          default: 10
        webhook_url:
          anyOf:
            - type: string
              maxLength: 2083
              minLength: 1
              format: uri
            - type: 'null'
          title: Webhook Url
          description: Webhook URL for notifications
        capture_interval_seconds:
          type: integer
          maximum: 300
          minimum: 10
          title: Capture Interval Seconds
          description: Frame capture interval
          default: 60
        max_windows:
          anyOf:
            - type: integer
              minimum: 1
            - type: 'null'
          title: Max Windows
          description: Stop after N summaries. None = run until max duration
        include_frames:
          type: boolean
          title: Include Frames
          description: Include base64 frame grid in summary events
          default: false
      type: object
      required:
        - stream_url
      title: LiveDigestRequest
      description: Request to start a live digest job (SSE streaming).
    JobResponse:
      properties:
        job_id:
          type: string
          format: uuid
          title: Job Id
        status:
          $ref: '#/components/schemas/JobStatus'
        created_at:
          type: string
          title: Created At
        stream_url:
          type: string
          title: Stream Url
        job_type:
          type: string
          title: Job Type
        details:
          additionalProperties: true
          type: object
          title: Details
          default: {}
        message:
          anyOf:
            - type: string
            - type: 'null'
          title: Message
      type: object
      required:
        - job_id
        - status
        - created_at
        - stream_url
        - job_type
      title: JobResponse
      description: Response containing job information.
    ErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
      type: object
      required:
        - error
      title: ErrorResponse
      description: Wrapper for error responses.
    JobStatus:
      type: string
      enum:
        - pending
        - running
        - stopped
        - completed
        - failed
      title: JobStatus
      description: Job status enum.
    ErrorDetail:
      properties:
        code:
          type: string
          title: Code
        message:
          type: string
          title: Message
        remediation:
          type: string
          title: Remediation
      type: object
      required:
        - code
        - message
        - remediation
      title: ErrorDetail
      description: Standardized error response for better DX.
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````