<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Pavel Ravvich</title>
    <description>The latest articles on DEV Community by Pavel Ravvich (@pravvich).</description>
    <link>https://dev.to/pravvich</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4145248%2Fb60b247d-a5a1-4e0b-982f-adcdaf613578.png</url>
      <title>DEV Community: Pavel Ravvich</title>
      <link>https://dev.to/pravvich</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pravvich"/>
    <language>en</language>
    <item>
      <title>Exactly-Once Effects for AI Agents: The Zombie Worker Problem</title>
      <dc:creator>Pavel Ravvich</dc:creator>
      <pubDate>Wed, 28 Oct 2026 13:58:21 +0000</pubDate>
      <link>https://dev.to/pravvich/exactly-once-effects-for-ai-agents-the-zombie-worker-problem-2fa</link>
      <guid>https://dev.to/pravvich/exactly-once-effects-for-ai-agents-the-zombie-worker-problem-2fa</guid>
      <description>&lt;p&gt;&lt;em&gt;At-least-once execution. Idempotent side effects. And a worker that came back from the dead.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/hacktoberfest-week4-2026-10-26"&gt;Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhhalrcp6lqwt5vl0hddv.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhhalrcp6lqwt5vl0hddv.gif" alt="Zombie Worker Recovery Demo" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Your AI Agent Just Executed Twice. What Could Go Wrong?
&lt;/h3&gt;

&lt;p&gt;Imagine an AI agent processing a customer refund.&lt;/p&gt;

&lt;p&gt;It receives a request, examines the circumstances, approves a $100 refund, and calls a payment tool.&lt;/p&gt;

&lt;p&gt;The payment provider successfully processes the refund.&lt;/p&gt;

&lt;p&gt;Then the worker crashes — before the workflow can save its checkpoint.&lt;/p&gt;

&lt;p&gt;The recovery system discovers an unfinished step and executes it again.&lt;/p&gt;

&lt;p&gt;The agent calls the payment tool a second time.&lt;/p&gt;

&lt;p&gt;The customer receives another $100.&lt;/p&gt;

&lt;p&gt;From the workflow engine's perspective, nothing particularly strange happened. The step wasn't recorded as completed, so it had to be retried.&lt;/p&gt;

&lt;p&gt;But from the business's perspective, we just lost $100.&lt;/p&gt;

&lt;p&gt;This is one of the most important problems to solve when moving AI agents from prototypes into production:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Retrying an AI agent is easy. Retrying it without duplicating its side effects is the hard part.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;And it isn't limited to payments.&lt;/p&gt;

&lt;p&gt;AI agents create orders, send emails, update CRM records, publish documents, modify infrastructure, and call external APIs. In all these cases, successfully completing a workflow is only half the problem.&lt;/p&gt;

&lt;p&gt;We also need to know what happens when the same work is executed more than once.&lt;/p&gt;

&lt;p&gt;Distributed systems engineers know this problem as the distinction between &lt;em&gt;at-least-once execution&lt;/em&gt; and &lt;em&gt;exactly-once effects&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;For AI agents, the distinction becomes especially important because recovery may repeat model calls, tool invocations, or entire sequences of actions.&lt;/p&gt;

&lt;p&gt;I wanted to explore this problem experimentally using &lt;a href="https://github.com/agbossjs/agboss" rel="noopener noreferrer"&gt;AGBoss&lt;/a&gt;, an open-source TypeScript framework I'm developing on top of LangGraph.&lt;/p&gt;

&lt;p&gt;The result is &lt;a href="https://github.com/agbossjs/distributed-agent-recovery" rel="noopener noreferrer"&gt;&lt;strong&gt;Distributed Agent Recovery&lt;/strong&gt;&lt;/a&gt;, a reproducible showcase built for the Hacktoberfest &lt;em&gt;Ghost in the Machine&lt;/em&gt; challenge.&lt;/p&gt;

&lt;p&gt;We'll freeze a worker halfway through a task, let another worker take over, and then bring the original worker back to life.&lt;/p&gt;

&lt;p&gt;The question is simple:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can a zombie worker corrupt an operation that another worker has already completed?&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  At-Least-Once Execution Is Not Exactly-Once Effects
&lt;/h3&gt;

&lt;p&gt;Consider a distributed workflow that executes steps and persists checkpoints.&lt;/p&gt;

&lt;p&gt;If a process crashes between performing an external operation and committing the next checkpoint, the runtime may not know whether the operation succeeded.&lt;/p&gt;

&lt;p&gt;From its perspective, the step is unfinished.&lt;/p&gt;

&lt;p&gt;So recovery may execute it again.&lt;/p&gt;

&lt;p&gt;This is a normal consequence of at-least-once execution.&lt;/p&gt;

&lt;p&gt;The same &lt;code&gt;execute()&lt;/code&gt; function might run twice. But that doesn't necessarily mean the underlying business operation must happen twice.&lt;/p&gt;

&lt;p&gt;For example, if a payment provider accepts the same idempotency key on both requests and atomically deduplicates them, the second request can return the original result without processing another payment.&lt;/p&gt;

&lt;p&gt;There are four important concepts here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;At-least-once execution:&lt;/strong&gt; A step may execute multiple times after failures.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Exactly-once effect:&lt;/strong&gt; A logical external operation changes external state once.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Idempotency:&lt;/strong&gt; Repeating the same operation doesn't produce an additional effect.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fencing:&lt;/strong&gt; A worker that has lost ownership cannot commit stale writes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The last two mechanisms solve different problems.&lt;/p&gt;

&lt;p&gt;Idempotency protects against repeated operations.&lt;/p&gt;

&lt;p&gt;Fencing protects against stale workers that continue running after their work has been reassigned.&lt;/p&gt;

&lt;p&gt;In practice, we often need both.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why an Idempotency Key Alone Isn't Enough
&lt;/h3&gt;

&lt;p&gt;Suppose two workers try to perform the same operation concurrently.&lt;/p&gt;

&lt;p&gt;Both check whether &lt;code&gt;payment-123&lt;/code&gt; has already been processed.&lt;/p&gt;

&lt;p&gt;Both see that it hasn't.&lt;/p&gt;

&lt;p&gt;Both send the payment.&lt;/p&gt;

&lt;p&gt;If deduplication isn't enforced atomically with the operation, the presence of an idempotency key doesn't prevent anything.&lt;/p&gt;

&lt;p&gt;Now consider a different race.&lt;/p&gt;

&lt;p&gt;Worker A begins a long-running action. Its lease expires. Worker B takes ownership, completes the work, and commits a newer state.&lt;/p&gt;

&lt;p&gt;Then Worker A wakes up and attempts to write its old result.&lt;/p&gt;

&lt;p&gt;Even if we use stable idempotency keys, we still need to determine whether Worker A is authorized to write.&lt;/p&gt;

&lt;p&gt;That's what fencing is for.&lt;/p&gt;

&lt;p&gt;AGBoss provides deterministic step idempotency keys, execution leases, checkpoint recovery, and protection against stale checkpoint writes.&lt;/p&gt;

&lt;p&gt;The external application must complement those mechanisms with atomic deduplication and fencing at the side-effect boundary.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The goal of this project is to demonstrate how these mechanisms work together under actual process failures — not merely describe them in documentation.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The Experiment: A Distributed AI Release Factory
&lt;/h3&gt;

&lt;p&gt;For the showcase, I built a small AI-assisted software release pipeline.&lt;/p&gt;

&lt;p&gt;It prepares a release containing three modules:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;auth-service&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;payment-engine&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;telemetry-collector&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A coordinator decomposes the release into independent tasks and distributes them across multiple AGBoss instances.&lt;/p&gt;

&lt;p&gt;Each child workflow prepares module metadata, stages an artifact, and records the operation in shared storage.&lt;/p&gt;

