Agent Harness Tutorial · End to end · Zoom level 2
How the router decides
The router asks four questions, always in the same order. The first "yes" decides the path. If all four say no, the message goes to the loop.
Question 1 handles "not" properly. "Nobody was hurt" does not count as an injury.
Question 4 is strict on purpose. All three must hold: exactly one intent, that intent only reads (claim status, payout status, policy status), and exactly one reference of the right kind. Two claim numbers, a typo like "pol 1", or any write all go to the loop instead.
The rules have a version (v1 today), recorded on every trace, and a test checks every example message from the spec. Change a rule and the version goes up.
Limits. The rules read English words, not the database, so "my claim" always goes to the loop. Not built yet: a small local classifier for messages the rules can't place (it needs about 500 labelled examples), and a small model as a last resort.
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/router/__init__.py:260The four questions, in orderdef _decide(text: str, rules: Rules) -> Route:
for rule_id, reason, pattern in rules.escalate:
if pattern.search(text):
return Escalate(reason=reason, rule_id=rule_id, tier=1)
for rule_id, reason, pattern in rules.refuse:
if pattern.search(text):
return Refuse(reason=reason, alternative=ALTERNATIVE, rule_id=rule_id)
matched = intents_of(text, rules)
if len(matched) != 1 or matched[0] not in DIRECT_HANDLERS:
return Agentic(goal=text.strip(), candidate_intents=matched)
# P-DIRECT: exactly one intent and exactly one claim or policy — of the kind
# the handler reads. Several, or none, is the loop's.
intent = matched[0]
named = references(text)
if len(named) != 1 or not next(iter(named)).startswith(KEYED_BY[intent]):
return Agentic(goal=text.strip(), candidate_intents=matched)
return Direct(intent=intent, handler=DIRECT_HANDLERS[intent], args={"id": named.pop()})