cleandataengineering.aiAgent Harness, drawn simply
You are here: Real flows › 17 · The same message twice

Agent Harness Tutorial · Real flows

Flow 17: The same message twice

Route: Direct, then replay. First: 568 ms · second: 140 ms, "already handled".

Open: Entra IDEntraIDOpen: PostgreSQLPostgresstateOpen: DBOSDBOSwaitsOpen: APIM → modelAPIM→ modelOpen: Claims (MCP)ClaimsMCPTHE BOXES IT PASSEDWHAT HAPPENEDBEFORE THE MESSAGEOpen: Sign-in with Microsoft EntraSign-in with Microsoft Entrazoom in ›1Rohan signs in with MicrosoftEntra ID (code flow + PKCE); thetoken stays in the pageOpen: Page opens: load the conversationPage opens: load the conversationzoom in ›2GET /opening: the newestcheckpoint is resumed if under24 h old, else a newconversationFIRST SENDRohan: "What's the status of claim CLM-010007? (idempotency-key 37e4f263…)"Open: Front doorFront doorzoom in ›3body ≤ 8 KiB · token verified →PH-1001 · kill switch onOpen: Delivery ledgerDelivery ledgerzoom in ›4new row PH-1001:<delivery id>,in_flight, expires in 600 sOpen: Anything waiting?Anything waiting?zoom in ›5nothing pendingOpen: RouterRouterzoom in ›6claim_status + one reference:DirectOpen: Direct: tool read + templateDirect: tool read + templatezoom in ›7get_claim · template · 568 msOpen: After-loop rulesAfter-loop ruleszoom in ›8no Tier-2 rule firesOpen: Before-reply checkBefore-reply checkzoom in ›9no_promise_of_cover,no_pii_echo, money_in_rupees:passOpen: Save and settleSave and settlezoom in ›10checkpoint saved · ledger row37e4f263… → answered, replystoredReply: "Claim CLM-010007 is under assessment. The assessor decides it; I cannot say whatthey will decide."SECOND SEND, SAME KEYOpen: Front doorFront doorzoom in ›11token verifiedOpen: Delivery ledgerDelivery ledgerzoom in ›12INSERT … ON CONFLICT finds therow answered: return the storedreply · 140 ms · no turn spanReply: "(the same text, word for word)"
Left: the boxes this message really passed, in order; each opens its design page. Middle: the outside systems each box called, as dots on five lanes (Entra ID, PostgreSQL, DBOS, APIM in front of the model, the claims system over MCP); click a lane head to open it. Right: what happened. Grey boxes are checks, the dark box is the model, a crossed box is where something was blocked.
What it teachesExactly-once is a database row keyed by the delivery id.

Want every detail? The long version is in the Series: this flow with real spans and payloads.