&lt;p&gt;After the child workflows finish, the coordinator runs an integration smoke gate and, if verification passes, promotes the release.&lt;/p&gt;

&lt;p&gt;If verification fails, an AI agent analyzes the diagnostic information and proposes a corrected release plan.&lt;/p&gt;

&lt;p&gt;We deliberately inject two different failures.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Failure 1 — Partial commit:&lt;/strong&gt; All three artifacts are staged, but the final integration check fails. We need to compensate the already completed operations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Failure 2 — Zombie worker:&lt;/strong&gt; A worker freezes halfway through a task. Another worker takes over and finishes it. The original worker later resumes and attempts a stale write.&lt;/p&gt;

&lt;p&gt;The first scenario demonstrates Saga compensation.&lt;/p&gt;

&lt;p&gt;The second demonstrates checkpoint recovery, idempotency, and lease fencing.&lt;/p&gt;

&lt;p&gt;They solve different problems, and it's important not to confuse them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhhalrcp6lqwt5vl0hddv.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhhalrcp6lqwt5vl0hddv.gif" alt="Zombie Worker Recovery Demo" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The demo runs a distributed AI release coordinator and two independent worker processes.&lt;/p&gt;

&lt;p&gt;It deliberately fails an integration gate, performs Saga compensation, invokes a real LLM recovery agent, and launches a corrected second attempt.&lt;/p&gt;

&lt;p&gt;During the second attempt, one worker is frozen with a real operating-system &lt;code&gt;SIGSTOP&lt;/code&gt; signal.&lt;/p&gt;

&lt;p&gt;After its execution lease expires, another worker recovers the exact same child execution from its checkpoint.&lt;/p&gt;

&lt;p&gt;Then the frozen worker receives &lt;code&gt;SIGCONT&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The zombie wakes up and attempts to commit its stale result.&lt;/p&gt;

&lt;p&gt;The application ledger rejects its external write. AGBoss rejects its stale checkpoint.&lt;/p&gt;

&lt;p&gt;The replacement worker's result remains intact.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Actually Happened
&lt;/h3&gt;

&lt;p&gt;In the recorded live experiment:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The coordinator started two independent worker processes.&lt;/li&gt;
&lt;li&gt;The initial release attempt staged three artifacts.&lt;/li&gt;
&lt;li&gt;The smoke gate failed because a required compatibility flag was missing.&lt;/li&gt;
&lt;li&gt;Saga compensation removed all three failed-attempt staging artifacts.&lt;/li&gt;
&lt;li&gt;The LLM recovery agent inspected the failure and produced corrected build flags.&lt;/li&gt;
&lt;li&gt;During Attempt 2, the &lt;code&gt;payment-engine&lt;/code&gt; worker froze after completing Step 1.&lt;/li&gt;
&lt;li&gt;Another worker took over after the real 30-second lease expired.&lt;/li&gt;
&lt;li&gt;The replacement resumed the same child execution under &lt;code&gt;leaseEpoch = 2&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The original worker woke up holding stale &lt;code&gt;leaseEpoch = 1&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Both the external stale write and the stale checkpoint write were rejected.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The central recovery used this child execution ID:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;f9907abf-19fd-498b-8397-49152e25345f&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The ID remained unchanged across takeover.&lt;/p&gt;

&lt;p&gt;That distinction matters: the replacement worker didn't start a separate task with the same input. It recovered the original execution from its committed checkpoint.&lt;/p&gt;

&lt;h3&gt;
  
  
  Verified Results
&lt;/h3&gt;

&lt;p&gt;The showcase includes an independent invariant verifier that examines the filesystem, the application's SQLite ledger, and AGBoss's internal execution tables.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Verification&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Independent worker processes&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Original lease epoch&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Lease epoch after takeover&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Child execution ID&lt;/td&gt;
&lt;td&gt;Preserved&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Checkpoints in recovered execution&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Competing checkpoint branches&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Orphaned child queue entries&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Active artifacts from failed attempt&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Successfully promoted modules&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Verified invariants&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;8/8&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The checkpoint result is particularly interesting.&lt;/p&gt;

&lt;p&gt;All six checkpoints for the recovered child execution form a single linear chain through their &lt;code&gt;parent_checkpoint_id&lt;/code&gt; relationships.&lt;/p&gt;

&lt;p&gt;There is no competing checkpoint branch committed by the zombie.&lt;/p&gt;

&lt;p&gt;Meanwhile, the execution lease table confirms that ownership advanced to epoch &lt;code&gt;2&lt;/code&gt; and the replacement worker became the valid owner.&lt;/p&gt;

&lt;p&gt;We're not merely verifying that the workflow eventually completed.&lt;/p&gt;

&lt;p&gt;We're verifying that recovery didn't leave competing persisted states or duplicated committed artifacts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Recorded evidence:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/agbossjs/distributed-agent-recovery/blob/main/docs/evidence/live-real-clock-cluster-run.json" rel="noopener noreferrer"&gt;Live real-clock execution report&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/agbossjs/distributed-agent-recovery/blob/main/docs/evidence/live-real-clock-cluster-runtime.log" rel="noopener noreferrer"&gt;Runtime log with recovery events&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/agbossjs/distributed-agent-recovery/actions/runs/40633290740" rel="noopener noreferrer"&gt;GitHub Actions verification run&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What About a Real Container Crash?
&lt;/h3&gt;

&lt;p&gt;We use &lt;code&gt;SIGSTOP&lt;/code&gt; and &lt;code&gt;SIGCONT&lt;/code&gt; to demonstrate the zombie-worker problem because the original worker needs to come back.&lt;/p&gt;

&lt;p&gt;But we also tested a more conventional failure: a Docker worker container terminating abruptly in the middle of a step.&lt;/p&gt;

&lt;p&gt;In this case, the original worker never returns.&lt;/p&gt;

&lt;p&gt;The surviving worker must wait for lease expiration, reclaim the execution, and continue from the last checkpoint.&lt;/p&gt;

&lt;p&gt;This scenario is covered by a separate GitHub Actions CI job.&lt;/p&gt;

&lt;p&gt;The repository also runs the recovery application in three environments:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Independent Node.js processes sharing a local SQLite database.&lt;/li&gt;
&lt;li&gt;Docker Compose containers with a shared volume, including hard worker-crash testing.&lt;/li&gt;
&lt;li&gt;A single-node Kubernetes &lt;code&gt;kind&lt;/code&gt; cluster with two worker pods and a coordinator Job.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All three CI verification jobs passed in the recorded GitHub Actions run.&lt;/p&gt;

&lt;p&gt;These are separate operating-system processes and containers performing real recovery — not predetermined log sequences.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;p&gt;The entire application is open source and available on GitHub:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/agbossjs/distributed-agent-recovery" rel="noopener noreferrer"&gt;agbossjs/distributed-agent-recovery&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The AGBoss framework itself is also open source:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/agbossjs/agboss" rel="noopener noreferrer"&gt;agbossjs/agboss&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Run the Demo Locally
&lt;/h3&gt;

&lt;p&gt;You'll need Node.js 22.13+ and npm.&lt;/p&gt;

&lt;p&gt;The default tests and demos use a deterministic offline model transport, so no LLM API key is required.&lt;/p&gt;

&lt;p&gt;The commands below are documented in the &lt;a href="https://github.com/agbossjs/distributed-agent-recovery/blob/main/README.md" rel="noopener noreferrer"&gt;showcase README&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/agbossjs/distributed-agent-recovery.git
&lt;span class="nb"&gt;cd &lt;/span&gt;distributed-agent-recovery

