cleandataengineering.aiAgent Harness, drawn simply
You are here: Real flows › 2 · Reporting a claim, across two turns

Agent Harness Tutorial · Real flows

Flow 2: Reporting a claim, across two turns

Route: Agentic. Turn 1: 2 model calls · 10,536 ms · $0.00050 · Turn 2: 2 model calls · 3,471 ms · $0.00039.

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: "A bus hit my car at a signal on MG Road today, rear bumper damaged, nobody hurt."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 ›6report_claim, no policy named(router ran 3 times: message + 2clauses)Open: Consent: what his words allowConsent: what his words allowzoom in ›7register_claim:* from his wordsTURN 1 · TRIP 1Open: Context assemblyContext assemblyzoom in ›8Open: Pre-model checkPre-model checkzoom in ›9no_known_injection: passOpen: Model callModel callzoom in ›108.9 s (APIM cold) · 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_policies · 31 ms · a read,no ledger rowOpen: Post-tool checkPost-tool checkzoom in ›14fenced ·no_instructions_in_result: passTURN 1 · TRIP 2Open: Context assemblyContext assemblyzoom in ›15Open: Pre-model checkPre-model checkzoom in ›16no_known_injection: passOpen: Model callModel callzoom in ›171.5 s · APIM: allow-list, ratelimit, Content Safety passOpen: Read the answerRead the answerzoom in ›18words: a candidate answerOpen: Post-model checkPost-model checkzoom in ›197 reply rules passOpen: After-loop rulesAfter-loop ruleszoom in ›20no Tier-2 rule fires · promisegate: passOpen: Before-reply checkBefore-reply checkzoom in ›21no_promise_of_cover,no_pii_echo, money_in_rupees:passOpen: Save and settleSave and settlezoom in ›22checkpoint saved · ledger row →answeredOpen: Trace writtenTrace writtenzoom in ›2340 spansReply: "Here are the motor policies you currently have: POL-010001, POL-010004 ... pleaselet me know which"TURN 2Rohan: "pol 1"Open: Front doorFront doorzoom in ›24body ≤ 8 KiB · token verified →PH-1001 · kill switch onOpen: Delivery ledgerDelivery ledgerzoom in ›25new row PH-1001:<delivery id>,in_flight, expires in 600 sOpen: Anything waiting?Anything waiting?zoom in ›26nothing pending · checkpointcnv_f5d9… loaded: 2 messages ofhistoryOpen: RouterRouterzoom in ›27"pol 1" matches no intent:AgenticOpen: Consent: what his words allowConsent: what his words allowzoom in ›28register_claim:* read again fromturn 1's wordsTURN 2 · TRIP 1Open: Context assemblyContext assemblyzoom in ›291,222 charsOpen: Pre-model checkPre-model checkzoom in ›30no_known_injection: passOpen: Model callModel callzoom in ›311.9 s · APIM: allow-list, ratelimit, Content Safety passOpen: Read the answerRead the answerzoom in ›32wants a toolOpen: Pre-tool checkPre-tool checkzoom in ›33consent register_claim:* · passOpen: Tool callTool callzoom in ›34register_claim(POL-010001,collision) · a write · ledgerrun_fef1…:0:1 · 628 ms · claimssystem's answered row writtenOpen: Post-tool checkPost-tool checkzoom in ›35fenced ·no_instructions_in_result: passTURN 2 · TRIP 2Open: Context assemblyContext assemblyzoom in ›361,585 charsOpen: Pre-model checkPre-model checkzoom in ›37no_known_injection: passOpen: Model callModel callzoom in ›380.8 s · APIM: allow-list, ratelimit, Content Safety passOpen: Read the answerRead the answerzoom in ›39words: a candidate answerOpen: Post-model checkPost-model checkzoom in ›407 reply rules passOpen: After-loop rulesAfter-loop ruleszoom in ›41no Tier-2 rule fires · promisegate: passOpen: Before-reply checkBefore-reply checkzoom in ›42pass · reference CLM-019002namedOpen: Save and settleSave and settlezoom in ›43checkpoint saved · ledger row →answeredOpen: Trace writtenTrace writtenzoom in ›4436 spansReply: "Your new claim has been registered: Claim reference: CLM-019002 · Policy used:POL-010001 ..."
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 teachesA follow-up is only as good as the saved history: it carries both the context and the consent. Two guards stop a double claim: our ledger and the claims system's answered row.

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