Agent Harness Tutorial · End to end · Zoom level 2
The direct path
When the question is simple and safe, the harness answers it without the model at all: one read from the claims system, poured into wording a person approved in advance.
The template engine is strict: if a value is missing, it fails rather than printing a blank. So the answer is either exactly right or not sent.
The direct path is the cheapest win in the whole harness. It is about 70 times faster than the loop for the same question, costs nothing, and can never make something up.
Code view: input, process, output, the call stack, the classes
Goes ina Direct route naming a handler and one record id
What happensThe handler reads one row from the claims system with a fixed key and fills in a fixed template, with no model call.
Comes outa Completed reply, or a typed Failed
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/entrypoint/direct.py:176The direct path: one read, one approved templateasync def answer(
decision: Direct,
identity: Identity,
run_id: RunId,
tools: ToolClient,
handlers: Mapping[str, DirectHandler] = HANDLERS,
) -> TurnResult:
"""Dispatch to the handler the router named. No model call, and the trace says so."""
with tel.span("agent.direct", **{"agent.handler": decision.handler}):
handler = handlers.get(decision.handler)
if handler is None:
return Failed(
customer_message="I cannot look that up right now.",
detail=f"no deterministic handler named {decision.handler!r}",
)
return await handler(decision, identity, run_id, tools)