Write Your First JavaScript Workflow
Use the you-agent-factory JavaScript orchestrator: the runtime bindings a workflow script gets, how it dispatches agents, and how it bounds, checkpoints, and returns its work.
What It Is
The JavaScript orchestrator runs a single workflow script instead of moving work between workstations. The script is an async function body: it reads its invocation arguments, calls agents, and returns the final answer. The factory definition around it carries the source, the argument schema, and the execution policy.When To Use
Choose it when the workflow is a procedure rather than a topology — when the next step depends on a computed value, a loop count, or a branch that is awkward to express as states and transitions. Choose the graph form instead when you want durable per-item state without writing it yourself.The Runtime Bindings
Fifteen symbols are published across eight top-level names. There is no module system and no import: these are simply in scope when the script starts.| Symbol | What it does |
|---|---|
| args, meta | Invocation arguments and metadata, bound as mutable snapshots at script start. Writing to them changes only the in-script view, never the original request. |
| agent.run(spec) | Dispatch one child agent and await its result. |
| parallel(items) | Run an array of run specs or item functions concurrently and await all of their results. |
| pipeline(items, worker, next) | Map each item through a worker function and an optional second stage, running the stages in order per item. |
| phase(name), log(message, fields) | Record a named phase transition, or emit a progress message, for anyone watching the run. |
| workflow.budget / checkpoint / resumeState / artifact / log / final | Read the execution budget, persist and restore resume state, publish an artifact, and terminate with a final value. |