Agent Harness Tutorial · End to end · Zoom level 2
Check point 7: After the loop
Look at the whole turn, not one answer: is this conversation going badly enough that a person should take over?
Where: once the loop has ended.
| Check | Catches | Kind | Provided by | If it fails |
|---|---|---|---|---|
| step and time budgets | 12 trips, 60 s, going round in circles | rule | harness | stop the run |
| Tier-2 hand-off rules | declined, loop exhausted, tool down, second refusal, 10+ turns | rule | agent | hand to a person |
| promise gate | "we'll call you" with nothing behind it | rule | agent | hand to a person |
A hand-off starts a waiting workflow in DBOS: see hand-off to a person.
How it is done: the real code
Cut from the live repositories each time the site is built, so it always matches what runs.
claims_fnol/escalation/rules.py:23The six Tier-2 hand-off rulesDEFAULT_RULES: tuple[Tier2Rule, ...] = (
Tier2Rule(
id="declined",
when=(Condition(field="termination", equals=("declined",)),),
reason="a payout the policyholder's account can no longer receive",
priority=1,
ttl_s=30 * 60,
),
Tier2Rule(
id="loop-exhausted",
when=(Condition(field="termination", equals=TERMINATED_BADLY),),
reason="the agent could not complete this and stopped",
priority=2,
ttl_s=15 * 60,
),
Tier2Rule(
id="tool-unavailable",
when=(Condition(field="consecutive_failed", at_least=2),),
reason="the claims system is not responding",
priority=2,
ttl_s=15 * 60,
),
Tier2Rule(
id="repeated-intent",
when=(Condition(field="repeated_intent", at_least=3),),
reason="the policyholder has asked for the same thing three times without resolution",
priority=3,
ttl_s=30 * 60,
),
Tier2Rule(
id="second-refusal",
when=(Condition(field="refusals", at_least=2),),
reason="the agent has refused this policyholder twice and a person should decide",
priority=4,