asyncapi: "3.0.0"
info:
  title: "PlatPhorm AgentUI Events"
  version: "0.1.0"
  description: "Public-safe event contract for AgentUI workflow, run, step, artifact, approval, delegation, and integration state updates. Private payloads and protected tool results are redacted or omitted."
servers:
  agentui:
    host: "agentui.platphormnews.com"
    protocol: "https"
    pathname: "/api/v1/runs/{runId}/events"
channels:
  agentui/workflows/{workflowId}/events:
    address: "agentui/{workflowId}/events"
    messages:
      agentUiEvent:
        $ref: "#/components/messages/agentUiEvent"
  agentui/runs/{runId}/events:
    address: "agentui/{runId}/events"
    messages:
      agentUiEvent:
        $ref: "#/components/messages/agentUiEvent"
  agentui/delegations/{delegationId}/events:
    address: "agentui/{delegationId}/events"
    messages:
      agentUiEvent:
        $ref: "#/components/messages/agentUiEvent"
  agentui/integrations/{serviceId}/events:
    address: "agentui/{serviceId}/events"
    messages:
      agentUiEvent:
        $ref: "#/components/messages/agentUiEvent"
operations:
  agentui.workflow.created:
    action: "send"
    channel:
      $ref: "#/channels/agentui~1workflows~1{workflowId}~1events"
    messages:
      - $ref: "#/components/messages/agentUiEvent"
  agentui.workflow.updated:
    action: "send"
    channel:
      $ref: "#/channels/agentui~1workflows~1{workflowId}~1events"
    messages:
      - $ref: "#/components/messages/agentUiEvent"
  agentui.workflow.validated:
    action: "send"
    channel:
      $ref: "#/channels/agentui~1workflows~1{workflowId}~1events"
    messages:
      - $ref: "#/components/messages/agentUiEvent"
  agentui.workflow.planned:
    action: "send"
    channel:
      $ref: "#/channels/agentui~1workflows~1{workflowId}~1events"
    messages:
      - $ref: "#/components/messages/agentUiEvent"
  agentui.workflow.run.requested:
    action: "send"
    channel:
      $ref: "#/channels/agentui~1workflows~1{workflowId}~1events"
    messages:
      - $ref: "#/components/messages/agentUiEvent"
  agentui.workflow.run.started:
    action: "send"
    channel:
      $ref: "#/channels/agentui~1workflows~1{workflowId}~1events"
    messages:
      - $ref: "#/components/messages/agentUiEvent"
  agentui.workflow.run.completed:
    action: "send"
    channel:
      $ref: "#/channels/agentui~1workflows~1{workflowId}~1events"
    messages:
      - $ref: "#/components/messages/agentUiEvent"
  agentui.workflow.run.failed:
    action: "send"
    channel:
      $ref: "#/channels/agentui~1workflows~1{workflowId}~1events"
    messages:
      - $ref: "#/components/messages/agentUiEvent"
  agentui.run.step.started:
    action: "send"
    channel:
      $ref: "#/channels/agentui~1runs~1{runId}~1events"
    messages:
      - $ref: "#/components/messages/agentUiEvent"
  agentui.run.step.completed:
    action: "send"
    channel:
      $ref: "#/channels/agentui~1runs~1{runId}~1events"
    messages:
      - $ref: "#/components/messages/agentUiEvent"
  agentui.artifact.created:
    action: "send"
    channel:
      $ref: "#/channels/agentui~1integrations~1{serviceId}~1events"
    messages:
      - $ref: "#/components/messages/agentUiEvent"
  agentui.approval.requested:
    action: "send"
    channel:
      $ref: "#/channels/agentui~1integrations~1{serviceId}~1events"
    messages:
      - $ref: "#/components/messages/agentUiEvent"
  agentui.approval.approved:
    action: "send"
    channel:
      $ref: "#/channels/agentui~1integrations~1{serviceId}~1events"
    messages:
      - $ref: "#/components/messages/agentUiEvent"
  agentui.approval.rejected:
    action: "send"
    channel:
      $ref: "#/channels/agentui~1integrations~1{serviceId}~1events"
    messages:
      - $ref: "#/components/messages/agentUiEvent"
  agentui.delegation.created:
    action: "send"
    channel:
      $ref: "#/channels/agentui~1delegations~1{delegationId}~1events"
    messages:
      - $ref: "#/components/messages/agentUiEvent"
  agentui.delegation.sent:
    action: "send"
    channel:
      $ref: "#/channels/agentui~1delegations~1{delegationId}~1events"
    messages:
      - $ref: "#/components/messages/agentUiEvent"
  agentui.delegation.accepted:
    action: "send"
    channel:
      $ref: "#/channels/agentui~1delegations~1{delegationId}~1events"
    messages:
      - $ref: "#/components/messages/agentUiEvent"
  agentui.delegation.completed:
    action: "send"
    channel:
      $ref: "#/channels/agentui~1delegations~1{delegationId}~1events"
    messages:
      - $ref: "#/components/messages/agentUiEvent"
  agentui.delegation.failed:
    action: "send"
    channel:
      $ref: "#/channels/agentui~1delegations~1{delegationId}~1events"
    messages:
      - $ref: "#/components/messages/agentUiEvent"
  agentui.integration.degraded:
    action: "send"
    channel:
      $ref: "#/channels/agentui~1integrations~1{serviceId}~1events"
    messages:
      - $ref: "#/components/messages/agentUiEvent"
  agentui.integration.recovered:
    action: "send"
    channel:
      $ref: "#/channels/agentui~1integrations~1{serviceId}~1events"
    messages:
      - $ref: "#/components/messages/agentUiEvent"
