Skip to main content
Maestro is an ES module named maestro-orchestrator. It is not on npm; install it from a clone, after npm run build there:

Running a workflow

run() returns at once with a handle:

Options

Events

Every event is emitted under its own type name and under 'event'.

Runners

  • AnthropicRunner({ client?, maxTurns?, maxTokens?, structuredMode? })
  • CodexRunner({ model?, ignoreUserConfig?, customToolsMcp? })
  • RoutingRunner({ anthropic?, codex?, route? })
  • FakeRunner, for tests and dry runs: it answers from the schema and never touches the network.
See Runners.

Giving the Workflow tool to your own agent

If you run your own agent loop on the Claude API, you can hand it the same Workflow tool Claude Code gets.
  • maestroToolDefinition() returns the tool definition. Its description tells the model when a workflow is worth starting and when it is not.
  • handleWorkflowToolCall() validates the call, starts the run in the background and returns at once. A bad call returns { is_error: true, content }; it does not throw.
  • The result arrives through onComplete as { ok: true, result } or { ok: false, error }.
Runs started this way are controlled by id:
All three return false or null for an unknown or finished run.

One budget for several runs

To make your main loop’s workflows share one pool, create a Budget and pass the same instance to every call:

Reading runs