UseArazzo Runner

Executes Arazzo workflows step by step against live APIs, and hands back a full run trace, not just a pass or fail.

An Arazzo document describes a sequence of API calls. @usearazzo/runner makes those calls. It sends real requests to the APIs behind the workflow's OpenAPI source descriptions, checks each step's success criteria, follows the control flow the document declares, and tells you what happened at every step.

Supported versions:

  • ✓ Arazzo 1.0.0, 1.0.1, 1.1.0 (workflow documents)
  • ✓ OpenAPI 2.0, 3.0.x, 3.1.x (source descriptions)

Run a Workflow

Today the Runner is a library: ArazzoRunner loads a document and runs a workflow in two calls. Here it runs a Petstore workflow that logs in, finds a pet, orders it, and checks the order. Start a local Petstore for it to call first:

docker run --rm -p 8080:8080 swaggerapi/petstore3:1.0.28

Install the Runner in an empty directory:

npm install @usearazzo/runner

Save this script there as run.mjs and run it with node run.mjs:

import { ArazzoRunner } from '@usearazzo/runner';

const runner = await ArazzoRunner.load(
  'https://usearazzo.com/assets/reference/runner/petstore-order.arazzo.yaml',
);

const result = await runner.execute('authenticateAndOrderPet', {
  inputs: {
    username: 'theUser',
    password: '12345',
    preferredPetStatus: 'available',
    orderQuantity: 1,
  },
  executeOptions: {
    petstoreAPI: { server: 'http://localhost:8080/api/v3' }, // a local Petstore
  },
});

for (const step of result.steps) {
  const mark = step.successful ? '✓' : '✗';
  const time = `${Math.round(step.durationMs)} ms`;
  console.log(`${mark} ${step.stepId.padEnd(26)}${time.padStart(7)}`);
}
console.log(`\n${result.status} in ${Math.round(result.durationMs)} ms`);
node run.mjs
$ node run.mjs
✓ loginUser                  739 ms
✓ findAvailablePets           19 ms
✓ placeOrder                  17 ms
✓ retrieveOrderedPetDetails    9 ms
✓ verifyOrderConfirmation      7 ms

completed in 796 ms

Five real requests, each judged by its step's criteria. The result also carries the workflow's outputs, and for each step the action it picked and how many attempts it took. The API reference walks through the same run, outputs included.

What It Handles

The control flow you wrote

goto, retry with retryLimit and retryAfter, and end, as the specification defines them. Workflow-level default actions and parameters reach every step. A runaway loop stops at a step budget.

Workflows that call workflows

Sub-workflow steps, dependsOn prerequisites, and one-way transfers with goto, including workflows in other Arazzo documents. Cycles are caught, and a dependency runs once per run.

Your HTTP stack, your credentials

Requests go out through global fetch by default, or through any client you plug in. Arazzo itself is auth-agnostic, so credentials come from you.

A trace, not a verdict

Every step in run order: whether it passed, which action was picked, how many attempts it took, and how long it ran. A failed step is a result you read, not an exception you catch. Pass an observer and the same story arrives as events while the run happens, every request included.

Authentication

Arazzo says nothing about credentials, so they come from you. There are three places to put them. Start with the first, and fall back to the next when it cannot express what you need.

1. Execute options: static credentials per API

Each entry of executeOptions is named after a source description of your workflow document and reaches only the steps that call that API. Its securities name the security schemes the API's OpenAPI document declares:

const result = await runner.execute('buyPet', {
  inputs,
  executeOptions: {
    petstoreAPI: {
      securities: { authorized: { api_key: 'KEY' } },
    },
    paymentsAPI: {
      securities: { authorized: { bearerAuth: 'TOKEN' } },
    },
  },
});

Each credential goes where its scheme says (header, query, or cookie), and only to the operations that require it. API keys, bearer tokens, basic auth, and OAuth tokens are covered. The key for one API is never sent to another, even when both name a scheme alike.

2. Request interceptor: credentials computed per request

A token you fetch or refresh, a signed request, or an API whose OpenAPI document declares no security scheme: none of these fit a static entry. A requestInterceptor runs after each request is built and before it is sent, and changes it as you see fit:

const runner = await ArazzoRunner.load(uri, {
  requestInterceptor: async (request) => {
    request.headers.Authorization = `Bearer ${await acquireToken()}`;
  },
});

Credentials from the execute options are already on the request when the interceptor sees it, so the two combine. An interceptor can also sit inside one API's entry of executeOptions, where it touches only that API's requests. Its second argument says which step, operation, and source description each request is for, so it can single one out without matching on the URL.

3. Custom HTTP client: credentials in the connection

Some credentials never appear in a request at all. A client certificate (mutual TLS) or an authenticating proxy belongs to the connection, so it belongs to the httpClient, the function that sends every request:

import { fetch, Agent } from 'undici';

const dispatcher = new Agent({ connect: { cert, key, ca } });

const runner = await ArazzoRunner.load(uri, {
  httpClient: (request) => fetch(request.url, { ...request, dispatcher }),
});

Keep changes to the request itself in the interceptor. What a client changes on its own does not show up in the trace.

All three are about API calls. Loading documents is a separate path: workflow and OpenAPI documents behind a token or a client certificate load through the reference option, and credentials for an API never reach a host that only serves a document.

The Runner runs no OAuth flow: you supply the tokens. Every credential form is in the API reference, and document retrieval has its own section.

