{
  "schemaVersion": "1.0",
  "id": "multi-agent-workflow",
  "title": "Multi-agent workflow diagram",
  "slug": "multi-agent-workflow",
  "diagramFamily": "workflow",
  "goal": "Document a multi-agent triage workflow as an executable BPMN-style diagram. The diagram is generated from the agent-orchestration configuration (declarative - typically a YAML file describing classifiers, tools, gateways, and human-in-the-loop checkpoints) and stays in sync as the orchestration evolves.",
  "inputs": [
    "Agent orchestration configuration file (e.g. agents/triage.yaml describing the classifier, downstream agents, gateway conditions, and human-review steps)",
    "Existing Zindex scene id",
    "Zindex API key"
  ],
  "outputs": [
    "Updated persisted scene with one workflow node per orchestration step (start event, classifier task, gateways, downstream agents, human-reviewer task, terminate events)",
    "Rendered BPMN-style SVG suitable for embedding in onboarding docs and runbooks",
    "Revision history showing how the orchestration policy has evolved (added a fast-path gateway, raised the auto-approve threshold, added human review for complex cases)"
  ],
  "mcpTools": [
    "dsp_create_scene",
    "dsp_apply_ops",
    "dsp_validate_scene",
    "dsp_render_scene"
  ],
  "httpEndpoints": [
    "POST /v1/scenes",
    "POST /v1/scenes/:id/applyOps",
    "POST /v1/scenes/:id/render"
  ],
  "steps": [
    {
      "id": "fetch_scene",
      "label": "Fetch the persisted scene",
      "description": "Workflow scenes are long-lived. Fetch the current revision before deriving anything new.",
      "mcp": "dsp_get_scene",
      "http": {
        "method": "GET",
        "path": "/v1/scenes/${SCENE_ID}"
      }
    },
    {
      "id": "parse_orchestration",
      "label": "Parse the orchestration configuration",
      "description": "Read agents/triage.yaml. Each entry describes one orchestration step: task type (`classifier`, `agent`, `human-review`, `gateway`, `terminate`), inputs, outputs, gateway conditions. The YAML is structured precisely so that one entry maps to one workflow element.",
      "mcp": null,
      "http": null
    },
    {
      "id": "diff_against_scene",
      "label": "Compute the operation diff",
      "description": "For each orchestration step, ensure a node exists with the right `nodeType`: `workflow.messageStart` for the entrypoint, `workflow.task` for tasks, `workflow.gateway` (or one of the gateway* variants) for branching points, `workflow.terminate` for terminal failure paths, `workflow.messageEnd` for the success completion. For each transition, ensure an edge exists with `edgeType: workflow.sequenceFlow` and a label for any condition (e.g. 'simple', 'complex', 'needs review').",
      "mcp": null,
      "http": null
    },
    {
      "id": "apply_ops",
      "label": "Apply the operation batch",
      "description": "One applyOps batch with errorPolicy=allOrNothing. The revisionMessage should describe the policy change: 'add fast-path gateway: simple cases skip human review' is meaningful months later, where 'orchestration update' is not.",
      "mcp": "dsp_apply_ops",
      "http": {
        "method": "POST",
        "path": "/v1/scenes/${SCENE_ID}/ops"
      }
    },
    {
      "id": "validate",
      "label": "Validate the workflow scene",
      "description": "Confirm BPMN semantics: every gateway has at least two outgoing edges, every messageStart has at least one outgoing edge, every messageEnd has at least one incoming edge. The platform validates these automatically against the workflow diagram family.",
      "mcp": "dsp_validate_scene",
      "http": {
        "method": "POST",
        "path": "/v1/scenes/validate"
      }
    },
    {
      "id": "render",
      "label": "Render the workflow diagram",
      "description": "Render to SVG. The hierarchical LR layout naturally separates the start event, branching gateways, parallel paths, and terminate events - readable left-to-right as a process. Embed the rendered SVG in the agent runbook so on-call engineers can see what the orchestration is supposed to do without reading YAML.",
      "mcp": "dsp_render_scene",
      "http": {
        "method": "POST",
        "path": "/v1/scenes/${SCENE_ID}/render"
      }
    },
    {
      "id": "publish_to_runbook",
      "label": "Publish the diagram to the agent runbook",
      "description": "Drop the rendered SVG into the runbook directory. When the agent system pages on-call (because a gateway threshold was crossed or human review queue is backed up), the runbook now includes the canonical orchestration diagram pinned to the deployed revision.",
      "mcp": null,
      "http": null
    }
  ]
}