components:
  messages:
    agentUiEvent:
      name: "AgentUiEvent"
      title: "AgentUI Event"
      headers:
        type: "object"
        properties:
          traceparent:
            type: "string"
          tracestate:
            type: "string"
          X-PlatPhorm-Trace-Id:
            type: "string"
          X-PlatPhorm-Span-Id:
            type: "string"
          X-PlatPhorm-Request-Id:
            type: "string"
        additionalProperties: false
      payload:
        type: "object"
        properties:
          schemaVersion:
            type: "string"
            const: "agentui.event.v1"
          event:
            type: "string"
            enum:
              - "agentui.workflow.created"
              - "agentui.workflow.updated"
              - "agentui.workflow.validated"
              - "agentui.workflow.planned"
              - "agentui.workflow.run.requested"
              - "agentui.workflow.run.started"
              - "agentui.workflow.run.completed"
              - "agentui.workflow.run.failed"
              - "agentui.run.step.started"
              - "agentui.run.step.completed"
              - "agentui.artifact.created"
              - "agentui.approval.requested"
              - "agentui.approval.approved"
              - "agentui.approval.rejected"
              - "agentui.delegation.created"
              - "agentui.delegation.sent"
              - "agentui.delegation.accepted"
              - "agentui.delegation.completed"
              - "agentui.delegation.failed"
              - "agentui.integration.degraded"
              - "agentui.integration.recovered"
          workflowId:
            type: "string"
          runId:
            type: "string"
          stepId:
            type: "string"
          delegationId:
            type: "string"
          serviceId:
            type: "string"
          status:
            type: "string"
          source:
            type: "string"
          publicSafe:
            type: "boolean"
          degraded:
            type: "boolean"
          message:
            type: "string"
          trace:
            $ref: "#/components/schemas/TraceContext"
          generatedAt:
            type: "string"
            format: "date-time"
        required:
          - "schemaVersion"
          - "event"
          - "publicSafe"
          - "degraded"
          - "generatedAt"
        additionalProperties: false
  schemas:
    TraceContext:
      type: "object"
      properties:
        traceId:
          type: "string"
        spanId:
          type: "string"
        parentSpanId:
          type: "string"
        traceparent:
          type: "string"
        tracestate:
          type: "string"
        traceUrl:
          type: "string"
          format: "uri"
      additionalProperties: false
x-agentui-policy:
  protectedEvents: "Protected event payloads omit private workflow input, protected tool arguments, protected tool results, secrets, cookies, raw IPs, raw JA4, and raw x-vercel-ja4-digest."
  authBoundary: "PLATPHORM_API_KEY is required for protected event-producing mutations and remote execution."
