Orchestration Component
The <Orchestration> component provides top-level control over workflows, including global timeouts, stop conditions, VCS snapshots, and cleanup.
Basic Usage
import { Orchestration } from "smithers/smithers-orchestrator/src/components/Orchestration";
<SmithersProvider db={db} executionId={executionId}>
<Orchestration
globalTimeout={3600000}
onComplete={() => console.log("Done")}
>
<Claude>Do the work.</Claude>
</Orchestration>
</SmithersProvider>
Props
Maximum time in milliseconds for the entire workflow.<Orchestration globalTimeout={3600000}> {/* 1 hour */}
Conditions that stop the workflow early.<Orchestration
stopConditions={[
{ type: "total_tokens", value: 100000 },
{ type: "total_agents", value: 50 },
]}
>
Create a VCS snapshot before starting.
Run cleanup when workflow completes.
Called on successful completion.
Called on workflow failure.
Called when stop is requested.
Stop Conditions
Token Limit
{ type: "total_tokens", value: 100000 }
Agent Limit
{ type: "total_agents", value: 20 }
Time Limit
{ type: "total_time", value: 1800000 } // 30 minutes
Report Severity
{ type: "report_severity", value: "critical" }
CI Failure
Custom
{
type: "custom",
fn: (result) => result.output.includes("ABORT"),
message: "Abort requested"
}
Full Example
<SmithersProvider db={db} executionId={executionId}>
<Orchestration
globalTimeout={3600000}
snapshotBeforeStart
stopConditions={[
{ type: "total_tokens", value: 50000 },
{ type: "report_severity", value: "critical" },
]}
onComplete={() => {
console.log("Workflow completed successfully");
}}
onError={async (error) => {
await db.vcs.addReport({
type: "error",
severity: "critical",
title: "Workflow Failed",
content: error.message,
});
}}
onStopRequested={() => {
console.log("Stop condition triggered");
}}
>
<Ralph maxIterations={10}>
<WorkflowContent />
</Ralph>
</Orchestration>
</SmithersProvider>