cleandataengineering.aiAgent Harness, drawn simply
You are here: Real flows › 11 · Withdrawing a claim

Agent Harness Tutorial · Real flows

Flow 11: Withdrawing a claim

Route: Agentic. Turn 1: 3 model calls · 4,201 ms · $0.00093 · Turn 2: 2,210 ms · $0.00030.

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 newconversationTURN 1Rohan: "I want to withdraw my windscreen glass claim, I'll pay for it myself."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 ›6withdraw_claim: AgenticOpen: Consent: what his words allowConsent: what his words allowzoom in ›7withdraw_claim, but no claimnamed, so no record coveredTRIP 1Open: Context assemblyContext assemblyzoom in ›8Open: Pre-model checkPre-model checkzoom in ›9no_known_injection: passOpen: Model callModel callzoom in ›10795 ms · 661 in / 67 out · APIM:allow-list, rate limit, ContentSafety passOpen: Read the answerRead the answerzoom in ›11wants a toolOpen: Pre-tool checkPre-tool checkzoom in ›12passOpen: Tool callTool callzoom in ›13list_claims · 260 msOpen: Post-tool checkPost-tool checkzoom in ›14fenced ·no_instructions_in_result: passTRIP 2Open: Context assemblyContext assemblyzoom in ›15Open: Pre-model checkPre-model checkzoom in ›16no_known_injection: passOpen: Model callModel callzoom in ›171,284 ms · 1,544 in / 158 out ·APIM: allow-list, rate limit,Content Safety passOpen: Read the answerRead the answerzoom in ›18wants withdraw_claim(CLM-010005)Open: BLOCKED · Pre-tool checkBLOCKED · Pre-tool checkzoom in ›19policyholder_asked: hiswords named no claim ·awaitingconfirm:withdraw_claim:CLM-010005TRIP 3Open: Context assemblyContext assemblyzoom in ›20Open: Pre-model checkPre-model checkzoom in ›21no_known_injection: passOpen: Model callModel callzoom in ›221,687 ms · 1,643 in / 143 out ·APIM: allow-list, rate limit,Content Safety passOpen: Read the answerRead the answerzoom in ›23words: a candidate answerOpen: Post-model checkPost-model checkzoom in ›247 reply rules passOpen: After-loop rulesAfter-loop ruleszoom in ›25no Tier-2 rule fires · promisegate: passOpen: Before-reply checkBefore-reply checkzoom in ›26no_promise_of_cover,no_pii_echo, money_in_rupees:passOpen: Save and settleSave and settlezoom in ›27awaiting saved in facts · ledgeransweredReply: "Just to confirm, would you like me to go ahead and withdraw claim CLM-010005?"TURN 2Rohan: "yes"Open: Front doorFront doorzoom in ›28body ≤ 8 KiB · token verified →PH-1001 · kill switch onOpen: Delivery ledgerDelivery ledgerzoom in ›29new row PH-1001:<delivery id>,in_flight, expires in 600 sOpen: Anything waiting?Anything waiting?zoom in ›30nothing pendingOpen: RouterRouterzoom in ›31"yes": AgenticOpen: Consent: what his words allowConsent: what his words allowzoom in ›32AFFIRMATIVE grants the awaitedwithdraw_claim:CLM-010005, thisturn onlyTRIP 1Open: Context assemblyContext assemblyzoom in ›33Open: Pre-model checkPre-model checkzoom in ›34no_known_injection: passOpen: Model callModel callzoom in ›35651 ms · 708 in / 48 out · APIM:allow-list, rate limit, ContentSafety passOpen: Read the answerRead the answerzoom in ›36wants a toolOpen: Pre-tool checkPre-tool checkzoom in ›37consent · passOpen: Tool callTool callzoom in ›38withdraw_claim · irreversible ·344 ms (freshness re-readskipped: F-126)Open: Post-tool checkPost-tool checkzoom in ›39fenced ·no_instructions_in_result: passTRIP 2Open: Context assemblyContext assemblyzoom in ›40Open: Pre-model checkPre-model checkzoom in ›41no_known_injection: passOpen: Model callModel callzoom in ›42972 ms · 860 in / 34 out · APIM:allow-list, rate limit, ContentSafety passOpen: Read the answerRead the answerzoom in ›43words: a candidate answerOpen: Post-model checkPost-model checkzoom in ›447 reply rules passOpen: After-loop rulesAfter-loop ruleszoom in ›45no Tier-2 rule fires · promisegate: passOpen: Before-reply checkBefore-reply checkzoom in ›46no_promise_of_cover,no_pii_echo, money_in_rupees:passOpen: Save and settleSave and settlezoom in ›47checkpoint saved · ledger row →answeredReply: "Your windscreen-glass claim (CLM-010005) has been withdrawn as requested."
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 teachesAn irreversible write needs an explicit yes when the customer's words didn't name the record.

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