Architecture

Running a workflow is a pipeline of four small parts, and ArazzoRunner wires them for you. WorkflowExecutor runs the steps and is the only part that writes run state. StepExecutor runs one step. OpenAPIOperationExecutor builds and sends one request. DocumentRegistry loads every document once. Each part takes its collaborator rather than building one, so you can swap any of them, or drop in a stub for tests.

Runner architecture WorkflowExecutor calls StepExecutor, which calls OpenAPIOperationExecutor, which sends the built request through HTTPClient. DocumentRegistry supplies loaded documents to all three executors. WorkflowExecutor iterates steps · owns state · control flow StepExecutor runs one Arazzo step OpenAPIOperationExecutor builds request · normalizes response HTTPClient sends it · global fetch by default execute step execute OpenAPI operation send the built request DocumentRegistry loads & caches supplies documents to all three

HTTPClient is drawn dashed because it is the seam you are meant to replace. The API reference documents each part.

Installation

npm install @usearazzo/runner

Choosing the server, plugging in an HTTP client, adding credentials, cancelling a run, and every error are in the API reference.

Rest of the Toolkit

Validator

Validate a document before you run it, using the same Arazzo semantics the Runner interprets.

Explore Validator

CLI

Already on npm with a validate command. Puts the toolkit behind one command, so validation runs from a terminal or a CI pipeline.

Explore CLI

Under the hood, the Runner uses @usearazzo/parser and @usearazzo/resolver to load and resolve the documents it runs.

Frequently Asked Questions

Yes. Run npm install @usearazzo/runner. It is published as an alpha, so the API may still change before the stable release. Today you call it from JavaScript or TypeScript; the API reference runs a workflow end to end.

Not yet. The UseArazzo CLI validates documents today. To run a workflow, ArazzoRunner runs a workflow from your own code in two calls: load, then execute.

Pass server in executeOptions, under the name your workflow document gives the API's source description: { petstoreAPI: { server: 'http://localhost:8080/api/v3' } }. Every step that calls that API then goes there instead of the server its OpenAPI document declares. Include the base path, because an override replaces it too. Other APIs in the same workflow keep their own servers. See Choosing the server in the API reference.

Pass serverVariables in the same executeOptions entry: { petstoreAPI: { serverVariables: { region: 'us' } } }. The variables you name change, and the rest keep the defaults the OpenAPI document declares. When the document declares several servers, also pass server with the URL template of the one you mean, exactly as declared. Server variables are an OpenAPI 3.x feature. For OpenAPI 2.0, override the whole server.

No. A default in the workflow's inputs schema is not applied, so pass every input a step reads. An input you leave out resolves to nothing, and a parameter built from it is not sent.

Pass an AbortSignal as the signal option of execute. AbortSignal.timeout(5000) gives the whole run five seconds. The signal is checked before each step and each retry, and it cancels the request in flight. A cancelled run throws an ExecutionError with the reason aborted. It does not come back as a failed result. See Cancellation in the API reference.

Pass an observer to ArazzoRunner.load. It is called with an event for every workflow, step, attempt, criterion, and selected action, and for every document load and request, as the run happens. Requests carry what was sent, credentials included, so pass each event through new Redactor().event(event) before you log it. captureBodies: true adds request and response bodies. For a logger, loggingObserver from @usearazzo/runner/observability/logging writes every event as a masked record with a level, through pino, winston, or the console. See Observing a run in the API reference.

Yes, with credentials you supply. Arazzo says nothing about credentials, so they come from outside the workflow. Static ones go in executeOptions, per API: an API key, a bearer token, basic auth, or an OAuth token for the security schemes its OpenAPI document declares. A requestInterceptor covers credentials computed per request. The Runner runs no OAuth flow. Documents behind a token or a client certificate are configured separately with the reference option, so credentials for an API never reach a host that only serves a document. The API reference has the details.

In executeOptions, under the name your workflow document gives the API's source description. Its securities name the security schemes of that API's OpenAPI document: { petstoreAPI: { securities: { authorized: { api_key: 'KEY' } } } }. Each entry reaches only the steps that call that API, so one workflow can use different credentials for different APIs. See Authentication in the API reference.

No. You obtain the token and the Runner sends it. A static token goes in securities. A token you fetch or refresh goes in a requestInterceptor, which runs before every request.

Yes. For API calls, plug in an httpClient that presents the client certificate. For loading documents, pass the certificate through the reference option. The two are configured separately. The API reference shows both in one example.

Yes. Workflow and OpenAPI documents behind a token or a client certificate load through the reference option of ArazzoRunner.load. Document loading is separate from API calls, so credentials for an API never reach a host that only serves a document. See Document retrieval in the API reference.

Yes. OpenAPIOperationExecutor accepts an httpClient, a function from the built request to a WHATWG Response. The default is global fetch in one line. undici, a pooled client, or a canned response for tests drop in the same way.

That is a normal outcome, not an error. The step's successful flag is false and its onFailure action runs. With no matching action, the run ends with status: 'failed'. A broken document, such as a goto to a step that does not exist, throws an ExecutionError instead.

Arazzo 1.0.0, 1.0.1, and 1.1.0 workflow documents, with OpenAPI 2.0, 3.0.x, and 3.1.x source descriptions. A workflow can also call workflows in other Arazzo documents.