npm ci
npm run check
npm &lt;span class="nb"&gt;test
&lt;/span&gt;npm run demo:cluster
npm run verify
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To reproduce the real-clock experiment with an actual OS process freeze:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run build
node dist/src/demo.js &lt;span class="nt"&gt;--cluster&lt;/span&gt; &lt;span class="nt"&gt;--real-clock&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To run with live OpenRouter inference:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;OPENROUTER_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"..."&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  node dist/src/demo.js &lt;span class="nt"&gt;--cluster&lt;/span&gt; &lt;span class="nt"&gt;--live&lt;/span&gt; &lt;span class="nt"&gt;--real-clock&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To run the containerized version:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run demo:compose
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The repository includes the workflow implementation, fault-injection scenarios, Docker and Kubernetes configurations, automated tests, and recorded execution evidence.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I Built It
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Open-Source AI Stack
&lt;/h3&gt;

&lt;p&gt;The project combines open-source orchestration with a live LLM recovery agent.&lt;/p&gt;

&lt;p&gt;Its main components are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AGBoss&lt;/strong&gt; — the open-source TypeScript framework providing declarative agent workflows, dependency injection, static validation, leases, checkpoint recovery, and execution coordination.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LangGraph&lt;/strong&gt; — the underlying workflow execution and checkpointing foundation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenRouter&lt;/strong&gt; — the inference gateway used for the live LLM experiment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;openai/gpt-4o-mini&lt;/code&gt;&lt;/strong&gt; — the model used by the recovery-planning agent.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SQLite WAL&lt;/strong&gt; — the shared local database used for execution coordination and the application's transactional artifact ledger.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker Compose and Kubernetes kind&lt;/strong&gt; — deployment environments used to verify recovery across isolated workers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The AI model itself is accessed through an external API; this showcase does not claim to run an open-weight model locally.&lt;/p&gt;

&lt;p&gt;The open-source contribution is the agent framework, its inspectable execution machinery, and the reproducible fault-injection application built around them.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Declarative Distributed Workflows
&lt;/h3&gt;

&lt;p&gt;AGBoss uses a declarative, typed workflow DSL.&lt;/p&gt;

&lt;p&gt;Rather than manually assigning tasks to particular workers, the coordinator declares a parallel child-workflow operation with &lt;code&gt;ChildPlacement.AnyInstance&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Here is an excerpt from &lt;a href="https://github.com/agbossjs/distributed-agent-recovery/blob/main/src/workflows/release-coordinator/release-coordinator.workflow.ts" rel="noopener noreferrer"&gt;ReleaseCoordinatorWorkflow&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nf"&gt;start&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ReleaseCoordinatorWorkflowStart&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;returns&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ReleaseRequestDto&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toAction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;DecomposeReleaseTasksAction&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;returns&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;listOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ModuleTaskDto&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toParallelWorkflows&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ModuleWorkerWorkflow&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;maxConcurrency&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;maxItems&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;placement&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ChildPlacement&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;AnyInstance&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;returns&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nf"&gt;listOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="nf"&gt;oneOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;StagedModuleArtifactDto&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ModuleFailedDto&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toAction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;LockReleaseCandidateAction&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The coordinator doesn't need to know whether Worker A or Worker B will execute a particular module.&lt;/p&gt;

&lt;p&gt;AGBoss coordinates child executions through shared repositories, leases, and checkpoints.&lt;/p&gt;

&lt;p&gt;The DSL makes input/output contracts and concurrency constraints explicit. The &lt;code&gt;agboss check&lt;/code&gt; command statically validates workflow composition, DTO transitions, dependency injection bindings, and other declared constraints before invoking an LLM.&lt;/p&gt;

&lt;p&gt;Static verification doesn't replace integration testing or fault injection. But it catches composition errors independently of distributed runtime failures.&lt;/p&gt;

&lt;p&gt;Now let's break the application.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Act I — The Release Fails After the Artifacts Are Already Staged
&lt;/h3&gt;

&lt;p&gt;The first release attempt distributes three child workflows across two independent worker processes.&lt;/p&gt;

&lt;p&gt;All three modules prepare their staging artifacts successfully.&lt;/p&gt;

&lt;p&gt;Then the smoke gate runs.&lt;/p&gt;

&lt;p&gt;For this experiment, we modeled an integration compatibility failure: &lt;code&gt;payment-engine&lt;/code&gt; requires an ABI compatibility flag that wasn't included in the initial release configuration.&lt;/p&gt;

&lt;p&gt;The initial flags are &lt;code&gt;--opt-level=3 --deterministic&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In the showcase, these represent an optimized, reproducible build configuration.&lt;/p&gt;

&lt;p&gt;The missing flag is &lt;code&gt;--abi-compat=v2&lt;/code&gt;, representing a requirement that &lt;code&gt;payment-engine&lt;/code&gt; must be compatible with version 2 of a defined application binary interface.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;These are illustrative flags for our release-planning scenario, not commands sent to an actual compiler.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The smoke-gate failure is intentionally injected so the recovery path can be exercised deterministically.&lt;/p&gt;

&lt;p&gt;The implementation is in &lt;a href="https://github.com/agbossjs/distributed-agent-recovery/blob/main/src/actions/verify-release-smoke-gate.action.ts" rel="noopener noreferrer"&gt;VerifyReleaseSmokeGateAction&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The action records a diagnostic message and throws &lt;code&gt;ReleaseGateFailedError&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The problem is that all three staging artifacts already exist.&lt;/p&gt;

&lt;p&gt;If the workflow simply terminates, it leaves external state partially modified.&lt;/p&gt;

&lt;h4&gt;
  
  
  Saga Compensation
&lt;/h4&gt;

&lt;p&gt;AGBoss lets actions declare compensating operations through &lt;code&gt;compensateWith&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In our showcase, &lt;a href="https://github.com/agbossjs/distributed-agent-recovery/blob/main/src/actions/lock-release-candidate.action.ts" rel="noopener noreferrer"&gt;LockReleaseCandidateAction&lt;/a&gt; declares the following relationship (abbreviated):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;Action&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;lock-release-candidate-action&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="c1"&gt;// Other metadata omitted&lt;/span&gt;
  &lt;span class="na"&gt;compensateWith&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;CompensateReleaseCandidateAction&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The coordinator also declares an explicit error-handling branch.&lt;/p&gt;

&lt;p&gt;From &lt;a href="https://github.com/agbossjs/distributed-agent-recovery/blob/main/src/workflows/release-coordinator/release-coordinator.workflow.ts" rel="noopener noreferrer"&gt;ReleaseCoordinatorWorkflow&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toAction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;VerifyReleaseSmokeGateAction&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;onError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nx"&gt;ReleaseGateFailedError&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nf"&gt;toAction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;CompensateReleaseCandidateAction&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toAction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;SummarizeCompensatedAttemptAction&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;returns&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;CompensatedReleaseCandidateDto&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toAgent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ReleaseRecoveryPlannerAgent&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;returns&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;RecoveryPlanDto&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFinish&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ReleaseRecoveryPlannedWorkflowFinish&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The compensation removes the staging files, marks the corresponding SQLite ledger records as &lt;code&gt;COMPENSATED&lt;/code&gt;, and releases the candidate lock.&lt;/p&gt;

&lt;p&gt;There's an important distinction here.&lt;/p&gt;

&lt;p&gt;AGBoss orchestrates compensation, but it cannot automatically undo arbitrary external operations.&lt;/p&gt;

&lt;p&gt;The application is responsible for physically deleting files, reversing supported business operations, and making those operations safe to retry.&lt;/p&gt;

&lt;p&gt;Our verifier therefore checks the actual filesystem and ledger state, not merely whether a compensation handler was called.&lt;/p&gt;

&lt;p&gt;After the failed attempt, all three staging artifacts are compensated and no active staging files from Attempt 1 remain.&lt;/p&gt;

&lt;p&gt;The system can now prepare a corrected attempt.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Where Does the AI Come In?
&lt;/h3&gt;

