Agent Platform for Non-Technical Users
Turn multi-channel workflow configuration into versioned, bounded actions with explicit authority and recovery.
- Kind
- Case study
- Level
- Advanced
- View
- Interview prep
- Sections
- 4
- By
- Sourav Banerjee
- Last updated
- 20 Nov 2026
Read the classic design: Safe Workflow Automation for Non-Technical Users
Interview view. The case brief, design walkthrough, technical deep dives and quick review, condensed into bullets, tables and lines to say out loud, with interactive diagrams to step through.
Want to go deep? The full casebook has the complete reasoning in prose, the original diagrams, practice questions with worked answers and the sources.
Case brief
The case in one line: a workflow acts only after deterministic code allows it, and each real action runs once.
30-Second Cheat Sheet
- The product: support leads and other non-technical staff build automations without code. Workflows listen to channels and can reply, tag, escalate or refund.
- The hard part: the person who switches it on cannot read the code that decides whether a refund runs.
- The rule: the platform makes every dangerous decision itself, in deterministic code, never in the model's judgement of the moment.
- A real action must be authorised, executed once and recoverable after a crash without paying twice.
- The running example: Cascade Robotics wants Tier-1 triage; a $500 refund request meets a $50 spend cap and is refused, not clamped.
- Two human roles: an approver or admin promotes a workflow; the author never approves their own work.
- Out of scope: the visual builder and the natural-language-to-spec compiler. Name the reviewable spec they must produce and move on.
- The demo has no LLM on purpose: its 21 tests prove the safety engine, nothing about a future model planner.
1. Let a support lead switch on actions they can trust
The product
- A business wants non-technical staff to build automations without writing code.
- A workflow listens to email, Slack, a chat widget, a web form or a ticket webhook.
- It can reply, tag a ticket, escalate it or issue a refund.
- The person who switches it on cannot read the code that decides whether a refund should run.
Why it's hard
- Wiring a model to a tool call is routine.
- Letting someone who has never seen a stack trace configure an automation that moves real money is not.
- A real action such as a refund must be:
- Authorised.
- Executed once.
- Recoverable after a crash without paying twice.
- So the platform makes the dangerous decisions itself, in deterministic code, and never hands them to the model's judgement in the moment.
The terms that carry the whole case
| Term | Meaning |
|---|---|
| Tenant | One customer business on the shared platform. Every record carries its tenant_id. |
| Canonical event | The single internal shape every channel message is translated into |
| Declarative workflow spec | Data that lists triggers, fixed steps and limits. The runtime walks it rather than executing user code. |
| Guardrail | The deterministic check that allows, denies or pauses each step |
| Idempotency | Repeating the same action has the same effect as doing it once |
The core idea (the source's figure as a flow)
canonical event → match one live workflow → guardrail allows?
- Yes → run the step once and checkpoint.
- No → refuse it, or ask for approval.
The worked example: Cascade Robotics
- A tenant that wants Tier-1 support triage.
- The support lead says: "If a customer messages us anywhere asking for a refund and it's under $50, just refund them. Don't bother me for small stuff."
- A billing complaint arrives asking for $500.
- The workflow is autonomous, but the tenant's spend cap is $50.
- The guardrail refuses the step with
spend_cap_exceeded. - It does not clamp the refund down to $50.
issue_refundis also not on Cascade's autonomous allow-list. Even after an authorised cap change, the step would pause for a human.- If the refund is ever approved and then retried, the action's idempotency key makes the retry a no-op.
Who keeps which responsibility
| Person | Responsibility |
|---|---|
| Approver or admin | Promotes a workflow through its rollout stages. The author can never approve their own work. |
| A human approver | Approves a destructive step whenever the tenant has not allow-listed that tool for autonomous use |
2. What you need to design
The task in one sentence
Design a multi-tenant platform where non-technical users configure declarative workflows, never code, that can take real, destructive actions under a guardrail service.
What the design must include
- Each channel message becomes one canonical event carrying a tenant ID.
- Routing matches it to one live workflow.
- An entity lock stops two workflows colliding on the same ticket.
- Workflows are versioned specs. A model may fill only typed values.
- Every step checkpoints.
- Idempotency is keyed on the action and checked before authorisation.
- The guardrail denies in a fixed order.
- A workflow earns autonomy one stage at a time: draft → testing → shadow → live.
Out of scope
- The visual builder and the natural-language-to-spec compiler. Name the reviewable spec they must produce and move on.
- Caveat on the demo: the source's runnable demo is deterministic and contains no LLM (large language model), on purpose.
- Its 21 tests prove the safety engine's rules.
- They prove nothing about a future model planner.
- Its in-process stores are not production storage.
Who it's for
- Engineers preparing for Forward Deployed, solutions or applied-AI interviews.
- Especially a round asking for an agent or workflow-automation platform.
What it assumes you know
- LLM agents and tool calling
- Idempotency
- Workflow state machines
- Basic multi-tenant cloud architecture
By the end you should be able to
- Explain the system end to end from its dangerous constraint.
- Answer follow-ups on:
- Authoring specs
- Routing and locks
- The execution loop
- Idempotency
- Guardrail order
- Promotion gates
- Production gaps
How the whiteboard anchor and Cascade Robotics fit together
- The source combines two cases that share one engine.
- The whiteboard anchor asks you to explain the platform design and its negative cases in sixty minutes.
- The Cascade Robotics handbook module and code project build the same engine and safety controls, then add the $500 refund against a $50 cap, conflicting workflows, a runnable demo and named implementation gaps.
| Case | Shared foundation | What it adds here |
|---|---|---|
| Agent platform whiteboard anchor (60-minute script) | Canonical events, declarative specs, deterministic guardrails, durable runs | The framing, the pipeline, determinism, durability, the guardrail, the two bugs and the close |
| Cascade Robotics (handbook module 05 and code project) | Same workflow engine and safety controls | The $500 refund on a $50 cap, conflicting workflows, the three-layer map, a runnable demo and its gaps |
| Self-drill add-on | The same design under a cost pivot | Stopping runaway automations before the invoice does |
- The timed sixty-minute plan and the self-check questions are in the full casebook (Practice).
Quick Recall: Lines to Say in the Interview
- "A workflow acts only after deterministic code allows it, and each real action runs once."
- "Wiring a model to a tool call is routine. Letting a non-programmer move real money safely is not."
- "The platform makes the dangerous decisions itself, in code, never in the model's judgement of the moment."
- "A $500 refund on a $50 cap is refused with
spend_cap_exceeded, never clamped to $50." - "Autonomous or not,
issue_refundisn't allow-listed for Cascade, so it would still pause for a human." - "A retried refund is a no-op because the idempotency key is on the action."
- "The author never approves their own workflow."
Design walkthrough
The goal: a multi-tenant workflow platform where every dangerous decision is made by deterministic code, every real action runs once, and a crash or retry never pays twice.
30-Second Cheat Sheet
- Frame it as trust, not tool selection, in the first two minutes. Function calling has been a standard API feature since June 2023.
- Anchor on one refund: Cascade Robotics' $500 request against a $50 cap is refused, never clamped.
- Requirements are testable constraints, each with an owning component. The source demo proves them with 21 deterministic tests, no LLM.
- The pipeline: adapter → canonical event → priority match → entity lock → checkpointed orchestrator → typed args → idempotency check → guardrail → scoped tool → checkpoint. Three exits: completed, paused for approval, halted.
- Route twice: priority says which workflow should run; the entity lock says whether two can run at once.
- Control flow is data: the orchestrator walks a versioned spec; the model fills only typed values.
- Five ordered deny rules, two allows: step budget, spend cap, shadow, not live, needs approval. Deny overrides allow.
- Autonomy is earned:
DRAFT → TESTING → SHADOW → LIVE → AUTONOMOUS, one stage at a time, never self-approved.
Opening line (source's framing): "Anyone can wire an LLM to a tool call. The hard part is letting someone who has never seen a stack trace configure that safely, which means the system has to make the dangerous decisions itself, deterministically, and never delegate them to the model's judgement in the moment."
1. Frame the round as trust, not tool selection
Why this framing first
- Say the framing sentence in the first two minutes.
- A design that starts with an LLM choosing tools spends forty minutes on the wrong thing.
- Function calling has been a standard model API feature since June 2023 (OpenAI: function calling and other API updates).
The prompt
- As quoted in a company's system-design prep guide: "Design an AI agent platform for non-technical users to configure workflow automations across multiple channels."
- Four phrases carry it:
| Phrase in the prompt | What it really means |
|---|---|
| "AI agent" | Looks at an event and takes an action (reply, refund, escalate, tag), not only answers a question |
| "platform" | Not one workflow: many tenants, each defining many workflows |
| "for non-technical users to configure" | The builder is not a programmer and should never need to read a stack trace |
| "across multiple channels" | The same automation fires from email, Slack, a chat widget, a web form or a raw webhook |
Five clarifying questions, in this order
| Question to ask | What it's really asking | What the answer decides |
|---|---|---|
| How non-technical is the author: forms, templates or plain-English creation? | Do they pick a template, fill a form, or type "refund angry VIP emails"? | Authoring UI and the reviewable spec. Whether natural-language authoring is a nice-to-have or the whole product. |
| Which channels, and who owns each integration? | Is Slack ours, and if two copies of the same email arrive, who dedups? | Adapters, threading and dedup. Slack and webhook are easy; email threading and web-form dedup hide the real work. |
| Are actions read-only, reversible or destructive? | Tag a ticket, or refund $500? | Approval, spend caps and audit. Write actions make this a guardrail problem, not a UI problem. |
| What is the blast radius of a bad workflow? | If someone publishes a loop, can it refund every customer tonight? | Default budgets, rollout gates, how aggressive default guardrails are. A wrong Slack reply is embarrassing; a wrong refund is money. |
| Is multi-tenancy required from day one? | Can Acme's workflow accidentally run on Globex's tickets? | A tenant ID on every event, spec, lock and policy. Whether isolation is a retrofit or load-bearing from the start. |
Then scope out loud
Spoken answer (source's version): "I'll design for a multi-tenant platform where non-technical users configure declarative workflows, never code, that can take real, destructive actions under a guardrail service. I'm explicitly not designing the visual builder UI or a natural-language-to-spec compiler. Those are their own projects; I'll name what they need to produce and move on."
2. Anchor every answer on one $500 refund
The tenant
- Cascade Robotics wants Tier-1 support triage across two channels:
- A Zendesk webhook for new tickets.
- An
#support-escalationsSlack channel for urgent messages.
- A high-priority ticket gets a drafted reply.
- A billing complaint also gets an automatic refund up to $50, a hard cap.
- A refund above it is refused outright, even with approval. Raising the cap is a separate, authorised policy change.
- A duplicate or retried step must never issue a second refund.
Six guarantees hidden inside "just refund them"
- The lead's sentence ("under $50, just refund them") names none of the machinery.
| Guarantee | Component |
|---|---|
| Email, Slack DM and widget messages become one internal shape before any decision | Channel adapters |
| Only refund messages fire the workflow, and exactly one workflow wins | Routing |
| The workflow went draft → test → shadow → live and someone with authority approved it | Staged rollout |
| "Under $50" is a spend-cap check at execution time, not a sentence in a prompt | Guardrails |
| A retried refund call refunds once | Idempotency |
| A restart mid-run resumes rather than restarting | Durable, checkpointed execution |
The demo question that drives the round
- "Why didn't Cascade Robotics' $500 refund fire automatically?"
- Three follow-ups test whether you can separate the reasons:
| Question | What actually happened |
|---|---|
| Wasn't the workflow autonomous? | Yes, but autonomy never bypasses the cap, which denies first under ordered deny. issue_refund was also not allow-listed for autonomous use on this tenant, so even after an authorised cap change it would pause for a human. |
| Wasn't there budget? | The tenant's spend cap is $50. A $500 refund is refused outright (spend_cap_exceeded), never silently clamped down to the cap. |
| What if it retries and refunds twice? | It can't. The idempotency key on that action exists after the first apply, so a retry is a no-op. |
Why refusing beats clamping
- A $50 refund on a $500 complaint is a decision nobody made.
- The customer and the support lead both learn about it only afterwards.
Soundbite (source): "Notice the refund cap isn't a nice-to-have. It's the difference between 'the agent can act autonomously' and 'the agent can act autonomously up to the point where a mistake actually costs real money, and then it stops and asks.'"
3. State requirements as testable constraints
- A requirement that can't fail a test is a preference.
- The source project proves every safety claim with a deterministic test, including the negative cases.
- Functional = what the system does. Non-functional = how well, under what constraints.
The eight must-haves
- Normalise every channel into one canonical event with a tenant ID.
- Route each event to exactly one live workflow, or to none with a named reason.
- Store workflows as versioned, declarative specs.
- Validate typed tool arguments before execution.
- Checkpoint execution so a crash resumes mid-run.
- Make destructive side effects idempotent.
- Run a per-step guardrail covering budget, spend cap, rollout stage and approval.
- Promote through staged rollout (draft, testing, shadow, live, autonomous) under separation of duties.
Four behaviours that make them concrete for Cascade
- A $500 refund on a $50 cap is refused, never clamped.
- Autonomous status cannot bypass the cap.
issue_refundneeds an allow-list entry or human approval.- A retry cannot refund twice.
Should-haves (after the safety core is trusted)
- A template library with
clone(). - Natural-language authoring compiled to a reviewable spec.
- A plain-language run history.
- Automatic retries around
resume(). - Gradual migration between live versions.
Non-functional requirements
| Requirement | Example target or constraint |
|---|---|
| Security | Tenant isolation; no unauthorised destructive action; author ≠ approver |
| Spend | Actual-dollar caps; maximum steps and cost |
| Reliability | Crash recovery; idempotency under redelivery; one active run per target entity |
| Audit | Every allow and deny recorded |
Constraints stated so a test can fail them
| Constraint | Stated so it can be tested |
|---|---|
| Safety | A destructive action never executes without explicit human approval or an explicit per-tenant allow-list entry, even on a fully autonomous workflow |
| Money | A $500 refund against a $50 cap is refused outright, never clamped; the cap uses the real dollar amount |
| Idempotency | A retried or redelivered action never applies twice; external call count stays at 1 |
| Durability | A crash mid-run never re-runs a completed step |
| Runaway | A 30-step workflow halts at a 5-step cap instead of looping |
| Concurrency | A second run on an in-flight ticket is refused with entity_locked |
| Separation of duties | Nobody promotes their own workflow, and no stage can be skipped |
| Tenancy | Every event, workflow and policy carries tenant_id; caps are per tenant; routing matches only a tenant's own workflows |
| Auditability | Every guardrail decision, allowed or denied, is on the run's event log with a named rule and reason |
| Testability | 21 tests, deterministic, no LLM, well under a second |
- Caveat: the 21 tests show the safety engine's behaviour, not a future LLM planner's.
Give every requirement an owner
- The traceability table lets an interviewer point at any box and ask which requirement it protects.
| Requirement | Primary component |
|---|---|
| One shape for every channel | Channel adapters |
| Exactly one workflow per event | Routing: priority plus entity lock |
| Declarative, versioned workflows | Workflow store |
| Typed arguments | Tool registry with validate_args() |
| Crash-safe execution | Orchestrator checkpoint, next_step_index |
| No double side effect | Idempotency store keyed {tenant_id}:{run_id}:{step_name}:{args_hash} |
| Budget, cap, stage, approval | Guardrail engine, authorize_step() |
| Rollout discipline | promote() with role checks |
| Replayable record | Run trace |
Spoken answer (source's short version): "Functionally, one event, one versioned workflow, typed args, checkpointed steps. Non-functionally, tenant isolation, real spend caps that refuse not clamp, recover after crash, execute once."
4. Draw the architecture end to end
Nouns before boxes
- The nouns are the contract every box shares: Event, Channel, WorkflowSpec (versioned), Trigger, Step, Tool, Run, Guardrail, Principal.
Principal = whoever is acting: an author, an approver, an admin or the system itself.
Narrate one event before drawing
- A ticket webhook arrives; a channel adapter normalises it into a canonical event.
- Routing finds the highest-priority live workflow that triggers on it, and checks no other run is active on that ticket.
- The orchestrator executes steps one at a time and checkpoints after each.
- A non-destructive step (drafting a reply) runs straight away after the budget checks.
- A destructive step (issuing a refund) goes through the full guardrail first:
- Is the workflow live enough to act?
- Is this tool allow-listed for autonomous use?
- Is a human needed?
- Does it fit the spend cap?
- If it passes, it executes with an idempotency key, so a retry can never double-refund.
- Every decision, allowed or denied, is logged.
The source's figures, in words
| Figure | What it shows |
|---|---|
| The anchor's whiteboard | A straight pipeline: raw payload → adapter → canonical event → priority match → entity lock check → durable orchestrator → resolve step and validate arguments → guardrail → idempotent execution → checkpoint. Label the two routing decisions. Exactly three exits: completed, paused for approval or halted. |
| The authoring plane | Builder or NL-to-spec compiler (both implementation gaps) → draft WorkflowSpec → approver or admin promotes one stage at a time → versioned workflow store → live workflow selection |
| The runtime plane | Idempotency check splits replays (no-op) from new steps (authorised against tenant policy). Inputs: tenant policy (spend cap, max steps, destructive-tool allow-list) and a role-checked human approver. After the side effect, the checkpoint lands in the lock, idempotency, run and trace stores. |
| The detailed runtime | Every named exit: no_trigger_match, entity_locked, HALTED when validate_args rejects the typed schema, then the replay question "idempotency key already applied?" before authorize_step checks budget, cap, shadow, live and allow-list or approval |
- The authoring plane changes what may run. The runtime plane decides whether a given step runs now.
- The registry holds four tools:
draft_reply,tag_ticket,issue_refund,close_ticket. Refund and close-ticket are destructive. - The live workflow store supplies runtime selection; tenant policy and approval stay separate execution checks.
Components: job and what breaks without each
| Component | Job | What goes wrong without it |
|---|---|---|
Channel adapters (from_webhook, from_slack, from_email) |
Translate each payload once into Event | Every downstream component learns every channel, forever |
| Canonical Event | channel, event_type, tenant_id, target_entity_id, payload, raw_ref |
No tenant scope, no lock key, no audit pointer |
Routing (matching_workflows, route) |
Highest-priority live workflow, or a named non-selection | Two workflows both claim the event, or a silent no-op |
Entity lock (acquire_lock, release_lock) |
One active run per target entity | A priority misconfiguration becomes a concurrent-mutation bug |
Workflow store (WorkflowStore) |
Every version kept; a run pins to its version | Editing a workflow changes runs already in flight |
Tool registry (REGISTRY, validate_args) |
Typed schema, required fields, destructive flag, scopes | A hallucinated or wrong-typed argument reaches a real system |
Orchestrator (run_workflow, resume, _continue) |
Walks the step list, checkpoints after each step | A crash re-runs completed steps |
Idempotency store (_apply_side_effect) |
First apply of a key wins; repeats are no-ops | A redelivered event refunds twice |
Guardrail engine (authorize_step) |
Five ordered deny rules, two allows | A destructive step runs without authority |
Tenant policy (GuardrailPolicy) |
Spend cap, max steps, autonomous allow-list | One tenant's risk appetite applies to another |
Promotion (promote) |
One stage at a time, approver or admin only | An author ships their own workflow straight to live |
Run trace (observability.py) |
Every decision with rule and reason | Nobody can say why a refund did or did not fire |
4.1 The same path, step by step
- In the demo the runtime is a fixed, versioned step list.
- A future LLM may propose a typed value or a draft spec; code controls routing, argument schema, policy, approval, execution and resumption.
- Adapter: translates a payload once into an event with channel, event type, tenant, target entity, payload and raw reference.
- Routing: matches only that tenant's live workflows, picks the highest priority, returns a named reason if none matches. An entity lock prevents concurrent mutations of the same ticket.
- Orchestrator: pins the workflow version and resumes at
next_step_index, using the same loop for fresh and restarted runs. - Resolve and validate: values resolved, the tool's typed schema validated. A model may supply proposed values but cannot change the spec or the tool signature.
- Idempotency: after caller and tenant access checks, and before authorisation, the action-level key is checked. A replay is a no-op and isn't charged again.
- Guardrail: the tighter of the workflow and tenant step and spend caps, shadow or live stage, destructive-tool allow-list or human approval. Deny wins; approval pauses safely.
- Execute: only an allowed step calls the scoped tool. Record the outcome, checkpoint, log every decision, continue or finish.
5. Translate every channel once, at the edge
- Normalise at the first layer and nowhere else. If channel logic leaks past the adapter, every later component must know every channel forever.
The six-field canonical Event
| Field | Why it's there |
|---|---|
channel |
Triggers match on it |
event_type |
Triggers match on it |
tenant_id |
Scopes everything downstream |
target_entity_id |
What the entity lock keys on |
raw_ref |
Normalisation isn't destruction: the original payload is always recoverable for audit |
payload |
The content step templates read |
- Five of the six fields carry the design;
payloadcarries the content. - Downstream of the three adapters (
from_webhook,from_slack,from_email), nothing knows the channel except by readingevent.channel. - Adding a sixth channel = one new adapter, zero changes anywhere else.
Adapters do more than map fields
- The Slack adapter classifies
urgent_messagevs plainmessagefrom the raw urgency flag. - That's how Cascade's
wf_slack_escalationtriggers only on urgent messages.
6. Route twice: priority for configuration, a lock for safety
- Priority answers a configuration question: which workflow is supposed to win.
- The entity lock answers a safety question: can two workflows ever mutate the same ticket at once.
Routing in three steps
- Match. Every workflow whose tenant, status and trigger fit the event. A Trigger is
(channel, event_type, priority).- A
DRAFTworkflow never matches a real event. That one rule makes authoring safe. - A
SHADOWworkflow needs live traffic but must not compete for it. If exclusive selection included it, a higher-priority shadow workflow would take the event and nothing real would happen. - So give shadow workflows a mirrored copy of the event, outside priority selection and the entity lock.
- A
- Prioritise. The highest priority wins.
- Lock.
acquire_lock(target_entity_id, run_id)refuses if another run is active on the same entity.- In the demo the refused event ends there.
- In production, record it and replay it after the lock is released, or a customer's follow-up on an in-flight ticket is silently skipped.
route()returns the workflow or a named reason,no_trigger_matchorentity_locked. Never a silent no-op.
Cascade's conflict fixture
| Workflow | Priority | Trigger | Result |
|---|---|---|---|
wf_ticket_triage |
10 | webhook / ticket.created |
Wins |
wf_legacy_ticket_tagger |
1 | webhook / ticket.created |
Loses |
Soundbite (source): "Priority answers which workflow SHOULD run. A lock answers whether two ever CAN run at once: two different questions, two different checks."
Each check covers the other's blind spot
- Only priority → a configuration mistake becomes a concurrent-mutation bug.
- Only the lock → no way to say which workflow should win.
- The lock still holds when two workflows are accidentally given the same priority.
- Production: database uniqueness, or a distributed lease checked with a fencing token, not the demo's in-process dict (see the gaps deep dive).
7. Keep control flow in data, and let the model fill only typed values
- The prompt tests whether you split deterministic control flow from probabilistic reasoning.
- The model may decide that a refund is warranted. It never decides the shape of the call that moves money.
Bad: tool_call("issue a refund of about fifty dollars for this order")
Good: issue_refund(order_id: str, amount_usd: float) <- typed, validated BEFORE execution
The WorkflowSpec
- A declarative document:
workflow_id,version,status,triggers,steps,max_steps,max_cost_usd. - Each Step names a tool and an
args_template, such as{"amount_usd": "{payload.refund_amount}"}, resolved from the event at execution time. - The orchestrator doesn't execute the spec as code; it walks it.
- Nobody, human or model, changes the step list at runtime.
A spec a non-technical user can review
- "Refund anyone under $50" becomes a form showing the trigger, the
amount < $50condition and theissue_refundaction. - The user confirms it before anything runs.
- A visual builder, or an eventual natural-language compiler, produces this reviewable draft spec. The runtime never executes free text as code.
Five determinism controls (all built and tested in the source)
| Control | What it prevents | Where |
|---|---|---|
| Constrained tool schemas over free-text arguments | A hallucinated or wrong-typed argument reaching a real system | validate_args(), before execution |
| Idempotency keys on side-effecting calls | A retried step applying its side effect twice | Orchestrator (see the idempotency deep dive) |
| Max-step and max-cost budgets, halt and escalate | A runaway run | authorize_step(), tighter of workflow and tenant (step 8) |
| Confirmation gates on destructive actions, per tenant and tool | An irreversible action without authority | Guardrail approval plus per-tenant allow-list (step 8) |
| Deterministic control flow split from probabilistic reasoning | The model improvising what happens next | The fixed, declarative step list |
The tool registry
- Four tools: two destructive (
issue_refund,close_ticket), two not (draft_reply,tag_ticket). destructiveis declared once at registration. The guardrail asks "is this one of the tagged ones?", never "does this call look risky?"- A guardrail can't reason about risk it isn't told about explicitly.
scopeslists what the tool may touch: the start of least privilege for connector credentials.
The non-technical product surface: what's built
| Constraint | In plain language | Built? |
|---|---|---|
| Templates, not a blank canvas | Clone "Auto-refund small orders" and change the numbers | Not built: clone() over pre-built specs is the low-effort fix |
| Plain English compiles to a reviewable spec | The sentence becomes a form you confirm | Partial: the spec is the form; the compiler isn't built |
| A test mode where nothing happens | Shadow mode fakes every write | Built: SHADOW blocks every destructive step unconditionally, even for an admin. A non-destructive write such as tag_ticket still changes Zendesk unless its adapter is also mocked, so mock every write in shadow |
| Run history in human words | "Refunded 12, escalated 2, denied 1 for exceeding the cap" | Not built: the trace is structured; a sentence per step is low effort |
| Staged rollout, like a driving test with levels | One stage at a time; the author can't grade their own test | Built: promote() |
Versioning
WorkflowStorekeeps every published version.- A Run pins to the version it started on, so editing a workflow never changes runs in progress.
Where a model fits later
- The runnable project has no LLM, on purpose, so its tests prove deterministic behaviour.
- A future LLM might propose values or a draft spec; schema validation, policy and human promotion stay deterministic.
- An open-ended planning loop (a model picks the next tool) would be a separate change, bounded by the same step, spend and authorisation controls.
Soundbite (source): "The model decides THAT something should happen. A typed, validated function signature decides HOW. That boundary is where determinism lives."
8. Deny in a fixed order, and let deny override
- Every step of every run goes through one decision:
authorize_step()returnsDecision(allowed, rule, reason). - Deny overrides allow. Fixed order → the same step always gets the same answer, and the trace can name exactly which rule stopped it.
| # | Rule | Denies when |
|---|---|---|
| 1 | step_budget_exceeded |
The run has used its step allowance: the tighter of the workflow's max_steps and the tenant's |
| 2 | spend_cap_exceeded |
Spend so far plus this step's real cost (the actual refund amount for a financial tool) would exceed the cap, again the tighter of workflow and tenant |
| 3 | shadow_mode |
The workflow is in SHADOW; destructive steps never execute here, regardless of role or approval |
| 4 | not_live |
The workflow hasn't been promoted to LIVE |
| 5 | needs_human_approval |
Destructive, not allow-listed for autonomous use on this tenant, and no approver present |
| Allow | autonomous_allowlisted / human_approved |
The two ways a destructive step is actually allowed to run |
- Non-destructive steps pass after the two budget checks.
- Destructive steps must clear all five rules, then match one of the two allows: seven rules in all.
- The whiteboard script draws the same logic as a seven-line ladder with "non-destructive? just run it" as its third rung. The five-rule table is the cleaner version to draw.
Step budget ≠ spend cap
| Check | Counts | Catches | Example |
|---|---|---|---|
| Step budget | How many steps a run has taken | A loop, however cheap each step is | A 30-step chain of cheap steps trips a 5-step cap |
| Spend cap | Dollars, the run's total including the step about to execute | One expensive action on step one | A single $500 refund trips a $50 cap |
- They're not two severities of one check.
- The spend cap adds each step to a running total; bug 2 only makes sense because of that.
- Both halt and escalate. Neither retries, and neither clamps the amount down to fit.
The spend cap must read the right number
- The source found a bug: a $500 refund passed a $5 cap because the cost function charged a nominal per-call fee.
- The fix reads
amount_usdfrom the validated financial arguments. (Full story, with the second bug, in the idempotency deep dive.)
Soundbite (source): "Autonomous status raises the ceiling on which actions can skip approval. It never removes the ceiling itself."
Tenant policy
GuardrailPolicy(spend_cap_usd, max_steps, allowed_destructive_tools_autonomous).- A workflow's own limits can be tighter than its tenant's, never looser.
- The autonomous allow-list belongs to the tenant alone.
- So Cascade's autonomous workflow still can't refund $500: autonomy changes the approval question at rule 5, but rule 2 has already denied the step.
Build the negative control: seven denials
- The source's
scripts/demo_guardrail_failure.pyshows:
wrong_role: the author can't promote their own workflow.cannot_skip_stage: a draft can't jump to autonomous.type_mismatchor missing arguments: rejected before execution.not_live: a draft workflow never fires a destructive step.spend_cap_exceeded: a 500 USD refund against a 50 USD cap is refused, not clamped.step_budget_exceeded: a 30-step workflow halts at the 5-step cap.entity_locked: a second run on an in-flight ticket is refused.
- A demo that shows things being stopped proves more than one that shows things working.
- Each denial gives the author a rule name and a plain reason in the trace, which turns a refusal into something a support lead can understand.
9. Make autonomy something a workflow earns
DRAFT → TESTING → SHADOW → LIVE → AUTONOMOUS, one stage at a time.- Only an approver or admin may promote, never its author.
- Each stage removes exactly one kind of "we don't actually know yet".
| Stage | The one question it answers | What breaks if skipped |
|---|---|---|
| DRAFT | Is this even wired correctly? | The first idea is tested against real customer messages |
| TESTING | Does it behave correctly on realistic input (sample or historical data)? | It's found wrong only once it's watching live traffic |
| SHADOW | Does it decide correctly on live traffic, with every write mocked? | Bad decisions surface only after a real refund |
| LIVE | Will a human still vouch for each individual action? | Straight from "looked fine in shadow" to acting alone |
| AUTONOMOUS | Has it earned the right to act without asking every time? | The destination, not a gate; the same guardrails still apply |
Why four gates, not fewer or more
- Fewer gates lose a distinct answer.
- Merge TESTING into SHADOW → cheap, repeatable replay disappears.
- Merge SHADOW into LIVE → debugging moves into production.
- More gates add stages someone must remember to promote through, and the guardrail policy already scales risk within a stage.
promote(store, workflow_id, to_status, signer) denies two things
wrong_role: an author can't promote their own work; only an approver or admin can promote at all.cannot_skip_stage: no jump such as DRAFT to LIVE.- The identity fixture includes
u_author_wrong_hat: a negative control proving an author can't approve their own work however the request is framed.
The two follow-ups the round always gets
| Follow-up | Answer |
|---|---|
| How does a user try a workflow before it's live? | Shadow mode: it sees live traffic with every write mocked |
| How is a bad one stopped mid-flight? | The step and spend budgets halt it; the entity lock stops a second run compounding the damage |
10. Ship one safe workflow first, and name the gaps
Week one
- One channel, one non-destructive workflow.
- Prove the negative guardrail cases and staged promotion before enabling refunds.
Spoken answer (source's forward-deployed close): "If I were shipping this, week one isn't the full agent runtime. It's: one channel, one non-destructive workflow, the guardrail engine, and the staged rollout. Prove that a non-technical user's workflow genuinely can't take an unapproved destructive action, before anyone argues about which LLM plans the steps."
Name the gaps before the interviewer does
- No LLM at all, on purpose, so every property is proven with fast, reproducible tests. Never imply the demo proves an LLM planner is safe.
- In-process locks and idempotency dicts aren't shared across workers. Production needs:
- A distributed lock: database uniqueness, or a Redis lease checked with a fencing token.
- A durable shared idempotency store.
- Also missing:
- Visual builder
- Natural-language-to-spec compiler
- Real LLM planner
- Automatic retry wrapper
- Secret vault integration
- Output PII redaction
- Gradual version migration
- A compiled natural-language spec lands in
DRAFTfor review, never straight inLIVE.
PII = personally identifiable information.
- The gaps deep dive gives each gap a status, an effort estimate and what to say.
Quick Recall: Lines to Say in the Interview
- "The hard part isn't tool selection; it's letting a non-programmer trust an automation that moves money."
- "A $500 refund on a $50 cap is refused, not clamped. Clamping is a decision nobody made."
- "Priority says which workflow should run. The lock says whether two can run at once."
- "The orchestrator walks a versioned spec. The model fills typed values, never the shape of the call."
- "Five ordered deny rules, two allows, and deny overrides."
- "The step budget catches a loop; the spend cap catches one expensive action."
- "Autonomy raises the ceiling on what skips approval. It never removes the ceiling."
- "Draft, testing, shadow, live, autonomous: one stage at a time, never by the author."
- "Week one is one channel, one non-destructive workflow, the guardrail engine and staged rollout."
Technical deep dives
The goal: survive the follow-ups on durability, idempotency, multi-worker safety and cost, and tell the two real bugs as stories.
30-Second Cheat Sheet
- One loop, no separate recovery path:
run_workflow()andresume()both call_continue(), starting atnext_step_index. - Three terminal states:
COMPLETED,PAUSED_FOR_APPROVAL,HALTED_BUDGET.CRASHEDis transient. - Key idempotency on the action:
{tenant_id}:{run_id}:{step_name}:{args_hash}, checked before authorisation. - Bug 1: a $500 refund passed a $5 cap because cost was a nominal 0.02 USD fee. Fix: read
amount_usd. - Bug 2: a replayed refund was charged again and falsely tripped the cap. Fix: idempotency check before
authorize_step(). - Scale = same mechanism, new storage: a unique-constraint row or a Redis lease with a fencing token, plus a durable shared idempotency store.
- Cascade Robotics adds the three-layer map: spend most of the hour on Layers 2 and 3.
- Cost pivot: caps per run, a budget and breaker per tenant, idempotent actions. Measure, route, bound, cache.
1. One checkpointed loop for fresh runs and resume
No separate recovery path
- A recovery path that's different code gets tested only during incidents.
- So one loop always starts wherever
next_step_indexsays. - The checkpoint is one integer on the Run. After each completed step, the run saves the next index.
run_workflow()andresume()both call the same_continue()loop, so recovery is exercised on every run.- Resume never reruns step 0.
The demo proves it with a real crash
run_workflow(..., crash_after_step=0)sets the state toCRASHEDafter the checkpoint is saved.resume()continues from step 1.- The external call count shows step 0 never ran again.
Run states
| State | Meaning |
|---|---|
COMPLETED |
Terminal: every step done |
PAUSED_FOR_APPROVAL |
Terminal until an approver resumes it |
HALTED_BUDGET |
Terminal: a budget or cap stopped it |
CRASHED |
Transient; resume() clears it |
- No fourth "it just stopped and nobody knows" path.
The verified happy path: run_001
- From
scripts/run_workflow_demo.py, onwf_ticket_triagev1.
- Step 0, the draft reply, applies at 0.02 USD operating cost.
- Step 1, the refund, is denied without approval; the run pauses.
- A process restart, or an approval arriving an hour later, resumes at
next_step_index = 1. - The valid approval lets step 1 execute and record its idempotency key.
- The run completes.
- A repeated step 1 finds the same key already present → no-op, no duplicate refund.
Soundbite (source): "There's no separate crash-recovery code path. resume() and a fresh run call the exact same loop. It always starts at next_step_index, whether that's 0 or the middle of a long-running workflow. One loop, one set of bugs to find, not two."
Approvals that never come, and the lock
- In the demo, an approval that never arrives leaves the run in
PAUSED_FOR_APPROVALindefinitely. It doesn't silently expire into either action. - An expiry or escalation policy would be a production addition, not existing behaviour.
- Decide whether a paused run keeps its entity lock.
- If it does, every later event on that ticket is refused for as long as the approval waits.
- So a production lease needs an expiry tied to the approval timeout.
- A resumed run must check it still holds the lock.
Beyond the source
- A checkpoint saved after a step can't cover the moment between an external effect landing and the checkpoint being written.
- That gap is why the action-level key exists, and why production still needs downstream idempotency or reconciliation.
- Don't claim exactly-once external transactions from the demonstrated crash point alone.
2. Key idempotency on the action, and cover every side effect
Why the action, not the run
- A run legitimately retries after a transient failure, so a run-level "already started" flag can't stop one step firing twice.
- At-least-once delivery can also replay an action around a crash.
idempotency_key = f"{tenant_id}:{run_id}:{step_name}:{args_hash}"
At-least-once delivery = a channel may deliver the same message more than once, never zero times.
How the key evolved
- The reference build keyed on
{run_id}:{step_name}alone. - Adding tenant and an arguments hash stops a retry with different arguments, or another tenant's run, from matching.
- The hash works only if a retry hashes the same bytes.
- Resolve and canonicalise the arguments once, persist them with the checkpoint, hash the stored copy.
- Re-resolving
50as50.0on a retry → a new key and a second refund.
_apply_side_effect()returns True only the first time a key is seen.- Reruns of the loop are fine; reruns of an applied side effect are not.
- Verified result: before retry, 1 apply; after retry, still 1 apply.
Durable store and provider keys
- The key needs a durable store shared across workers.
- Pass the same key to a provider when it supports one. Stripe, for example, returns the original result for a retried call with the same key.
- Two Stripe limits:
- It rejects a reused key whose parameters differ.
- Its v1 API may prune keys after 24 hours. A run resumed a day later can't rely on the provider key alone: check the platform's own record or reconcile with the provider first.
Channel redelivery is normal
- Slack's Events API treats a delivery as failed when no 2xx arrives within three seconds, and retries up to three times, each marked with an
x-slack-retry-numheader. - The adapter should acknowledge fast, process asynchronously and deduplicate on Slack's
event_id.
Two real bugs: tell them as stories
| Bug 1: the spend cap checked the wrong number | Bug 2: idempotency covered the side effect but not its cost | |
|---|---|---|
| Symptom | A $500 refund on a workflow with a $5 cap passed authorisation | An approved run whose refund was retried failed with spend_cap_exceeded |
| Cause | The cost function charged a flat nominal fee per tool call (fine for a draft reply); the cap checked 0.02 USD every time. It conflated operational cost with dollars spent for the customer. | The guard skipped the second refund, but the retry still went through authorize_step() and its cost was added again: a false cap denial |
| Fix | A financial tool's cost is the real amount in its own arguments, args["amount_usd"]. Keep inference and tool operating cost separate from money moved. |
Move the idempotency check before authorisation. After caller and tenant access checks, a replay is a free no-op that never touches budget or approval, and it may advance the checkpoint. |
Soundbite (source): "Idempotency has to cover every side effect of a step, not just its most obvious one."
- Cost accounting is a side effect too, and so are audit semantics: the API call, the budget and the trace must agree that one action happened.
- The anchor links bug 1 to a false-security-alarm bug in the RAG project: both are safety checks that look like they measure something while measuring the wrong quantity.
RAG = retrieval-augmented generation.
- Caveat when quoting: the bug story uses a $5 cap; the Cascade tenant policy uses $50. Both are the source's figures, from different scenarios.
Beyond the source
- A retry with different arguments has a different
args_hash: it's a new action needing fresh validation and authority, not inheriting an old approval. - A redelivered channel event must map back to the same logical run. If every delivery created a fresh
run_id, the key would never match. - Durable event-to-run deduplication is the production piece that makes "redelivery is a no-op" hold across workers.
- It needs a stable delivery identifier, such as Slack's
event_idor an email Message-ID. - The six-field canonical event doesn't carry one: add one, or derive it from
raw_ref.
- It needs a stable delivery identifier, such as Slack's
3. Multi-worker safety and honest gaps
The scale answer
Spoken answer (source): "Every lock and idempotency key in this demo lives in an in-process dict: correct in shape, wrong in storage. At real volume that becomes a distributed lock (a unique-constraint row in a database, or a Redis lease checked with a fencing token) and a durable idempotency store shared across workers. The mechanism doesn't change; acquire_lock/release_lock stay the same two functions. Only where they're backed changes."
Why a fencing token
- A lease can expire while its holder is paused.
- The protected resource checks a monotonically increasing token, so a worker with a stale lease can't keep writing after another worker takes ownership (Kleppmann; Redis docs).
- A database unique-constraint row is the simpler alternative when one store already owns the entity.
Fencing token = a number that rises on every lock grant; the resource rejects writes carrying an older number.
- Two limits:
- The token must come from something that increases on every grant, such as a database sequence. Kleppmann notes Redlock doesn't produce one.
- Only a resource that checks the token is protected. A payment provider won't, so for an external refund the provider idempotency key and reconciliation remain the safeguard.
The gap table
| Gap | Status | What to say |
|---|---|---|
| Planner | Partial: fixed step list | Swapping in an LLM or rule engine that picks the next tool is a moderate change. The architecture stays: a reasoning loop with deterministic guardrails around it |
| Authoring surface | Partial / not built | The spec is what a builder would serialise to. NL-to-spec needs a real LLM call; its output enters at DRAFT behind the same promote() gate |
| Automatic retries | Not built | resume() is correct, but nothing calls it automatically. A retry wrapper with backoff is low effort because idempotent resumption is done |
| Connector secrets | Not built | A Connector model referencing a vault secret is moderate; the vault itself is infrastructure |
| PII redaction | Not built | Low effort. The RAG project's redact_pii() is reusable on step outputs before a human sees them for approval |
| Custom tools | Partial | Schema validation and scoping exist. Sandboxed execution and review-before-publish reuse promote()'s role-gated pattern |
| Gradual version migration | Not built | A traffic_split on the spec, consulted by routing |
- Production also needs: durable run, lock and idempotency stores shared across workers; scoped connector credentials; observability; a tenant-level spending breaker.
- Keep the trace understandable to the author: each allow or deny carries a rule name and a plain reason.
What a workflow does when something goes wrong
| Fails | Behaviour |
|---|---|
| A step's arguments don't validate | Rejected before execution; run halts with a named reason |
| A destructive step needs approval that never comes | Stays PAUSED_FOR_APPROVAL indefinitely; doesn't silently expire into either action |
| A workflow runs away (misconfigured self-trigger) | Halts at the step budget |
| The process crashes mid-run | Resumes from the last checkpoint; the completed step never re-runs |
| An event is redelivered (at-least-once channel semantics) | The idempotency key makes the redelivery a no-op |
The source's punch list
| Effort | Items |
|---|---|
| Low | Template library with clone(); retry wrapper around resume(); PII redaction on step outputs; plain-language run summary |
| Moderate | Connector model with a vault abstraction; a real planner; sandboxed custom-tool review; canary migration between versions |
| Large | A visual builder; a real secrets manager with a distributed lock store |
- Caveat: these are the source project's estimates, not delivery promises for another deployment.
4. Cascade Robotics as a worked build
- A worked, runnable build of this design. Nothing in it contradicts the walkthrough; it adds four things.
4.1 The three-layer map
| Layer | Covers |
|---|---|
| Layer 1 | Canonical event and channel adapters |
| Layer 2 | Idempotency and checkpointed recovery |
| Layer 3 | Permissions, approvals, spend caps, staged draft / test / shadow / live rollout |
- Weak answer: time on Layer 1, waving at an LLM doing reasoning.
- Strong answer: most of the time on Layers 2 and 3, where real incidents happen: double refunds, a skipped human check, a re-run completed step.
4.2 The example data
Tenant cascade_robotics workflow |
Priority | Trigger |
|---|---|---|
wf_ticket_triage |
10 | webhook / ticket.created |
wf_legacy_ticket_tagger |
1 | webhook / ticket.created (to demonstrate the conflict) |
wf_slack_escalation |
10 | slack / urgent_message |
4.3 The cross-project shape
- The RAG platform, this agent platform and the delivery framework all return
Decision(allowed, rule, reason)from a named policy where deny overrides.
| Project | Function |
|---|---|
| This agent platform | authorize_step() |
| Delivery framework | sign_off() |
| Enterprise RAG | decide() |
- Access control, delivery gates and workflow guardrails are the same kind of problem in three hats.
- A good bridge when the interviewer has seen the Enterprise Knowledge Assistant or Scoping to Deployed Agent design.
- Caveat: the shape is shared; the domains and evidence are not, and a delivery sign-off grants no refund capability.
4.4 The coverage discipline
- Every claim is marked built and runnable, or known but not demonstrated, with an effort label to close it.
- The punch list above is that discipline applied.
Spoken answer (source's one-breath restatement, worth memorising): "We're building the safety and orchestration layer that sits between a non-technical user's plain-English intent and a real, destructive action, so that no matter which channel the trigger came from, the action only runs when it's actually supposed to, runs exactly once, and survives crashes and retries without ever surprising anyone."
With a laptop
python scripts/run_workflow_demo.pypython scripts/demo_guardrail_failure.pypytest -qfor its 21 deterministic tests
- These commands belong to the separate Cascade Robotics project; this page doesn't include or run them.
- The most persuasive artefact is the durability demo: a run crashes mid-flight and resumes, and the completed step provably never re-runs.
5. Stop runaway automations before the invoice does
- The pivot: "users built automations and the bill exploded."
- Non-technical users will build loops and can't be expected to bound them, so the platform does.
The cost card
| Item | Answer |
|---|---|
| Dominant driver | Retries and loops in user-authored automations, with no budget owner per tenant |
| Cheapest lever first | Per-automation step and token caps; per-tenant budgets with a circuit breaker; idempotency keys on every action; deterministic events instead of free-text triggers |
| Metric that proves it | Cost per automation run; steps per run; runaway kills per day; cost per tenant |
| Do not | Trust users to write bounded workflows |
| 60-second line | "Non-technical users will build loops. The platform bounds them: caps per run, a budget per tenant, idempotent actions, and a breaker that trips before the invoice does." |
Most levers already exist: say so
- The step budget is the per-run cap;
max_stepsis the tighter of workflow and tenant. - The spend cap already meters real dollars before the action, not after.
- The idempotency key already stops a redelivered event paying twice.
The additions: a tenant breaker and token metering
- The breaker must meter money moved as well as tokens.
- Step and spend caps bound one run. A workflow that refunds $49 to each of a thousand customers passes every per-run check.
- Only a tenant-level spend budget answers the discovery question "can it refund every customer tonight?"
- Meter model tokens per run into
total_cost_usdalongside tool cost; trip the breaker when the day's spend crosses its budget. - Bug 2 belongs here too: a replayed step must not be billed twice.
Four verbs, in order
- Measure cost per run and per tenant first.
- Route deterministic events to deterministic handling; use a model only where judgement adds value.
- Bound runs with step caps, spend caps and the breaker.
- Cache safely, and never across tenants.
6. References
- Fact-checked by the source on 27 September 2026. Each supports a specific claim above.
| Reference | Supports |
|---|---|
| Stripe API reference: idempotent requests | Provider idempotency keys; parameter-mismatch errors; v1 keys prunable after 24 hours |
| Slack docs: Events API | Redelivery is normal: three-second acknowledgement, three retries, event_id |
| Kleppmann: How to do distributed locking | A lease lock needs a fencing token; Redlock doesn't produce one |
| Redis docs: Distributed locks with Redis | Redis lock patterns and their limits |
| OpenAI: Function calling and other API updates | Function calling shipped in the API in June 2023 (the framing step) |
Quick Recall: Lines to Say in the Interview
- "One execution loop, not two: resume and a fresh run share the exact same code path."
- "The checkpoint is one integer,
next_step_index, and resume never reruns step 0." - "An idempotency key is on the action, not the run, because a run can legitimately retry."
- "Hash the stored arguments, or
50becomes50.0and you refund twice." - "Bug 1: the cap checked a 0.02 dollar fee, not the $500 refund."
- "Bug 2: cost accounting is a side effect, so the replay check runs before authorisation."
- "Correct in shape, wrong in storage: move to a fenced lease or a unique row, same two functions."
- "A $49 refund to a thousand customers passes every per-run check; only a tenant breaker stops it."
Quick review
One sentence: non-technical intent becomes a reviewable spec, and deterministic routing, guardrails, idempotency and checkpointing decide whether a real action runs once and recovers safely.
30-Second Cheat Sheet
- Ask first: how non-technical, which channels, read-only or destructive, blast radius, multi-tenant from day one.
- The path: adapter → tenant Event → priority → entity lock → pinned-spec orchestrator → typed args → idempotency → guardrail → scoped tool → checkpoint.
- No LLM in the demonstrated engine. A future model proposes values or a draft spec; code and humans authorise actions.
- Idempotency key
{tenant_id}:{run_id}:{step_name}:{args_hash}, checked before authorisation or billing. - Ordered deny: step cap, real-dollar spend cap, shadow, not-live, missing destructive-action authority.
- Failure story: $500 against a $50 cap is refused, never clamped; two bugs, one fix each.
- Promote one stage at a time, never self-approved.
1. Ask first, then draw the path
Ask first
- How non-technical is authoring?
- Which channels?
- Read-only or destructive actions?
- Blast radius?
- Multi-tenant from day one?
The whiteboard path
channel adapter → canonical tenant Event → live-trigger priority → entity lock → pinned-spec orchestrator → typed args → action idempotency → guardrail or approval → scoped tool → checkpoint and trace
- The demonstrated engine has no LLM.
- A future model proposes values or a draft spec; code and humans authorise actions.
2. Five rules and the failure story
Five rules
- Priority chooses which workflow should run; a lock stops two that can collide.
- Resume and fresh execution share one loop at
next_step_index. - Key idempotency on
{tenant_id}:{run_id}:{step_name}:{args_hash}; check it after caller and tenant access, before authorisation or billing. - The guardrail denies in order: step cap → real-dollar spend cap → shadow → not-live → missing destructive-action authority.
- Promote
DRAFT → TESTING → SHADOW → LIVE → AUTONOMOUS, one step at a time, never self-approved.
The failure story
- A $500 refund against a $50 tenant cap is refused, never clamped.
| Bug | What went wrong | Fix |
|---|---|---|
| Wrong cost | Checked a nominal API fee against a $5 cap | Correct the amount: read the real refund amount |
| Replay | Charged the cap again despite no second refund | Place idempotency before authorisation |
- The source demo has 21 deterministic tests.
- Caveat: its in-process stores still need durable shared replacements for production.
60-second close (source): "Non-technical intent becomes a reviewable spec. Deterministic routing, guardrails, idempotency and checkpointing decide whether a real action can run once and recover safely; the model never grants itself authority."
3. Key takeaways
| Topic | Takeaway |
|---|---|
| Framing | The hard part is trust, not tool selection; the framing sentence goes on the board in the first two minutes |
| Anchor | One $500 refund against a $50 cap, on an autonomous workflow without an allow-list entry, anchors every later claim |
| Requirements | Stated as testable guarantees, each with a named owner in the architecture |
| Architecture | One diagram: adapters, two-check routing, a checkpointed orchestrator and a guardrail on every step, with three named exits |
| Channels | Every channel is translated once at the edge into a six-field canonical event |
| Routing | Priority answers which workflow should run; the entity lock answers whether two can run at once |
| Spec | The workflow is declarative data the orchestrator walks; the model fills only typed, validated values |
| Durability | The checkpoint is next_step_index; resume and a fresh run share one loop |
| Idempotency | The key is on the action; the replay check runs before authorisation because cost is a side effect too |
| Guardrail | Five ordered deny rules decide every step; autonomy raises the ceiling without removing it |
| Promotion | Four rollout gates each answer one question; only someone other than the author may promote |
| Gaps | The no-LLM choice and the in-process stores are named gaps with sized fixes, not hidden ones |
| Cascade Robotics | Adds the three-layer map, the fixture and the shared decision shape |
| The hour | Goes to determinism, the guardrail and durability; the close is a week-one plan |
| Cost pivot | Caps per run, budgets per tenant, idempotent actions and a breaker |
Flashcard Drill
Quick Recall: Lines to Say in the Interview
- "The hard part is trust, not tool selection."
- "A $500 refund on a $50 cap is refused, never clamped."
- "Priority chooses which workflow should run; a lock stops two that can collide."
- "Resume and a fresh run share one loop at
next_step_index." - "The replay check runs before authorisation, because cost is a side effect too."
- "Step cap, spend cap, shadow, not-live, authority: deny in that order."
- "Autonomy raises the ceiling without removing it."
- "The model never grants itself authority."
Where next
- Revise the concepts