Documentation Index
Fetch the complete documentation index at: https://smithers.sh/llms.txt
Use this file to discover all available pages before exploring further.
import { ContinueAsNew, continueAsNew } from "smithers-orchestrator";
type ContinueAsNewProps = {
state?: unknown; // JSON-serializable; arrives as ctx.input.__smithersContinuation.payload
};
// continueAsNew(state?) is a helper equivalent to <ContinueAsNew state={state} />
export default smithers((ctx) => {
const continuation = (ctx.input as any)?.__smithersContinuation as
| { payload?: { cursor?: string; count?: number } }
| undefined;
const cursor = continuation?.payload?.cursor ?? null;
const count = continuation?.payload?.count ?? 0;
return (
<Workflow name="paginated-processor">
<Sequence>
<Task id="process-batch" output={outputs.processed} agent={processorAgent}>
{`Process next page. Cursor: ${cursor ?? "start"}. Total so far: ${count}.`}
</Task>
<ContinueAsNew
state={{
cursor: ctx.outputMaybe(outputs.processed, { nodeId: "process-batch" })?.lastCursor,
count: count + 1,
}}
/>
</Sequence>
</Workflow>
);
});
Notes
state must be JSON-serializable; total continuation envelope < 10 MB.
- Workflow id is preserved across continuations; only run id increments.
- Nodes rendered after
<ContinueAsNew> in the same sequence don’t execute.