&lt;p&gt;After compensation, the coordinator invokes &lt;code&gt;ReleaseRecoveryPlannerAgent&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The agent is implemented in &lt;a href="https://github.com/agbossjs/distributed-agent-recovery/blob/main/src/agents/release-recovery-planner/release-recovery-planner.agent.ts" rel="noopener noreferrer"&gt;release-recovery-planner.agent.ts&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It uses &lt;a href="https://github.com/agbossjs/distributed-agent-recovery/blob/main/src/tools/inspect-failed-attempt.tool.ts" rel="noopener noreferrer"&gt;InspectFailedAttemptTool&lt;/a&gt; to read the actual diagnostic and compensation status from SQLite before proposing a new plan.&lt;/p&gt;

&lt;p&gt;In our recorded live run, the agent used &lt;code&gt;openai/gpt-4o-mini&lt;/code&gt; through OpenRouter.&lt;/p&gt;

&lt;p&gt;It made two model calls, invoked the inspection tool, and produced a typed &lt;code&gt;RecoveryPlanDto&lt;/code&gt; containing the corrected configuration:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;--opt-level=3 --deterministic --abi-compat=v2&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The recorded inference used 1,705 input tokens and 178 output tokens.&lt;/p&gt;

&lt;p&gt;This illustrates an architectural boundary I consider essential.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The LLM is responsible for application-level reasoning. The workflow infrastructure is responsible for consistency.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Diagnosing an integration failure and proposing a correction is a reasonable task for an AI agent.&lt;/p&gt;

&lt;p&gt;Managing lease ownership, deduplication, checkpoint consistency, and transactional writes is not something we should delegate to prompt instructions.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Act II — The Worker Dies. Long Live the Worker.
&lt;/h3&gt;

&lt;p&gt;The second release attempt starts with the corrected configuration.&lt;/p&gt;

&lt;p&gt;One worker claims the &lt;code&gt;payment-engine&lt;/code&gt; child workflow.&lt;/p&gt;

&lt;p&gt;It completes the first step, &lt;code&gt;PrepareModuleCandidateAction&lt;/code&gt;, and saves a checkpoint.&lt;/p&gt;

&lt;p&gt;Then it enters &lt;code&gt;StageModuleArtifactAction&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;At this point, the fault-injection scenario freezes the entire OS process using &lt;code&gt;SIGSTOP&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The freeze logic is implemented in &lt;a href="https://github.com/agbossjs/distributed-agent-recovery/blob/main/src/actions/stage-module-artifact.action.ts" rel="noopener noreferrer"&gt;StageModuleArtifactAction&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This is a real operating-system signal, not a simulated JavaScript exception.&lt;/p&gt;

&lt;p&gt;The process stops executing.&lt;/p&gt;

&lt;p&gt;It doesn't finish its action, renew its lease, or commit another checkpoint.&lt;/p&gt;

&lt;p&gt;But its memory remains intact.&lt;/p&gt;

&lt;p&gt;Unlike &lt;code&gt;SIGKILL&lt;/code&gt;, &lt;code&gt;SIGSTOP&lt;/code&gt; lets us later resume the process using &lt;code&gt;SIGCONT&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The original worker acquired its execution lease with epoch &lt;code&gt;1&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In this experiment, the lease has a 30-second TTL.&lt;/p&gt;

&lt;p&gt;When the worker stops renewing its lease and the lease expires, another AGBoss instance can reclaim the orphaned execution.&lt;/p&gt;

&lt;p&gt;But notice what happens next:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The replacement worker doesn't start a different task with the same input. It resumes the exact same child execution from its last committed checkpoint.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the recorded experiment, the execution ID was:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;f9907abf-19fd-498b-8397-49152e25345f&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After takeover:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;executionId&lt;/code&gt; remains unchanged.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;leaseEpoch&lt;/code&gt; advances from &lt;code&gt;1&lt;/code&gt; to &lt;code&gt;2&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The replacement loads the previous checkpoint.&lt;/li&gt;
&lt;li&gt;Step 1 isn't repeated.&lt;/li&gt;
&lt;li&gt;Step 2 completes on the replacement worker.&lt;/li&gt;
&lt;li&gt;The step's deterministic idempotency key is preserved.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The runtime emits the event &lt;code&gt;execution.recovered&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The replacement worker successfully commits the staged artifact.&lt;/p&gt;

&lt;p&gt;So far, the recovery worked.&lt;/p&gt;

&lt;p&gt;But the original process is still frozen.&lt;/p&gt;

&lt;p&gt;And now comes the interesting part.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Act III — The Zombie Worker Returns
&lt;/h3&gt;

&lt;p&gt;The fault-injection scenario sends &lt;code&gt;SIGCONT&lt;/code&gt; to the frozen process.&lt;/p&gt;

&lt;p&gt;It wakes up.&lt;/p&gt;

&lt;p&gt;From its perspective, it is still executing &lt;code&gt;StageModuleArtifactAction&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;It still has its original lease information in memory: &lt;code&gt;leaseEpoch = 1&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Unfortunately for the zombie, another worker has already completed the task under &lt;code&gt;leaseEpoch = 2&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;What happens if the old worker attempts to commit?&lt;/p&gt;

&lt;p&gt;This is the central test.&lt;/p&gt;

&lt;h4&gt;
  
  
  Defense 1: Stable Step Idempotency Keys
&lt;/h4&gt;

&lt;p&gt;AGBoss provides a deterministic key for an individual workflow step.&lt;/p&gt;

&lt;p&gt;In &lt;a href="https://github.com/agbossjs/distributed-agent-recovery/blob/main/src/actions/stage-module-artifact.action.ts" rel="noopener noreferrer"&gt;StageModuleArtifactAction&lt;/a&gt;, the action obtains the key from &lt;code&gt;ExecutionContext&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The following is an excerpt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;executionId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;executionContext&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;executionId&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;idempotencyKey&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
  &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;executionContext&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;step&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;idempotencyKey&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For the recovered child execution, the resulting key was:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;f9907abf-19fd-498b-8397-49152e25345f:stage-module-artifact-action:1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The key identifies the execution, step, and visit number.&lt;/p&gt;

&lt;p&gt;Importantly, it remains the same after recovery.&lt;/p&gt;

&lt;p&gt;This gives the external ledger a stable identity for deduplicating repeated attempts.&lt;/p&gt;

&lt;p&gt;But idempotency doesn't answer whether an old worker is still authorized to write.&lt;/p&gt;

&lt;p&gt;We need another defense.&lt;/p&gt;

&lt;h4&gt;
  
  
  Defense 2: Lease Fencing at the External Side-Effect Boundary
&lt;/h4&gt;

&lt;p&gt;An AGBoss &lt;code&gt;@Action&lt;/code&gt; can perform external I/O inside its &lt;code&gt;execute()&lt;/code&gt; method.&lt;/p&gt;

&lt;p&gt;That happens before the workflow runtime commits the step's checkpoint.&lt;/p&gt;

&lt;p&gt;Therefore, checkpoint fencing alone cannot protect arbitrary databases, payment systems, or external APIs.&lt;/p&gt;

&lt;p&gt;Our application captures the worker's current lease information when the action begins.&lt;/p&gt;

&lt;p&gt;See &lt;a href="https://github.com/agbossjs/distributed-agent-recovery/blob/main/src/actions/stage-module-artifact.action.ts" rel="noopener noreferrer"&gt;StageModuleArtifactAction&lt;/a&gt;, which captures the lease and forwards the captured owner and epoch to the ledger.&lt;/p&gt;

&lt;p&gt;Before committing an artifact, the ledger validates the fencing token against current ownership.&lt;/p&gt;

