Reference
CLI reference
Every asm command and flag.
The asm command runs, watches, evaluates, and replays Assemble workflows, and connects your local runs to the hosted platform. Every command works offline; logging in adds hosted traces on top.
Install it globally:
npm install -g @assemble-dev/cliRun asm --help for the usage summary. Every command and flag below matches the shipped command surface.
asm login#
Authenticate with an Assemble API key and save it to ~/.assemble/config.json. The key is validated against the platform before it is saved, so a typo or a revoked key fails immediately instead of at your next upload.
asm login --key asm_dev_your_key_here| Flag | Description |
|---|---|
--key <api-key> | The API key to save. If omitted, the key is read from stdin. |
--base-url <url> | Override the platform base URL. |
You can also pipe the key to avoid it landing in shell history: echo asm_dev_... | asm login. Create keys on the dashboard's API keys page — see Dashboard and API keys.
asm logout#
Remove saved credentials from ~/.assemble/config.json. Subsequent runs execute fully locally until you log in again.
asm logoutasm whoami#
Show the active workspace and the masked key for your current credentials, resolved from ASSEMBLE_API_KEY or the config file. Use it to confirm which workspace your runs will upload to.
asm whoamiasm init#
Scaffold a starter Assemble project: src/workflow.ts, an .env.example, a package.json, a tsconfig.json, and a .gitignore. The sample workflow runs on mockModel and needs no API keys — see the quickstart.
asm init my-team| Argument / Flag | Description |
|---|---|
[dir] | Target directory. Defaults to my-assemble-app. |
--force | Write the starter files into a non-empty directory. |
asm run#
Execute a workflow file, stream a live trace to your terminal, write a JSONL trace under .assemble/runs/, and upload the run when you are logged in. The summary prints the run id, status, latency, and a hosted trace URL.
asm run src/workflow.ts --input '{"ticket":"refund please","orderId":"ord_1","amount":42}'| Flag | Description |
|---|---|
--input <json> | Inline JSON input for the workflow. |
--input-file <path> | Read JSON input from a file. |
--workflow <exportName> | Pick a named export when the file exports more than one workflow. |
--trace-dir <dir> | Directory for JSONL traces and run state. Defaults to .assemble/runs. |
--no-upload | Run fully locally; do not upload the trace. |
--wait-approval [seconds] | If the run pauses for approval, block and auto-resume when the dashboard records a decision (optional timeout in seconds). |
--anthropic-api-key [name=]<key> | Inject an Anthropic key for this run. Repeatable — a bare value sets ANTHROPIC_API_KEY; name=<key> sets ANTHROPIC_API_KEY_<NAME> for adapters using apiKeyName. |
--openai-api-key [name=]<key> | Inject an OpenAI key for this run. Same [name=]<key> shape as --anthropic-api-key. |
Without a key, the run still executes and points you at the local JSONL file.
Passing several keys for one provider lets different agents in the same workflow bill to different keys — see Multiple keys per provider:
asm run src/workflow.ts \
--anthropic-api-key classifier=sk-ant-... \
--anthropic-api-key qa=sk-ant-... \
--openai-api-key sk-...asm dev#
Watch a workflow file, re-run it on every change, and stream traces. Press Ctrl+C to stop. This is the tight loop for iterating on prompts, tools, and policies.
asm dev src/workflow.ts| Flag | Description |
|---|---|
--input <json> | Inline JSON input for the workflow. |
--input-file <path> | Read JSON input from a file. |
--workflow <exportName> | Pick a named export. |
--trace-dir <dir> | Directory for JSONL traces and run state. |
--watch-dir <dir> | Also watch this directory for changes. |
--no-upload | Do not upload traces. |
--anthropic-api-key [name=]<key> | Inject an Anthropic key for the session, same shape as asm run. |
--openai-api-key [name=]<key> | Inject an OpenAI key for the session, same shape as asm run. |
asm eval#
Run an eval suite, print the metric table, save results under .assemble/evals/, and upload the eval run when you are logged in. The command exits non-zero when any case fails, so it slots directly into CI.
asm eval src/workflow.eval.ts| Flag | Description |
|---|---|
--suite <exportName> | Pick a named export when the file exports more than one suite. |
--results-dir <dir> | Directory for saved eval results. |
--no-upload | Run fully locally; do not upload results. |
--webhook <url> | POST the eval results JSON to this URL after the run. |
--webhook posts the full results payload — suite name, per-case pass/fail, metrics, and exit status — to the given URL once the suite finishes. Combined with the non-zero exit on failure, this turns asm eval into a CI deploy gate that reports to your own systems without the dashboard:
asm eval src/workflow.eval.ts --no-upload \
--webhook https://ci.internal.example.com/hooks/assemble-evalsasm replay#
Re-run a recorded run against the current workflow definition and print the diff — output, latency, and token usage. --workflow-file is required; runId defaults to the last run recorded in .assemble/last-run. Tool calls are mocked from the recorded trace by default so replays are deterministic and side-effect free — see Replay.
asm replay run_1 --workflow-file src/workflow.ts| Argument / Flag | Description |
|---|---|
[runId] | The recorded run to replay. Defaults to .assemble/last-run. |
--workflow-file <file> | Required. The workflow file used for the original run. |
--workflow <exportName> | Pick a named export. |
--from-step <n> | Replay starting at step n (non-negative integer). Defaults to 0. |
--no-mock-tools | Execute real tool calls instead of mocking them during replay. |
--trace-dir <dir> | Directory holding the original JSONL trace. |
--state-dir <dir> | Directory holding the original run state. |
Warning:
--no-mock-toolsre-executes real tool side effects — API calls, writes, emails. Use it only when that is what you want.
Configuration and environment#
asm resolves credentials and endpoints from, in order: command flags, environment variables, then ~/.assemble/config.json. A flag always wins over an environment variable, and both win over the saved config.
| Variable | Purpose |
|---|---|
ASSEMBLE_API_KEY | API key used for uploads and whoami. Takes precedence over the key saved by asm login. |
ASSEMBLE_BASE_URL | Platform API base URL. Defaults to https://ingest.getassemble.dev. |
ASSEMBLE_DASHBOARD_URL | Dashboard base URL used to build hosted trace links. Defaults to https://getassemble.dev. |
Setting ASSEMBLE_API_KEY in CI is the usual way to upload runs without a config file on disk. Provider model keys (OPENAI_API_KEY and friends) are separate and never touch the platform — see Model providers and Security.