← Table of Contents · Page 121 of 868
CONTROL STRUCTURES AND DECISION ROUTING
Part 5 of 9
EXAMPLES
Example 1: Conditional branching on sentiment.
A customer-support harness computes a sentiment score for each message, a number from negative 1 (very angry) to positive 1 (very happy).
The rule is: if the score is below negative 0.5, route the conversation to a human agent; otherwise continue with the automated agent.
The rule is deterministic, so it behaves the same way every time and a manager can verify it.
A message saying "This is the third time my order failed and I am furious" scores negative 0.8, so a human takes over immediately.
A message saying "Thanks, could you also check my invoice?" scores positive 0.4 and stays automated.
Example 2: A directed graph for a loan-approval agent.
The nodes are: collect documents, verify identity, run credit check, and decide.
The edges say what follows what.
From collect documents, the edge goes to verify identity if all documents arrived, or loops back to collect documents with a request to the applicant if something is missing.
From verify identity, the edge goes to run credit check if identity is confirmed, or to a rejected end node if identity cannot be verified.
From run credit check, the edge goes to decide.
From decide, one edge goes to an approved end node and another to a manual review node staffed by a person if the case is borderline.
Seeing this on paper, a compliance officer can confirm that nobody can be approved without passing identity verification.
That graph structure underlies the style of modern graph-based orchestration frameworks.
Example 3: Guarded repetition.
A tool that fetches a price from a supplier website times out.
The harness waits 1 second and tries again, which also times out.
It waits 2 seconds and tries a third time, which succeeds.
If the third attempt had also failed, the rule says to escalate: log the failure, tell the user the supplier site is not responding, and offer to try later.
The rule prevents giving up too early (a single hiccup would have defeated the task) and prevents trying forever.
Example 4: Hard-coded versus model-driven control.
In a research assistant, the harness always runs a safety filter on the final answer before showing it to the user.
That is hard-coded: always do step A, then step B.
But which sources to read, in what order, and when there is enough evidence is left to the model.
In a hybrid harness, the model has freedom in exploration and no freedom to skip the safety filter.
Advertisement
Read Aloud:
0:00 / 0:00