&lt;p&gt;The following is a simplified excerpt from &lt;a href="https://github.com/agbossjs/distributed-agent-recovery/blob/main/src/services/lease-fencing.service.ts" rel="noopener noreferrer"&gt;LeaseFencingService.checkAndAdvanceFence()&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nx"&gt;params&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;capturedLeaseEpoch&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;activeLeaseEpoch&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
  &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nx"&gt;activeHolder&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="nx"&gt;params&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;capturedInstanceId&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
    &lt;span class="nx"&gt;params&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;capturedLeaseEpoch&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="nx"&gt;activeLeaseEpoch&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Record ZOMBIE_WRITE_REJECTED&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;StaleLeaseFenceError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="cm"&gt;/* ... */&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The actual implementation performs the check as part of the application's SQLite transaction.&lt;/p&gt;

&lt;p&gt;When the zombie resumes, its captured epoch is &lt;code&gt;1&lt;/code&gt;, but the current epoch is &lt;code&gt;2&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The ledger rejects its operation and records &lt;code&gt;ZOMBIE_WRITE_REJECTED&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The stale worker cannot overwrite the committed artifact.&lt;/p&gt;

&lt;p&gt;This is application-level protection of the external side effect.&lt;/p&gt;

&lt;h4&gt;
  
  
  Defense 3: Fencing the Workflow Checkpoint
&lt;/h4&gt;

&lt;p&gt;There's one more thing to protect.&lt;/p&gt;

&lt;p&gt;Even after the external write is rejected, the old worker might attempt to persist a workflow state transition.&lt;/p&gt;

&lt;p&gt;AGBoss uses &lt;code&gt;LeasedCheckpointSaver&lt;/code&gt; to validate execution ownership at the checkpoint boundary.&lt;/p&gt;

&lt;p&gt;The zombie can no longer renew its old lease.&lt;/p&gt;

&lt;p&gt;As a result, its stale checkpoint write is rejected with &lt;code&gt;ExecutionLeaseLostError&lt;/code&gt;, carrying the code &lt;code&gt;execution.lease-lost&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;We now have two distinct layers of protection:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Application-level fencing&lt;/strong&gt; prevents stale writes to external business state.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AGBoss runtime fencing&lt;/strong&gt; prevents stale writes to the workflow's checkpoint state.&lt;/p&gt;

&lt;p&gt;Both matter.&lt;/p&gt;

&lt;p&gt;Without application-level protection, a stale worker might mutate an external service before the runtime detects that it has lost its lease.&lt;/p&gt;

&lt;p&gt;Without runtime-level protection, a stale worker might corrupt the workflow's persisted execution history.&lt;/p&gt;

&lt;p&gt;This is why reliable recovery requires more than simply retrying failed tasks.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Independent Verification Against Runtime State
&lt;/h3&gt;

&lt;p&gt;It's easy to print &lt;code&gt;ZOMBIE_WRITE_REJECTED&lt;/code&gt; and declare success.&lt;/p&gt;

&lt;p&gt;But a log message alone doesn't prove that the system remained consistent.&lt;/p&gt;

&lt;p&gt;That's why the showcase includes an independent invariant verifier.&lt;/p&gt;

&lt;p&gt;It inspects the application's SQLite ledger, filesystem artifacts, and AGBoss's internal cluster tables.&lt;/p&gt;

&lt;p&gt;The relevant implementation is &lt;a href="https://github.com/agbossjs/distributed-agent-recovery/blob/main/src/services/release-invariant-verifier.service.ts" rel="noopener noreferrer"&gt;ReleaseInvariantVerifierService&lt;/a&gt;, which uses &lt;a href="https://github.com/agbossjs/distributed-agent-recovery/blob/main/src/repositories/cluster-snapshot.repository.ts" rel="noopener noreferrer"&gt;ClusterSnapshotRepository&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We examine three runtime tables:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;execution_leases&lt;/code&gt; — who owns an execution and how its lease epoch changed.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;checkpoints&lt;/code&gt; — the persisted state history of the workflow.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;child_execution_queue&lt;/code&gt; — outstanding child executions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The verifier confirms the transition to epoch &lt;code&gt;2&lt;/code&gt;, the preserved execution identity, a linear checkpoint chain, no competing zombie branch, and no orphaned child tasks.&lt;/p&gt;

&lt;p&gt;Directly reading internal AGBoss tables is a diagnostic technique tied to the tested framework version, not a recommended public application integration API.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. What AGBoss Guarantees — and What It Doesn't
&lt;/h3&gt;

&lt;p&gt;In distributed systems, overclaiming guarantees can be just as dangerous as underengineering failure handling.&lt;/p&gt;

&lt;p&gt;AGBoss provides several building blocks for resilient AI workflows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Declarative workflow composition and static verification.&lt;/li&gt;
&lt;li&gt;Distributed child execution and shared queue coordination.&lt;/li&gt;
&lt;li&gt;Execution leases and recovery after ownership loss.&lt;/li&gt;
&lt;li&gt;Checkpoint continuation and stale checkpoint fencing.&lt;/li&gt;
&lt;li&gt;Deterministic step idempotency keys.&lt;/li&gt;
&lt;li&gt;Saga compensation for supported reversible operations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, &lt;strong&gt;AGBoss cannot automatically guarantee exactly-once side effects for arbitrary external systems&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If an action sends an HTTP request to an API without idempotency support, a checkpoint saver cannot retroactively make that API operation transactional.&lt;/p&gt;

&lt;p&gt;Likewise, protecting internal workflow state doesn't automatically fence external writes.&lt;/p&gt;

&lt;p&gt;The external system must enforce its own atomicity and deduplication contract.&lt;/p&gt;

&lt;p&gt;In our showcase, the application-level SQLite ledger provides those mechanisms through transactional checks, unique constraints, and monotonic fencing tokens.&lt;/p&gt;

&lt;p&gt;The accurate guarantee is:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;At-least-once execution with effectively exactly-once external effects, where the external system enforces atomic idempotency and fencing.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;And one more distinction matters: this does not imply exactly-once LLM inference.&lt;/p&gt;

&lt;p&gt;A model invocation may also be repeated after a crash if the runtime hasn't durably recorded its result.&lt;/p&gt;

&lt;h4&gt;
  
  
  Compensation Is Not Crash Recovery
&lt;/h4&gt;

&lt;p&gt;Saga compensation and lease-based crash recovery solve different problems.&lt;/p&gt;

&lt;p&gt;In Attempt 1, the workflow receives a managed &lt;code&gt;ReleaseGateFailedError&lt;/code&gt; and executes compensating operations.&lt;/p&gt;

&lt;p&gt;In Attempt 2, a worker loses its lease and another worker resumes the unfinished execution.&lt;/p&gt;

&lt;p&gt;If a container is hard-killed, it cannot immediately run compensation inside the terminated process. Recovery must first occur elsewhere.&lt;/p&gt;

&lt;p&gt;Compensation itself also requires operations with meaningful reversal semantics.&lt;/p&gt;

&lt;p&gt;Deleting a staged, unpublished artifact is straightforward. Undoing a payment, retracting an email, or reversing an irreversible third-party operation may require a fundamentally different business process.&lt;/p&gt;

&lt;h4&gt;
  
  
  Fixed Workers vs. Autoscaling
&lt;/h4&gt;

&lt;p&gt;AGBoss separates work orchestration from infrastructure scaling.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ChildPlacement.AnyInstance&lt;/code&gt; allows eligible worker instances connected to shared execution repositories to participate in distributed execution.&lt;/p&gt;

&lt;p&gt;Our showcase uses a fixed worker pool because the experiment is about recovery, idempotency, and fencing — not autoscaler behavior.&lt;/p&gt;

&lt;p&gt;Dynamic Kubernetes scaling based on queue depth, resource usage, or other metrics is a separate infrastructure concern.&lt;/p&gt;

