examples/workflows.
Register a workflow
main must take the input and return the output, and
signal() only takes the declared names. Inside it, signals are typed by the declaration:
The workflow's script
Let scripts start it
A toolset lists the workflows its scripts may start. Derive one from the toolset you already have, without listing its servers again:result() rejects with a WorkflowError when the child failed, was cancelled or aborted: error.status says which,
and error.runId names the run. The runs a script starts run in its namespace and inherit its labels; list them with
runs.list({ startedBy: parent.id }).
Start it from your harness
workflow: "repo_check" starts its latest version; "repo_check@9fbd13f4bb9b" one version (12 hexadecimal digits at
least). An input that does not match the schema is refused with invalid-input, and a signal the workflow does not
declare, or whose payload does not match, with invalid-signal.
Workflows the model writes
Give the model the agent toolsave_workflow, and it saves procedures it wrote as workflows of its own. The agent tools
then derive a toolset that pins the new version, and its later scripts import it from rewind:workflows. See
Agent tools.