cleandataengineering.aiAgent Harness, drawn simply
You are here: Real flows › 19 · A long conversation

Agent Harness Tutorial · Real flows

Flow 19: A long conversation

Route: Direct, then hand-off. 11 turns · 0 model calls · checkpoint 4,990 chars, far below 32,000.

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 newconversationTURNS 1 TO 9Claim and policy status questions, all Direct: front door, router, get_claim/get_policy,template, checks, save · 411–859 ms each · 0 model callsTURN 10Rohan: "Is my policy POL-010001 active?"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 ›6policy_status + one reference:DirectOpen: Direct: tool read + templateDirect: tool read + templatezoom in ›7get_policy · 305 ms · templateOpen: After-loop rulesAfter-loop ruleszoom in ›8Tier-2 rule turns-exceeded(turn_count ≥ 10) firesOpen: DBOS hand-offDBOS hand-offzoom in ›9DBOS escalation.wait: E-8E24C2A1· 86 ms · the person-neededemail alert fires (F-123)Open: Before-reply checkBefore-reply checkzoom in ›10passOpen: Save and settleSave and settlezoom in ›11pending_escalation_id saved ·HTTP 202 · 570 msReply: "I have passed this to a colleague in our claims team. Your reference is E-8E24C2A1..."TURN 11Rohan: "What's the status of claim CLM-010007?"Open: Front doorFront doorzoom in ›12body ≤ 8 KiB · token verified →PH-1001 · kill switch onOpen: Delivery ledgerDelivery ledgerzoom in ›13new row PH-1001:<delivery id>,in_flight, expires in 600 sOpen: Anything waiting?Anything waiting?zoom in ›14E-8E24C2A1 pending:HandoffDesk.hold() answers · norouter, no model · 144 msOpen: Save and settleSave and settlezoom in ›15checkpoint 4,990 charsReply: "This is with a colleague in our claims team — your reference is E-8E24C2A1. Theywill answer you here."
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 teachesTen turns is a fixed rule, not the model's judgement, and it fires even on cheap turns.

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