&lt;p&gt;Production Kubernetes support, including distributed storage and autoscaling integration, is tracked in the &lt;a href="https://github.com/agbossjs/agboss/issues/469" rel="noopener noreferrer"&gt;AGBoss Kubernetes roadmap epic&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Single-Host SQLite vs. Multi-Node High Availability
&lt;/h4&gt;

&lt;p&gt;The showcase uses shared SQLite WAL storage across independent processes and containers on one host.&lt;/p&gt;

&lt;p&gt;This provides a reproducible environment without requiring PostgreSQL or a separate database service.&lt;/p&gt;

&lt;p&gt;But it is not a demonstration of multi-host high availability.&lt;/p&gt;

&lt;p&gt;A production multi-node Kubernetes deployment needs a suitable network-backed transactional storage layer and corresponding repository implementations.&lt;/p&gt;

&lt;p&gt;The execution model can support newly available workers, but the storage and deployment guarantees must be satisfied independently.&lt;/p&gt;

&lt;h4&gt;
  
  
  Toward a Public Fencing API
&lt;/h4&gt;

&lt;p&gt;The showcase also highlights an API-design opportunity.&lt;/p&gt;

&lt;p&gt;AGBoss already manages execution ownership and checkpoint fencing. Applications currently need additional integration code to carry lease ownership into external side-effect transactions.&lt;/p&gt;

&lt;p&gt;A type-safe, storage-independent public fencing contract could make this easier.&lt;/p&gt;

&lt;p&gt;That doesn't mean AGBoss should pretend to enforce transactions inside arbitrary third-party systems.&lt;/p&gt;

&lt;p&gt;It means giving developers a clearer, safer way to integrate external systems with execution ownership.&lt;/p&gt;

&lt;p&gt;This is a direction for the framework's future API, not a guarantee claimed by the current release.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Does Open Innovation Matter?
&lt;/h2&gt;

&lt;p&gt;There's a tremendous amount of attention in the AI-agent ecosystem devoted to models, prompts, tool calling, and evaluation.&lt;/p&gt;

&lt;p&gt;All of that matters.&lt;/p&gt;

&lt;p&gt;But once agents start taking real actions, we encounter problems distributed systems engineers have dealt with for decades: retries, duplicate delivery, stale ownership, partial commits, idempotency, checkpoint consistency, and recovery after process failure.&lt;/p&gt;

&lt;p&gt;These problems cannot be solved by better prompt engineering alone.&lt;/p&gt;

&lt;p&gt;They require explicit execution contracts.&lt;/p&gt;

&lt;p&gt;I'm building &lt;a href="https://github.com/agbossjs/agboss" rel="noopener noreferrer"&gt;AGBoss&lt;/a&gt; to combine typed agent composition, dependency injection, static workflow verification, and resilient execution mechanisms in a single TypeScript framework built on LangGraph.&lt;/p&gt;

&lt;p&gt;Open source is especially important here because reliability guarantees need to be inspectable.&lt;/p&gt;

&lt;p&gt;A closed black-box service might promise durable agent execution, but understanding exactly what happens between an external side effect and a checkpoint can be difficult.&lt;/p&gt;

&lt;p&gt;With an open runtime, we can inspect the execution contracts, build reproducible fault-injection tests, and independently verify the persisted state.&lt;/p&gt;

&lt;p&gt;We can freeze a worker, inspect the lease table, reproduce a stale write, and verify whether the system truly rejects it.&lt;/p&gt;

&lt;p&gt;We can also identify missing guarantees and improve the framework through public API discussions, tests, and contributions.&lt;/p&gt;

&lt;p&gt;The use of a hosted LLM for recovery planning doesn't change that principle. The model provides application-level reasoning; the infrastructure responsible for consistency remains open and testable.&lt;/p&gt;

&lt;p&gt;The open-source ecosystem also makes it possible to build on established LangGraph execution concepts rather than reinvent every component from scratch.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Open innovation matters because reliability shouldn't require trusting a marketing claim. It should be something developers can reproduce and verify.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Spirit of It
&lt;/h2&gt;

&lt;p&gt;The most unsettling moment wasn't when the worker stopped.&lt;/p&gt;

&lt;p&gt;It was when it came back.&lt;/p&gt;

&lt;p&gt;Another worker had already recovered the execution, completed the unfinished step, and committed the result.&lt;/p&gt;

&lt;p&gt;The original process had no idea.&lt;/p&gt;

&lt;p&gt;It simply resumed from the exact instruction where the operating system had frozen it.&lt;/p&gt;

&lt;p&gt;For a moment, two workers had been executing the same logical job.&lt;/p&gt;

&lt;p&gt;But only one still had the right to change the result.&lt;/p&gt;

&lt;p&gt;The zombie tried to write.&lt;/p&gt;

&lt;p&gt;The ledger rejected it.&lt;/p&gt;

&lt;p&gt;Then the runtime rejected its stale checkpoint.&lt;/p&gt;

&lt;p&gt;The workflow survived.&lt;/p&gt;

&lt;p&gt;The zombie didn't get the last word.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;An AI agent may execute twice. That doesn't mean it should change the world twice.&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Source code and documentation&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/agbossjs/agboss" rel="noopener noreferrer"&gt;AGBoss — GitHub&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://agboss.dev" rel="noopener noreferrer"&gt;AGBoss — Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/agbossjs/distributed-agent-recovery" rel="noopener noreferrer"&gt;Distributed Agent Recovery — Showcase&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/agbossjs/distributed-agent-recovery/blob/main/docs/evidence/live-real-clock-cluster-run.json" rel="noopener noreferrer"&gt;Recorded Live Experiment&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/agbossjs/agboss/issues/469" rel="noopener noreferrer"&gt;Kubernetes &amp;amp; Autoscaling Roadmap&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>devchallenge</category>
      <category>hf26challenge</category>
      <category>ai</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Your AI Agent Graph Compiles. That Doesn't Mean It's Correct.</title>
      <dc:creator>Pavel Ravvich</dc:creator>
      <pubDate>Tue, 27 Oct 2026 20:38:01 +0000</pubDate>
      <link>https://dev.to/pravvich/your-ai-agent-graph-compiles-that-doesnt-mean-its-correct-515h</link>
      <guid>https://dev.to/pravvich/your-ai-agent-graph-compiles-that-doesnt-mean-its-correct-515h</guid>
      <description>&lt;h1&gt;
  
  
  Your AI Agent Graph Compiles. That Doesn't Mean It's Correct.
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;Why TypeScript can't catch certain bugs in multi-agent workflows — and what static graph analysis can do about them.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;TypeScript catches a remarkable number of mistakes before an application ever runs. Incompatible types, incorrect arguments, missing properties — the compiler handles these pretty well.&lt;/p&gt;

&lt;p&gt;But when building complex AI workflows, there's a problem that TypeScript alone can't solve:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Every component in a graph can be correctly typed while the graph itself is structurally incorrect.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I'm not talking about LLM hallucinations, unreliable prompts, or model nondeterminism.&lt;/p&gt;

&lt;p&gt;I'm talking about ordinary engineering bugs caused by how execution paths connect.&lt;/p&gt;

&lt;p&gt;Let's look at a concrete example.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. When Types Are Correct but the Graph Isn't
&lt;/h2&gt;

&lt;p&gt;Imagine a contract-processing system. Before publication, each contract must pass a compliance review.&lt;/p&gt;

&lt;p&gt;The system also supports a fast-track route that skips part of the normal processing.&lt;/p&gt;

&lt;p&gt;The workflow looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                       Start
                         |
                       Triage
                         |
                 +-------+-------+
                 |               |
             Normal route    Fast track
                 |               |
          Compliance Review      |
                 |               |
                 +-------+-------+
                         |
                  PublishContract
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At first glance, this seems reasonable.&lt;/p&gt;

&lt;p&gt;Except there's a problem.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;PublishContract&lt;/code&gt; requires a compliance approval, but the fast-track route skips the component that produces it.&lt;/p&gt;

