Quickstart
Deploy a workflow, invoke it, and retrieve the run.
You need Node.js 20.19 or later and a plan. There is no free tier; Hobby is $20 USD a month and includes $20 USD of credits.
Get an API key
Log in to the A22A dashboard and choose a plan on Plan. Then open API keys and create a key. The key is shown once.
export A22A_API_KEY="a22a_…"Install the library
In a new folder:
npm install @a22a/sdkThe package is the Node.js library and the a22a CLI.
Write a workflow
A project is a folder under a22a/. Each .json file in it is a workflow, named after the file.
{
"steps": [
{
"id": "extract",
"prompt": "Pull the key facts from {{input.text}}",
"model": "anthropic/claude-haiku-4.5"
},
{
"id": "write",
"prompt": "Write a summary from {{extract.output}}",
"model": "anthropic/claude-sonnet-5",
"needs": ["extract"]
}
]
}{{input.text}} is the run's input, and {{extract.output}} is the answer from extract. A step with needs runs after those steps. See Templates.
Invoke and retrieve
import { A22A } from "@a22a/sdk";
const a22a = new A22A({ apiKey: process.env.A22A_API_KEY });
const { run_id } = await a22a.runs.invoke({
project: "acme",
workflow: "summarise",
input: { text: "A22A runs multi-step AI workflows on managed infrastructure." }
});
for (;;) {
const run = await a22a.runs.retrieve(run_id);
if (run.status === "completed" || run.status === "failed") {
console.log(JSON.stringify(run, null, 2));
break;
}
await new Promise((resolve) => setTimeout(resolve, 2000));
}node run.mjsThe run is queued and the call returns at once with a run_id. The loop retrieves the run every two seconds until it is completed or failed, then prints it:
{
"run_id": "4b3e…",
"status": "completed",
"steps": [
{ "step_id": "extract", "status": "completed", "output": "…" },
{ "step_id": "write", "status": "completed", "output": "…" }
]
}Next
In production, deploy from CI and receive the run on a webhook instead of retrieving it. How it works covers what happens between invoking and the run ending.