<?xml version="1.0" encoding="UTF-8"?>
<mxfile host="eli.ai" agent="eli.ai diagram exporter" version="1">
  <diagram id="ports-run-lifecycle-557105ba" name="Ports — run lifecycle">
    <mxGraphModel dx="1600" dy="1200" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1600" pageHeight="1200" math="0" shadow="0">
      <root>
        <mxCell id="0"/>
        <object id="1" label="Ports — run lifecycle" schemaVersion="1" diagramId="ports-run-lifecycle-557105ba" canonicalAppearanceKey="tsx:src/app/(docs)/docs/modules/ports/page.tsx:runLifecycle#1" sourceSha256="557105badae2e01d5307ed1d1ace15ed87dcc2575e8fe842e2e6763210a6390e" metadataPayloadSha256="61dff96855e843b2378a912eaeaa8770f15b5450c6f0312abfa25fe92c7ce113" generationKey="1cab2b2e409b3736acb2811686772901a32f12b57a5d9f2ea231ac3f86b3938e" concepts="[&quot;Run lifecycle&quot;,&quot;Modules&quot;,&quot;Ports&quot;]" keywords="[&quot;model_call / tool_call&quot;,&quot;claim run, persist run_steps&quot;,&quot;Your app&quot;,&quot;GET /runs/{id}/stream&quot;,&quot;replay steps, then poll&quot;,&quot;POST /runs/{id}/approve&quot;,&quot;POST /agents/{slug}/runs&quot;,&quot;admit + persist queued run&quot;,&quot;suspended (approvalId) · stream closes&quot;,&quot;GET /runs/{id}/stream (reattach)&quot;,&quot;final { status, text, citations }&quot;,&quot;Postgres&quot;,&quot;eli.ai&quot;,&quot;/api/v1&quot;,&quot;Worker&quot;]" application="{&quot;name&quot;:&quot;eli-ai&quot;,&quot;version&quot;:&quot;0.1.0&quot;}" packages="{&quot;mermaid&quot;:&quot;11.16.0&quot;,&quot;mermaidCli&quot;:&quot;11.16.0&quot;,&quot;playwright&quot;:&quot;1.62.1&quot;,&quot;playwrightCore&quot;:&quot;1.62.1&quot;,&quot;puppeteer&quot;:&quot;25.6.0&quot;,&quot;puppeteerCore&quot;:&quot;25.6.0&quot;}" environment="{&quot;architecture&quot;:&quot;x64&quot;,&quot;containerImage&quot;:&quot;playwright:v1.62.1-noble@sha256:c091b21d9fae78c76e85cd4356431e9b018402f172a214fc7d7a5e9a7e29d8ac+node:26.3.1-bookworm-slim@sha256:209558c3e5e40e8adff68959d3c2ba7cd73723e716d89196878a0c362fa1e109&quot;,&quot;node&quot;:&quot;v26.3.1&quot;,&quot;platform&quot;:&quot;linux&quot;,&quot;yarn&quot;:&quot;4.17.1&quot;}" renderer="{&quot;browser&quot;:{&quot;executableSha256&quot;:&quot;0b20b130e7edd9dd51873be867761295fe0cfad490c2b9a64f95bd3cfc08fa71&quot;,&quot;name&quot;:&quot;chromium&quot;,&quot;revision&quot;:&quot;1234&quot;,&quot;version&quot;:&quot;151.0.7922.34&quot;},&quot;font&quot;:{&quot;family&quot;:&quot;Eli Diagram Inter Variable&quot;,&quot;fileSha256&quot;:&quot;3100e775e8616cd2611beecfa23a4263d7037586789b43f035236a2e6fbd4c62&quot;,&quot;licenseSha256&quot;:&quot;3b0a5fca3d17942cde889069889dedbbbd075e9b599968c82a95f4d944e9b345&quot;},&quot;mermaidConfigSha256&quot;:&quot;68c10966fe84406ee626034d58bfabd555df9f65f691204b7c46db24038da101&quot;,&quot;themeCssSha256&quot;:&quot;c80287a78d80ad63d27bd5ca348b2ef9a7e2f44da289e436be6484ea28a1b033&quot;}" adapterVersions="{&quot;diagramGenerator&quot;:&quot;2&quot;,&quot;drawioFlowchart&quot;:&quot;1&quot;,&quot;drawioGantt&quot;:&quot;1&quot;,&quot;drawioSequence&quot;:&quot;1&quot;,&quot;drawioState&quot;:&quot;1&quot;}" mermaidType="sequence" generatedAt="2026-08-17T18:36:07.602Z" mermaidSource="sequenceDiagram&#10;  participant App as Your app&#10;  participant API as eli.ai /api/v1&#10;  participant DB as Postgres&#10;  participant Worker&#10;&#10;  App-&gt;&gt;API: POST /agents/{slug}/runs&#10;  API-&gt;&gt;DB: admit + persist queued run&#10;  API--&gt;&gt;App: 202 { runId, status, stream }&#10;  Worker-&gt;&gt;DB: claim run, persist run_steps&#10;  App-&gt;&gt;API: GET /runs/{id}/stream&#10;  API-&gt;&gt;DB: replay steps, then poll&#10;  API--&gt;&gt;App: model_call / tool_call&#10;  alt tool needs a human&#10;    API--&gt;&gt;App: suspended (approvalId) · stream closes&#10;    App-&gt;&gt;API: POST /runs/{id}/approve&#10;    API--&gt;&gt;App: 202 { runId, approvalId, status }&#10;    App-&gt;&gt;API: GET /runs/{id}/stream (reattach)&#10;  else run reaches a terminal status&#10;    API--&gt;&gt;App: final { status, text, citations }&#10;  end">
          <mxCell parent="0"/>
        </object>
        <object id="c:i14" label="alt [tool needs a human] / [run reaches a terminal status]" mermaidId="i14" mermaidShape="frame">
          <mxCell parent="1" vertex="1" style="collapsible=0;container=1;dashed=1;fillColor=none;fontColor=#333333;html=1;recursiveResize=0;rounded=0;strokeColor=#9370DB;whiteSpace=wrap;">
            <mxGeometry x="64" y="425" width="390" height="340" as="geometry"/>
          </mxCell>
        </object>
        <object id="n:Worker" label="Worker" mermaidId="Worker" mermaidShape="participant">
          <mxCell parent="1" vertex="1" style="fillColor=#eaeaea;fontColor=#333333;html=1;participant=umlActor;shape=umlLifeline;strokeColor=#666;whiteSpace=wrap;">
            <mxGeometry x="971" y="0" width="150" height="65" as="geometry"/>
          </mxCell>
        </object>
        <object id="n:DB" label="Postgres" mermaidId="DB" mermaidShape="participant">
          <mxCell parent="1" vertex="1" style="fillColor=#eaeaea;fontColor=#333333;html=1;participant=umlActor;shape=umlLifeline;strokeColor=#666;whiteSpace=wrap;">
            <mxGeometry x="694" y="0" width="150" height="65" as="geometry"/>
          </mxCell>
        </object>
        <object id="n:API" label="eli.ai /api/v1" mermaidId="API" mermaidShape="participant">
          <mxCell parent="1" vertex="1" style="fillColor=#eaeaea;fontColor=#333333;html=1;participant=umlActor;shape=umlLifeline;strokeColor=#666;whiteSpace=wrap;">
            <mxGeometry x="368" y="0" width="150" height="65" as="geometry"/>
          </mxCell>
        </object>
        <object id="n:App" label="Your app" mermaidId="App" mermaidShape="participant">
          <mxCell parent="1" vertex="1" style="fillColor=#eaeaea;fontColor=#333333;html=1;participant=umlActor;shape=umlLifeline;strokeColor=#666;whiteSpace=wrap;">
            <mxGeometry x="0" y="0" width="150" height="65" as="geometry"/>
          </mxCell>
        </object>
        <object id="e:lifeline:Worker" label="" mermaidId="lifeline:Worker" mermaidKind="lifeline">
          <mxCell parent="1" source="n:Worker" target="n:Worker" edge="1" style="dashed=1;dashPattern=4 4;edgeStyle=none;endArrow=none;endFill=0;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#999;strokeWidth=0.5;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="1046" y="65" as="sourcePoint"/>
              <mxPoint x="1046" y="785" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:lifeline:DB" label="" mermaidId="lifeline:DB" mermaidKind="lifeline">
          <mxCell parent="1" source="n:DB" target="n:DB" edge="1" style="dashed=1;dashPattern=4 4;edgeStyle=none;endArrow=none;endFill=0;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#999;strokeWidth=0.5;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="769" y="65" as="sourcePoint"/>
              <mxPoint x="769" y="785" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:lifeline:API" label="" mermaidId="lifeline:API" mermaidKind="lifeline">
          <mxCell parent="1" source="n:API" target="n:API" edge="1" style="dashed=1;dashPattern=4 4;edgeStyle=none;endArrow=none;endFill=0;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#999;strokeWidth=0.5;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="443" y="65" as="sourcePoint"/>
              <mxPoint x="443" y="785" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:lifeline:App" label="" mermaidId="lifeline:App" mermaidKind="lifeline">
          <mxCell parent="1" source="n:App" target="n:App" edge="1" style="dashed=1;dashPattern=4 4;edgeStyle=none;endArrow=none;endFill=0;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#999;strokeWidth=0.5;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="75" y="65" as="sourcePoint"/>
              <mxPoint x="75" y="785" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i0" label="POST /agents/{slug}/runs" mermaidId="i0" mermaidKind="message">
          <mxCell parent="1" source="n:App" target="n:API" edge="1" style="edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="76" y="115" as="sourcePoint"/>
              <mxPoint x="439" y="115" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i1" label="admit + persist queued run" mermaidId="i1" mermaidKind="message">
          <mxCell parent="1" source="n:API" target="n:DB" edge="1" style="edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="444" y="165" as="sourcePoint"/>
              <mxPoint x="765" y="165" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i2" label="202 { runId, status, stream }" mermaidId="i2" mermaidKind="message">
          <mxCell parent="1" source="n:API" target="n:App" edge="1" style="dashed=1;dashPattern=3  3;edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="442" y="215" as="sourcePoint"/>
              <mxPoint x="79" y="215" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i3" label="claim run, persist run_steps" mermaidId="i3" mermaidKind="message">
          <mxCell parent="1" source="n:Worker" target="n:DB" edge="1" style="edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="1045" y="265" as="sourcePoint"/>
              <mxPoint x="773" y="265" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i4" label="GET /runs/{id}/stream" mermaidId="i4" mermaidKind="message">
          <mxCell parent="1" source="n:App" target="n:API" edge="1" style="edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="76" y="315" as="sourcePoint"/>
              <mxPoint x="439" y="315" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i5" label="replay steps, then poll" mermaidId="i5" mermaidKind="message">
          <mxCell parent="1" source="n:API" target="n:DB" edge="1" style="edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="444" y="365" as="sourcePoint"/>
              <mxPoint x="765" y="365" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i6" label="model_call / tool_call" mermaidId="i6" mermaidKind="message">
          <mxCell parent="1" source="n:API" target="n:App" edge="1" style="dashed=1;dashPattern=3  3;edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="442" y="415" as="sourcePoint"/>
              <mxPoint x="79" y="415" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i8" label="suspended (approvalId) · stream closes" mermaidId="i8" mermaidKind="message">
          <mxCell parent="1" source="n:API" target="n:App" edge="1" style="dashed=1;dashPattern=3  3;edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="442" y="510" as="sourcePoint"/>
              <mxPoint x="79" y="510" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i9" label="POST /runs/{id}/approve" mermaidId="i9" mermaidKind="message">
          <mxCell parent="1" source="n:App" target="n:API" edge="1" style="edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="76" y="560" as="sourcePoint"/>
              <mxPoint x="439" y="560" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i10" label="202 { runId, approvalId, status }" mermaidId="i10" mermaidKind="message">
          <mxCell parent="1" source="n:API" target="n:App" edge="1" style="dashed=1;dashPattern=3  3;edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="442" y="610" as="sourcePoint"/>
              <mxPoint x="79" y="610" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i11" label="GET /runs/{id}/stream (reattach)" mermaidId="i11" mermaidKind="message">
          <mxCell parent="1" source="n:App" target="n:API" edge="1" style="edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="76" y="660" as="sourcePoint"/>
              <mxPoint x="439" y="660" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
        <object id="e:i13" label="final { status, text, citations }" mermaidId="i13" mermaidKind="message">
          <mxCell parent="1" source="n:API" target="n:App" edge="1" style="dashed=1;dashPattern=3  3;edgeStyle=none;endArrow=block;endFill=1;html=1;jettySize=auto;orthogonalLoop=1;rounded=0;strokeColor=#333333;strokeWidth=2;">
            <mxGeometry relative="1" as="geometry">
              <mxPoint x="442" y="755" as="sourcePoint"/>
              <mxPoint x="79" y="755" as="targetPoint"/>
            </mxGeometry>
          </mxCell>
        </object>
      </root>
    </mxGraphModel>
  </diagram>
</mxfile>