&lt;p&gt;In other words, &lt;strong&gt;there is a reachable execution path where required input data is never created.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;What does TypeScript think about this?&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Why TypeScript Misses the Bug
&lt;/h2&gt;

&lt;p&gt;Let's use a conventional LangGraph &lt;code&gt;StateGraph&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;First, define the shared state:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;Annotation&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;StateGraph&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;START&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;END&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@langchain/langgraph&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;ContractDraft&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;contractId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;summary&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;fastTrackRequested&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;boolean&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;ComplianceApproval&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;reviewer&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;certificateId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;State&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Annotation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Root&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;draft&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Annotation&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ContractDraft&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
  &lt;span class="na"&gt;approval&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Annotation&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ComplianceApproval&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
  &lt;span class="na"&gt;publishedRecord&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Annotation&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;string&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;approval&lt;/code&gt; field is declared as &lt;code&gt;ComplianceApproval | undefined&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That makes sense. At the beginning of the workflow, the compliance review hasn't happened yet.&lt;/p&gt;

&lt;p&gt;Now let's add the publication node:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addNode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;publishContract&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;cert&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
    &lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;approval&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;certificateId&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toUpperCase&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;publishedRecord&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="s2"&gt;`PUBLISHED:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;draft&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;contractId&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;cert&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The non-null assertion operator (&lt;code&gt;!&lt;/code&gt;) tells TypeScript that we are certain the value exists.&lt;/p&gt;

&lt;p&gt;But that certainty has nothing to do with the actual structure of the graph.&lt;/p&gt;

&lt;p&gt;Now consider the conditional transition:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addConditionalEdges&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;triage&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
  &lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;draft&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fastTrackRequested&lt;/span&gt;
    &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;publishContract&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;complianceReview&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If &lt;code&gt;fastTrackRequested&lt;/code&gt; is true, execution reaches &lt;code&gt;publishContract&lt;/code&gt; without producing &lt;code&gt;approval&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;TypeScript accepts the code.&lt;/p&gt;

&lt;p&gt;At runtime, accessing &lt;code&gt;certificateId&lt;/code&gt; on &lt;code&gt;undefined&lt;/code&gt; throws.&lt;/p&gt;

&lt;p&gt;Of course, we could remove the non-null assertion and handle the missing value explicitly. That would prevent this particular exception, but it wouldn't fix the architectural problem: the workflow still allows publication without the required compliance review.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Fundamental Limitation
&lt;/h3&gt;

&lt;p&gt;TypeScript understands types and local control flow within functions.&lt;/p&gt;

&lt;p&gt;But it doesn't prove that an arbitrary sequence of nodes in an external execution graph will produce every value required by downstream components.&lt;/p&gt;

&lt;p&gt;To establish that guarantee, we need to know more than the type of a value.&lt;/p&gt;

&lt;p&gt;We need to know &lt;strong&gt;whether that value is available on every execution path that reaches its consumer.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That's a dataflow analysis problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. From Component Types to Graph Verification
&lt;/h2&gt;

&lt;p&gt;In a conventional application, we might write:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;publish&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nx"&gt;draft&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ContractDraft&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;approval&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ComplianceApproval&lt;/span&gt;
&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;PublishedContract&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;TypeScript verifies that both arguments are present at a call site.&lt;/p&gt;

&lt;p&gt;But in a graph-based system, the producer of &lt;code&gt;ComplianceApproval&lt;/code&gt; and its consumer may be separated by conditional branches, loops, and parallel execution paths.&lt;/p&gt;

&lt;p&gt;Typing individual components is no longer enough.&lt;/p&gt;

&lt;p&gt;We need to answer a more difficult question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;For every reachable execution path, are all required inputs guaranteed to exist when a component runs?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is one of the problems I set out to address with &lt;strong&gt;AGBoss&lt;/strong&gt;, an open-source TypeScript framework built on top of LangGraph.&lt;/p&gt;

&lt;p&gt;AGBoss components declare their input and output DTOs explicitly.&lt;/p&gt;

&lt;p&gt;Here's an example from the project's executable test suite. An action renders an invoice using an order request and a coupon discount:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;Action&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;render-invoice-action&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Renders final invoice&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;input&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;request&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;CheckoutRequestDto&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;coupon&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;CouponDiscountDto&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;output&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;InvoiceSummaryDto&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;RenderInvoiceAction&lt;/span&gt;
  &lt;span class="k"&gt;implements&lt;/span&gt; &lt;span class="nx"&gt;ActionHandler&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;RenderInvoiceAction&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="na"&gt;input&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;InputOf&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;RenderInvoiceAction&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;OutputOf&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;RenderInvoiceAction&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Generate the invoice&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The component explicitly requires two inputs: an order request and a calculated coupon.&lt;/p&gt;

&lt;p&gt;Now imagine a workflow with two routes. VIP customers receive a promotional discount, while standard customers proceed directly to invoice generation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nf"&gt;start&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;MissingInputBrokenStart&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;returns&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;CheckoutRequestDto&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toRouter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;TierBrokenRouter&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;chooseOne&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nf"&gt;route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ApplyVipCouponAction&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;returns&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;CouponDiscountDto&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toAction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;RenderInvoiceAction&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;

    &lt;span class="nf"&gt;route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;RenderInvoiceAction&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Look at the second route.&lt;/p&gt;

&lt;p&gt;It invokes &lt;code&gt;RenderInvoiceAction&lt;/code&gt; without producing the required &lt;code&gt;CouponDiscountDto&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The DTOs are valid. The component contracts are valid. But the graph contains a structural error.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Catching the Problem Before Execution
&lt;/h2&gt;

&lt;p&gt;AGBoss includes a static graph analyzer, invoked with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx agboss check
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It analyzes reachable execution paths and tracks which data is available to each component.&lt;/p&gt;

&lt;p&gt;For our example, it reports:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[input.missing-on-path]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The diagnostic identifies the required &lt;code&gt;coupon&lt;/code&gt; input of &lt;code&gt;render-invoice-action&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This is a different level of verification.&lt;/p&gt;

&lt;p&gt;Instead of waiting for a particular combination of inputs to trigger a failure in production, we can detect the structural problem before starting the application.&lt;/p&gt;

&lt;p&gt;And because this is static analysis, it doesn't require calling an LLM, spending tokens, or relying on nondeterministic model responses.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Does the Fix Look Like?
&lt;/h3&gt;

&lt;p&gt;We need to ensure that every route reaches a component whose declared inputs are actually available.&lt;/p&gt;

&lt;p&gt;One solution is to use separate invoice actions for VIP and standard orders:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nf"&gt;start&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;MissingInputFixedStart&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;returns&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;CheckoutRequestDto&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toRouter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;TierRouter&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;chooseOne&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nf"&gt;route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ApplyVipCouponAction&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;returns&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;CouponDiscountDto&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toAction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;RenderInvoiceAction&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;returns&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;InvoiceSummaryDto&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFinish&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;MissingInputFixedFinish&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;

    &lt;span class="nf"&gt;route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;RenderStandardInvoiceAction&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;returns&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;InvoiceSummaryDto&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFinish&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;MissingInputFixedFinish&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the VIP branch produces a coupon before rendering the invoice, while the standard branch uses an action that doesn't require one.&lt;/p&gt;

&lt;p&gt;Both branches produce &lt;code&gt;InvoiceSummaryDto&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;We've fixed the dataflow structure, rather than merely adding another runtime check.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Missing Data Is Only the Beginning
&lt;/h2&gt;

&lt;p&gt;While working on this problem, I realized that checking whether a DTO exists is only the first step.&lt;/p&gt;

&lt;p&gt;Complex workflows have several other interesting classes of structural bugs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Stale Data After Revision Loops
&lt;/h3&gt;

&lt;p&gt;Imagine an agent drafts a document, another agent approves it, and a third requests changes.&lt;/p&gt;

&lt;p&gt;The document is revised, but the previous approval remains in the workflow state.&lt;/p&gt;

&lt;p&gt;The approval exists. Its type is correct. But it belongs to an earlier version of the document.&lt;/p&gt;

&lt;p&gt;AGBoss detects this class of problem with:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;[input.outdated-on-path]&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Conflicting Parallel Branches
&lt;/h3&gt;

&lt;p&gt;Suppose two branches run concurrently.&lt;/p&gt;

&lt;p&gt;One modifies a financial calculation, while the other audits the previous version.&lt;/p&gt;

&lt;p&gt;When the branches join, the audit result may no longer correspond to the current data.&lt;/p&gt;

&lt;p&gt;The analyzer can report:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;[launch.branch-outdates-sibling]&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Uncompensated Side Effects
&lt;/h3&gt;

&lt;p&gt;Consider an order workflow that reserves inventory, charges a customer, and confirms the purchase.&lt;/p&gt;

&lt;p&gt;If the payment fails and an error route reaches the workflow finish without releasing the inventory, the reservation may remain active.&lt;/p&gt;

&lt;p&gt;AGBoss supports declared compensating actions and checks compensation coverage on error paths.&lt;/p&gt;

&lt;p&gt;The corresponding diagnostic is:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;[flow.uncompensated-action]&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;These are different problems, but they share a common principle:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The correctness of a graph cannot be inferred from the correctness of its individual nodes.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Reproduce the Failures Yourself
&lt;/h2&gt;

&lt;p&gt;I wanted these claims to be reproducible rather than just theoretical.&lt;/p&gt;

&lt;p&gt;So I created a separate repository of executable examples:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/agbossjs/agboss-examples/tree/main/02-path-scope-proof" rel="noopener noreferrer"&gt;AGBoss Examples — 02-path-scope-proof&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It covers all four scenarios.&lt;/p&gt;

&lt;p&gt;Each includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A broken LangGraph implementation that passes TypeScript compilation.&lt;/li&gt;
&lt;li&gt;A broken AGBoss workflow with an expected static diagnostic.&lt;/li&gt;
&lt;li&gt;A corrected AGBoss implementation.&lt;/li&gt;
&lt;li&gt;Automated tests that verify the expected behavior.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After installing the example's dependencies, you can run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run check
npm &lt;span class="nb"&gt;test
&lt;/span&gt;npm run demo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The scenarios are designed to run deterministically and offline, without external LLM API calls.&lt;/p&gt;

&lt;p&gt;The goal isn't simply to display a convincing error message.&lt;/p&gt;

&lt;p&gt;It's to reproduce a concrete failure class and verify that the analyzer detects it.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. What Static Analysis Cannot Guarantee
&lt;/h2&gt;

&lt;p&gt;Static analysis doesn't magically prove that an entire application is correct.&lt;/p&gt;

&lt;p&gt;It won't tell you whether a discount was calculated correctly, whether a legal document complies with regulations, or whether an LLM produced a useful answer.&lt;/p&gt;

&lt;p&gt;It also relies on developers declaring component contracts and data dependencies accurately.&lt;/p&gt;

&lt;p&gt;But it can verify structural properties that would otherwise require extensive testing.&lt;/p&gt;

&lt;p&gt;And the more complex a graph becomes, the more valuable that distinction is.&lt;/p&gt;

&lt;p&gt;With three nodes and two transitions, manual inspection is relatively easy.&lt;/p&gt;

&lt;p&gt;With dozens of nodes, conditional routes, loops, parallel branches, and nested workflows, the number of possible execution paths can grow rapidly.&lt;/p&gt;

&lt;p&gt;Testing every combination independently becomes increasingly impractical.&lt;/p&gt;

&lt;p&gt;Static analysis doesn't replace testing.&lt;/p&gt;

&lt;p&gt;It helps eliminate entire classes of errors before testing even begins.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;In conventional software engineering, we've long accepted that certain bugs are better caught at build time than at runtime.&lt;/p&gt;

&lt;p&gt;I think AI-agent systems deserve the same approach.&lt;/p&gt;

&lt;p&gt;LLMs introduce nondeterminism. That's unavoidable.&lt;/p&gt;

&lt;p&gt;But &lt;strong&gt;the presence of nondeterministic components doesn't mean the rest of the system has to be unpredictable.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Graph structure, component contracts, data availability, and execution paths are engineering problems.&lt;/p&gt;

&lt;p&gt;And many of them can be verified before the first model call.&lt;/p&gt;

&lt;p&gt;That's the idea behind &lt;a href="https://github.com/agbossjs/agboss" rel="noopener noreferrer"&gt;AGBoss&lt;/a&gt;, the open-source TypeScript framework I'm building on top of LangGraph, with dependency injection, declarative components, and static graph verification.&lt;/p&gt;

&lt;p&gt;I'm curious how other developers approach this.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Have you encountered bugs where every node was correctly typed, but the workflow failed only on a particular execution path? How did you catch them?&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/agbossjs/agboss" rel="noopener noreferrer"&gt;https://github.com/agbossjs/agboss&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Executable examples:&lt;/strong&gt; &lt;a href="https://github.com/agbossjs/agboss-examples/tree/main/02-path-scope-proof" rel="noopener noreferrer"&gt;https://github.com/agbossjs/agboss-examples/tree/main/02-path-scope-proof&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Documentation:&lt;/strong&gt; &lt;a href="https://agboss.dev" rel="noopener noreferrer"&gt;https://agboss.dev&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tags:&lt;/strong&gt; #typescript #ai #architecture #opensource&lt;/p&gt;

</description>
      <category>ai</category>
      <category>typescript</category>
      <category>architecture</category>
      <category>opensource</category>
    </item>
    <item>
      <title>TypeSafe's Jev: Independent Benchmark Against LLMs (with code)</title>
      <dc:creator>Pavel Ravvich</dc:creator>
      <pubDate>Sun, 27 Sep 2026 08:34:27 +0000</pubDate>
      <link>https://dev.to/pravvich/typesafes-jev-independent-benchmark-against-llms-with-code-3deh</link>
      <guid>https://dev.to/pravvich/typesafes-jev-independent-benchmark-against-llms-with-code-3deh</guid>
      <description>&lt;p&gt;I built an independent benchmark to test TypeSafe's Jev model against GPT-4, Claude, and Gemini on classification tasks.&lt;/p&gt;

&lt;p&gt;Jev is a different kind of model — instead of generating text, it outputs probabilities for given answer choices. This makes it particularly interesting for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Intent routing in AI agents&lt;/li&gt;
&lt;li&gt;Guardrails and safety checks&lt;/li&gt;
&lt;li&gt;Low-latency classification pipelines&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The benchmark covers spam detection, sentiment analysis, and topic classification tasks with full reproducible code.&lt;/p&gt;

&lt;p&gt;Read the full article + code on Medium:&lt;br&gt;
&lt;a href="https://medium.com/@pravvich/typesafes-jev-beyond-the-hype-an-independent-benchmark-8bdc1c99d000GitHub" rel="noopener noreferrer"&gt;https://medium.com/@pravvich/typesafes-jev-beyond-the-hype-an-independent-benchmark-8bdc1c99d000GitHub&lt;/a&gt; repo:&lt;br&gt;
&lt;a href="https://github.com/PavelRavvich/jev-bench" rel="noopener noreferrer"&gt;https://github.com/PavelRavvich/jev-bench&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Connect with me on LinkedIn:&lt;br&gt;
&lt;a href="https://www.linkedin.com/in/pavel-ravvich/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/pavel-ravvich/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>ai</category>
      <category>llm</category>
      <category>jev</category>
    </item>
  </channel>
</rss>
