An agent without a stop condition is a bill without a ceiling. This prompt designs the two gates that make agents safe to scale: the eval gate (is the output good) and the stop condition (should we keep running).
Before you let any AI agent run unsupervised in production. Before you scale from test to real workload. When a run costs more than you expected and you realize you never set boundaries.
The workflow the agent runs, the definition of success (what good output looks like), the cost tolerance (how much is too much to spend), and the stopping rules (time limit, token limit, iteration limit).
I'm designing safety gates for an AI agent workflow.
Workflow: [what the agent does, step by step]
Success definition: [what counts as a good outcome]
Cost tolerance: [maximum spend per run]
Context: [any constraints: time, tokens, iterations]
Design two gates:
EVAL GATE (Does the output pass?):
- What specific signal tells us the output is worth keeping?
- What would make us discard the output?
- How do we automate this check?
STOP CONDITION (Should we keep running?):
- What triggers the agent to pause or stop?
- Which stop rule matters most: cost, time, iterations, or output quality?
- What's the fallback if none of the stops trigger?
For each gate, give me a testable condition (not vague, measurable).
Run this before the agent goes live. Start with small batches (10-20 runs) and watch what the eval gate actually catches. Adjust the thresholds based on what you learn. Then move to larger batches.
Two clear decision trees: one for the eval gate (output assessment) and one for the stop condition (run termination). Each with specific, measurable criteria. A log showing what the agent discarded and why.
Setting the eval gate too permissive (accepting bad output). Setting the stop condition too loose (letting runs balloon). Forgetting that the agent will always find a way to run until the stop fires.
Agents fail in production not because the model is bad, but because nobody designed what 'stop' means. Do this design work up front. It takes an hour. It saves you thousands.