Skip to main content

1.4 Multi-step workflows with enforcement and handoff patterns

Programmatic enforcement vs prompt-based guidance​

Programmatic (hooks, prerequisite gates)Prompt-based guidance
ComplianceDeterministic — 100%Probabilistic — non-zero failure rate
CostCode to write and maintainA paragraph
Use whenFinancial operations, identity verification, policy limits, regulated orderingStyle, preference, soft defaults
The rule the exam keeps testing

When deterministic compliance is required, prompt instructions alone have a non-zero failure rate. Few-shot examples and a stronger system prompt are both prompt-based — neither is an answer to "12% of the time it skips verification".

Prerequisite gates​

Block downstream tool calls until prerequisites have completed — for example, block process_refund until get_customer has returned a verified customer ID:

// Illustrative: a pre-tool-use interception with server-side state.
const verifiedCustomerId = new Map<string, string>(); // sessionId -> customerId

function gate(sessionId: string, toolName: string, input: unknown) {
const requiresVerification = ["lookup_order", "process_refund"];
if (requiresVerification.includes(toolName) && !verifiedCustomerId.has(sessionId)) {
return {
allow: false,
reason:
"Customer identity is not verified. Call get_customer first and use the returned customer_id.",
};
}
return { allow: true };
}

The denial reason matters: it is fed back to the model, which then self-corrects by calling get_customer. A silent block produces a confused agent.

Multi-concern decomposition​

For a message raising several issues ("my order arrived damaged, I was double-charged, and I want to change my address"):

  1. Decompose into distinct items.
  2. Investigate each in parallel using shared context.
  3. Synthesise a unified resolution — one reply, not three.

Structured handoff protocols​

Human agents receiving an escalation have no access to the conversation transcript. A handoff summary must be self-contained:

{
"customer_id": "cus_8842",
"order_id": "12345",
"root_cause": "Carrier damage confirmed by photo evidence; item out of stock for replacement.",
"refund_amount": 649.0,
"policy_reference": "returns.damaged.v3 — silent on out-of-stock replacements",
"recommended_action": "Approve full refund plus expedited shipping credit.",
"attempted": ["get_customer", "lookup_order", "process_refund (blocked: >$500)"]
}

Include customer details, root cause analysis, and recommended actions — this is the checklist the exam uses.

Quiz​

  1. Question 1

    Production data shows that in 12% of cases your agent skips get_customer entirely and calls lookup_order using only the customer’s stated name, occasionally leading to misidentified accounts and incorrect refunds. What change would most effectively address this reliability issue?

  2. Question 2

    A customer writes: "My order arrived damaged, I was charged twice, and I never got the discount code your rep promised me." Your agent investigates the damage claim properly with tool calls, then answers the other two from whatever context it already has, getting the duplicate charge wrong. Which workflow change matches the decomposition pattern for multi-concern requests?

  3. Question 3

    When the agent escalates, the human agent receives the full conversation transcript. Handling time has risen: humans read 40 turns to reconstruct what happened, and they have no access to the agent’s tool results — only to the text it wrote. What should the escalation produce instead?

  4. Question 4

    Identity verification must precede any account mutation. Compliance sampling across 50,000 conversations finds a 2% violation rate despite an explicit, prominent system prompt rule, and the regulator requires zero. Which implementation meets the requirement?