cleandataengineering.aiAgent Harness, drawn simply
You are here: End to end › Checks › 7 · After the loop

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.

The strip at the top is the whole turn; the dark box is where you are. Click a check, or what it catches, to see how we took care of it. Dashed boxes are not built yet.

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 rules
DEFAULT_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,

Look inside