Skip to content

Stop

End a run on purpose. Raise Stop anywhere in a workflow, and the run ends with your message.

raise Stop("Nothing to fix: the review found no problems.")

AGL prints Stopped: <message> and exits with code 7. Work committed so far stays on agl/<label>, the same as when a workflow returns.

A Stop raised in a worktree or in a tool's function ends the whole run too.

Use it when there is nothing left to do, or when a question in the terminal is answered no:

if not await run.terminal.show(approve, plan=plan.text):
    raise Stop("Plan rejected.")

A stopped run isn't finished, so agl resume can continue it. Its finished steps return their recorded results, and a question is asked again when the resumed run reaches it.

Reference

agl.sdk.Stop

Bases: AglError

Raise this, or a subclass of it, to end the run.