Agent Harness Tutorial · End to end · Zoom level 2
Inside a checkpoint
A checkpoint is one row saved at the end of each turn. It holds the conversation's text and a few short notes the code uses to behave sensibly next time.
Facts are notes for the code, not for the model: what Rohan asked, which rows were read, which writes were done (such as register_claim:POL-010001), and what is awaiting his "yes". They let the harness re-read the right rows and honour a plain "yes" without trusting the model.
Pending ids point to a payout waiting for approval or a hand-off waiting for a person. The front door checks them before anything else on the next turn.
Resuming. When Rohan opens the chat page, the newest checkpoint is resumed if it is under 24 hours old, or if something is still pending.
Forgetting. Rows older than 30 days are deleted, and one person's rows can be erased on request. Both are built; running them on a schedule on Azure is not yet.
Code view: input, process, output, the call stack, the classes
How it is done: the real code
Cut from the live repositories each time the site is built, so it always matches what runs.
agent_harness/state/__init__.py:98What one checkpoint row holdsclass Conversation(BaseModel):
"""What survives between turns.
Deliberately not the whole trace: spans are for explaining a past run, this
is for continuing one. Keeping them apart is what stops a checkpoint growing
without bound.
"""
model_config = ConfigDict(frozen=True)
conversation_id: ConversationId
customer_id: str
messages: tuple[Message, ...] = ()
recent: tuple[TurnNote, ...] = ()
"""The last few turn outcomes, newest last, capped at `RECENT_TURNS`.
Added for Tier 2 escalation, which asks how the conversation is *going* —
and nothing here recorded that. The messages hold what was said; these hold
what happened, and no rule can be written over the first."""
turn_count: int = 0
"""Every turn, not just the remembered ones. `len(recent)` stops at the cap
and a rule about a long conversation needs the real number."""
escalated_rules: tuple[str, ...] = ()
"""Which rules have fetched a person since the agent last took the
conversation back — from its start, or from the latest return.
The cooldown, in storage terms (`P-ESC-ONCE`). A Tier 2 condition does not
stop holding because an escalation lapsed, so without this the same rule
would raise, lapse and raise again for as long as the customer kept talking.
Emptied by `returned`, because what happens after a colleague hands the
conversation back is new evidence; `escalations_raised` is what stops a
loop, and it is never emptied. Which rule raised each escalation stays on
the escalation's own record."""
returned_at_turn: int = 0