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

# Stream Events

> Subscribe to a Server-Sent Events (SSE) stream of agent lifecycle events.

The stream replays retained historical events after the cursor, then
delivers live events as they occur. Events are delivered at-least-once;
clients should deduplicate by event `id`.

Use the `after` query parameter or `Last-Event-ID` header to resume
from a previous position. If the cursor is older than the earliest
retained event, the server returns `410 Gone`.




## OpenAPI

````yaml /references/device-api/v0.2.1/api.yaml get /events
openapi: 3.0.3
info:
  title: Miru Agent API
  description: >-
    The API between the Miru Agent and any external client living on the same
    device as the Miru Agent
  version: v0.2
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
  x-release-version: v0.2.1
  x-git-commit:
    sha: 10dc72e22958a4851e7f6718f5b7542b0c7f62e1
    url: >-
      https://github.com/mirurobotics/openapi/commit/10dc72e22958a4851e7f6718f5b7542b0c7f62e1
    message: |-
      feat(lint): add x-summary to event schemas and enforce via MIRU024 (#15)

      ## Summary

      - Add `x-summary` extension field and richer `description` to all
      `*Event` data schemas (`DeploymentDeployedEvent`,
      `DeploymentRemovedEvent`, `ValidateDeploymentEvent`)
      - Add MIRU024 lint rule (`event_schema_x_summary_required`) that
      enforces `x-summary` on all `*Event` schemas (excluding the `Event`
      envelope)
      - Add 3 test fixtures and test class for MIRU024 (197 tests pass, 99%
      coverage)

      The `x-summary` field is consumed by the docs codegen
      (`docs/api/generate_event_pages.py`) as the page subtitle, while
      `description` provides the longer inline body text. This makes generated
      event type reference pages more useful.

      ## Test plan

      - [x] `./tools/lint/test.sh` — 197 tests pass
      - [x] `./tools/lint/covgate.sh` — 99% coverage (gate: 98%)
      - [x] `./scripts/lint.sh` — all custom MIRU rules and Redocly clean
      - [x] MIRU024 fires on `*Event` schema missing `x-summary`
      - [x] MIRU024 passes when `x-summary` is present
      - [x] MIRU024 exempts the `Event` envelope schema

      🤖 Generated with [Claude Code](https://claude.com/claude-code)

      ---------

      Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
    author: ben-miru
    branch: HEAD
    dirty: false
  x-build:
    built_at: '2026-04-06T19:21:53.148075+00:00'
servers:
  - url: http://localhost/v0.2
    description: localhost
security: []
paths:
  /events:
    get:
      tags:
        - Events
      summary: Stream Events
      description: >
        Subscribe to a Server-Sent Events (SSE) stream of agent lifecycle
        events.


        The stream replays retained historical events after the cursor, then

        delivers live events as they occur. Events are delivered at-least-once;

        clients should deduplicate by event `id`.


        Use the `after` query parameter or `Last-Event-ID` header to resume

        from a previous position. If the cursor is older than the earliest

        retained event, the server returns `410 Gone`.
      operationId: streamEvents
      parameters:
        - name: after
          in: query
          required: false
          description: >-
            Event ID cursor. Only events with `id` greater than this value are
            returned. Takes precedence over the `Last-Event-ID` header.
          schema:
            type: integer
            format: int64
          example: 42
        - name: types
          in: query
          required: false
          description: Event types to receive. If omitted, all event types are sent.
          style: form
          explode: false
          schema:
            type: array
            items:
              type: string
          example:
            - deployment.deployed
            - deployment.removed
        - name: Last-Event-ID
          in: header
          required: false
          description: >-
            Standard SSE reconnection header. Used as the replay cursor if
            `after` query parameter is not provided.
          schema:
            type: string
          example: '42'
      responses:
        '200':
          description: >-
            SSE event stream. Each event is delivered as an SSE frame with `id`,
            `event`, and `data` fields.
          content:
            text/event-stream:
              schema:
                $ref: '#/components/schemas/Event'
      x-codeSamples:
        - lang: curl
          source: |-
            curl \
              --no-buffer \
              --unix-socket /run/miru/miru.sock \
              --request GET \
              --url http://localhost/v0.2/events
components:
  schemas:
    Event:
      title: Event
      type: object
      required:
        - object
        - id
        - type
        - occurred_at
        - data
      properties:
        object:
          type: string
          enum:
            - event
          x-stainless-const: true
          description: The object type, which is always `event`.
          example: event
        id:
          type: integer
          format: int64
          description: >-
            Monotonically increasing event ID. Used as the SSE `id` field and
            for replay cursors.
          example: 42
        type:
          type: string
          description: Event type string in the format `{resource}.{action}`.
          example: deployment.deployed
        occurred_at:
          type: string
          format: date-time
          description: Timestamp of when the event occurred.
          example: '2026-03-10T12:00:00Z'
        data:
          type: object
          description: Event-specific payload. Shape varies by event type.
      example:
        object: event
        id: 42
        type: deployment.deployed
        occurred_at: '2026-03-10T12:00:00Z'
        data:
          deployment_id: dpl_123
          release_id: rls_123
          status: deployed
          activity_status: deployed
          error_status: none
          target_status: deployed
          deployed_at: '2026-03-10T12:00:00Z'

````