Stop Component
The<Stop> component signals that the workflow should terminate.
Basic Usage
Props
Reason for stopping the workflow.
Signal workflow termination
<Stop> component signals that the workflow should terminate.
import { Stop } from "smithers-orchestrator";
<Stop reason="Task completed successfully" />
<Stop reason="Critical error encountered" />
import { useState } from "react";
function ConditionalWorkflow() {
const [status, setStatus] = useState("running");
return (
<SmithersProvider db={db} executionId={executionId} maxIterations={10}>
<If condition={status === "running"}>
<Claude
onFinished={(result) => {
if (result.output.includes("CRITICAL")) {
setStatus("error");
} else if (result.output.includes("DONE")) {
setStatus("complete");
}
}}
>
Process the task.
</Claude>
</If>
<If condition={status === "error"}>
<Stop reason="Critical error detected" />
</If>
<If condition={status === "complete"}>
<Stop reason="Task completed" />
</If>
</SmithersProvider>
);
}
<Human
message="Approve?"
onApprove={() => setPhase("continue")}
onReject={() => setPhase("cancelled")}
>
Review the changes.
</Human>
<If condition={phase === "cancelled"}>
<Stop reason="Rejected by human" />
</If>