Agent continue or stop Jev pattern
After a tool result, decide whether to continue, retry, ask the user, or halt.

Continue-or-stop is the cheapest control loop you can put on an agent. It does not pick a tool. It answers: given the goal and the latest result, is another step justified? Put retry in the set so transient failure is not the same as success.
This agent continue or stop schema is a paste-ready TypeSafe Jev request for jev-latest. Copy the JSON, keep thresholds in your code, and calibrate on your labels. Jev Patterns is independent and not affiliated with TypeSafe AI.
Use agent continue or stop when
- You already know which tool ran and only need a loop decision.
- You want to cap runaway agents without a regex on “final answer.”
- Retry vs continue vs stop should be separate branches in code.
Do not use agent continue or stop when
- You still need to choose which tool is next — use agent-tool-selection.
- The agent is supposed to write a user-facing summary of the run.
- Stop conditions are purely mechanical (step count, dollar cap) with no judgment.
Confidence thresholds for agent continue or stop
Keep these in your code. They are not part of the model call.
| When | Action |
|---|---|
| control.confidence >= 0.75 && control.choice == 'continue' | Enter the next tool-selection call |
| control.choice == 'retry' && retries_this_tool < 2 | Re-run last_tool |
| control.confidence < 0.75 | Stop or ask_user — do not wander |
Pass examples
Tests green, PR not opened
continue. The goal is not done.
{
"last_result": "tests passed",
"outstanding_work": [
"open pull request"
]
}Network blip
retry. Transient, not a logic failure.
{
"last_tool": "run_tests",
"last_result": "ECONNRESET talking to the test runner"
}Goal complete
stop. Do not keep chatting.
{
"last_result": "Opened PR #841",
"outstanding_work": []
}Ambiguous examples
Partial fix
continue vs ask_user if the remaining case is out of scope. Put scope in state.
{
"last_result": "3 tests passed, 1 still failing on timezones",
"outstanding_work": [
"timezone case"
]
}Budget almost gone
A rewrite will not fit. stop is the honest call.
{
"steps_used": 9,
"step_budget": 10,
"outstanding_work": [
"rewrite the module"
]
}Unclear failure
Not enough state. Confidence should be low.
{
"last_result": "exit 1"
}The problem agent continue or stop is for
Agent loops end on finish_reason, max_iterations, or a magic DONE string in the prose. Microsoft’s LoopAgent, TanStack’s maxIterations, and “inject a recovery message” posts all paper over the same hole: the generator was never asked a closed question about whether to continue.
Agent continue or stop is that question. After a tool result, you ask a Choice: continue, retry, ask_user, or stop. The answer space cannot include “one more search.” You still own budgets. You now own a peakedness number on the brake.
This is not the same as agent tool selection. Tool selection picks the verb. Agent continue or stop decides whether there should be another verb at all.
Why this agent continue or stop schema uses Jev
retry is for “the tool failed in a way that is cheap to try once more.” continue is for “progress, next tool.” ask_user is for missing rights or missing files. stop is for done, stuck, or budget spent. Four options, four code paths.
Put last_error, last_tool, and steps_taken in state. Agent continue or stop without the error will continue into the same wall.
Pair with a runtime cap anyway. Typed decisions are not a substitute for max_steps = 8 in config.
What to put in state for agent continue or stop
Include the original goal, the last tool, a short last result, error if any, files changed, tests status, and the remaining step budget. Agent continue or stop is only as good as that snapshot.
If the user said “don’t spend more than a minute,” pass elapsed_ms. The model cannot see your wall clock otherwise.
Do not dump the full chain-of-thought from a writer model into state. Dump the facts the next decision needs.
How to wire agent continue or stop in code
continue → call agent tool selection (or your planner) for the next verb. retry → same tool, once, then force ask_user if it fails again. ask_user → surface the distribution. stop → end the run and optionally summarize with a writer.
If confidence is below 0.70, treat as ask_user even when the Choice is continue. Cheap retries are how you blow the bill.
Log every agent continue or stop decision next to steps_taken. That log is the eval set for the next week.
Eval plan: sample runs that hit max_steps. If agent continue or stop wanted stop three steps earlier, your criteria for continue are greedy. If it wanted continue when tests already passed, add tests_green to state.
Failure modes
Using this instead of tool selection
continue does not name the next tool. You still need agent tool selection or a deterministic next step.
Infinite retry
Cap retry at one in code. The pattern can choose retry twice; your runtime should not honor it twice.
Chatty stop
stop is not a goodbye message. If you need a summary, that is a different model.
Copy, run, calibrate
The JSON in the rail is the agent continue or stop request for jev-latest. Copy it into your stack, or open Agent continue or stop in Jev Studio and draw the fixture bars. Thresholds stay in your repository. Calibrate on your labels before you auto-apply. Official model docs live at docs.typesafe.ai. Jev Patterns is independent and not affiliated with TypeSafe AI.
Related reading: Choice, Score, Noul, confidence thresholds, when not to use Jev.
Agent continue or stop: FAQ
- What does agent continue or stop decide?
- Agent continue or stop is a Jev Choice after a tool result: continue, retry, ask_user, or stop. It is the loop brake, not the next tool name.
- How is agent continue or stop different from max_iterations?
- max_iterations is a hard cap in your runtime. Agent continue or stop is a typed judgment you can threshold. Keep both.
- When should agent continue or stop pick retry?
- When the last tool failed in a cheap, likely-transient way and you have budget. Your code should still allow only one retry.
- Can agent continue or stop replace tool calling?
- No. It does not emit tool names or arguments. Pair it with agent tool selection or your own planner.
- Is agent continue or stop a chatbot turn?
- No. There is no user-visible message unless you choose ask_user and then write one yourself.
Last reviewed 21 September 2026. Independent of TypeSafe AI.
Next
Related Jev Patterns

Agents
Agent tool selection
Given the current agent state, pick the next tool from a closed toolbox — including stop.

Support
Escalate to human
A single Noul: should a person take this over from the bot or the junior queue?

Guardrails
Eval judge
Given a claim and a passage, choose supports, contradicts, or says nothing.

Studio
Run Agent continue or stop in Studio
Fixture bars first. Optional live call stays in this browser.