---
title: "Build your first Andon workflow"
description: "The procedure a coding agent follows with the process owner: confirm the spec, save and build, run a trial, and activate only after approval."
---

Use this guide with the person who owns the process. Record the workflow spec,
the samples and their expected results, and the deployment ID tested in the
trial. Ask for approval of the spec before saving and of the deployment before
activating.

## Discover the workspace

Check whether the workspace has saved source and an active deployment. In MCP,
use `list_revisions`, `list_deployments` with `active: true`, and
`list_source_files` or `get_source_file` to inspect saved source. Look up the
relevant authoring topics and platform tools. The platform validates and runs
every workspace with one SDK release. Validation reports a workspace whose
`sdk_version` is on an earlier minor or ahead of that release, with the
change to make. The [authoring overview](/authoring) lists the guides by
task, and the sections below link the guide each step needs. With MCP, read
them on `andon-docs` with `get_page` and find a term with `search_docs`; on
the workspace server use `list_platform_tools` and `get_platform_tool` for
the available tools. In the CLI, each guide's chapters are topics:
`andon docs list --search <text>` finds one and `andon docs show <topic>`
reads it, and `andon platform-tools list --search <text>` and
`andon platform-tools show <name>` list the tools. Open existing source before
drafting if the workspace already has a workflow.

## Confirm the spec

Ask the person what starts the process today, how often it runs, which
non-PHI documents represent it, which output fields and citations are
required, and where the results go. Ask who reviews the results, what a
reviewer can decide, and which edge cases change the expected outcome.
Write down the expected fields and review decision for each sample.

For this first trial, a person starts the run against the test deployment.
Agree on the intended output destination before a trial that could write to
another service. Present the spec and get explicit agreement before saving
source.

## Save, validate, and build

Draft the workflow with [Workflow definitions](/authoring/workflow-definitions)
and [Orchestration](/authoring/orchestration). Read documents and extract fields with
citations as [Documents and files](/authoring/documents-and-files) describes. Pause
for the person's review with [Human review and waits](/authoring/human-review-and-waits),
and choose what a step retries with
[Retries and durability](/authoring/retries-and-durability). Define agents with
[Agents and models](/authoring/agents-and-models) and their tools with
[Agent tools](/authoring/agent-tools). [Workspaces and data](/authoring/workspaces-and-data)
covers the manifest, saving and recovering from a conflict.

Save the draft against the revision you read. If the head has moved, review
the incoming changes with the person before applying your draft to the new
revision. Validate the revision returned by the save, resolve any validation
errors, and build that same revision as an inactive deployment. Include a
message describing the change. Inspect the build log if compilation fails.
In MCP, use `bootstrap_workspace` if you need the starter, then
`create_revision`, `validate_revision`, and `create_deployment`. Read failed
builds with `list_deployment_logs`.

With the CLI, initialize a checkout with `andon workspace init` if the
workspace is empty, or bring down the saved source with `andon workspace pull`.
Then save, validate, and build:

```sh
andon workspace push --message "Save the first workflow"
andon workspace validate --revision <revision>
andon deployments create --revision <revision> --message "Build the first workflow"
```

## Trial, review, and repair

[Testing and debugging](/authoring/testing-and-debugging) covers local tests, run
evidence and the error kinds this section refers to.

Upload the samples and use their Andon file references as workflow inputs.
With the CLI, `andon files upload <path>` returns a reference. When the
sample is on the person's computer rather than yours, `andon upload-links
create` (MCP `create_upload_link`) returns a console page for them; ask them
to confirm the organization on the page before uploading, and use the file
reference the page shows. `andon files list` (MCP `list_files`) finds an
earlier upload again.

Read the workflow's input schema on the inactive deployment. Run each sample
against that explicit deployment and compare the observed fields, citations,
credits, and elapsed time with the spec. If the run pauses for review, show
the review and relay the person's decision or let them answer in the console.
In MCP, use `get_workflow`, `start_run`, and `get_run`. Read the finished
value with `get_output`. Read an open review with `list_signals` and
`get_signal`, then use `respond_to_signal` only after the person gives their
decision. For a user-readable failure, pass the run ID and its
`failed_invocation_id` to `list_logs` with `kind=error`. For other failures,
inspect the failed invocation with `get_invocation`. Find other nodes with `list_nodes` and
page through their recorded executions with `list_invocations`. Follow the
cursor from `get_input`, `get_output`, or `get_log` to read more recorded JSON.
`get_log` lists the newest messages first.

```sh
andon workflows show <workflow_key> --deployment <deployment_id>
andon runs start <workflow_key> --deployment <deployment_id> --input-file inputs/sample.json
andon runs watch <run_id>
andon runs show <run_id>
andon outputs show --run <run_id>
```

For a review, use `andon signals list --run <run_id>` and
`andon signals show <signal_id>`. Relay the person's decision with
`andon signals respond <signal_id> --response '<decision>'`, encoded as JSON.

For a failed run, read the run's error kind and the failing invocation.
Use `andon invocations show <invocation_id> --run <run_id>` for the
invocation and `andon logs list --run <run_id> --invocation <invocation_id>`
to find its recorded model and tool calls, the lines its code logged, and its
error.
Fix workflow code, relay the action required for a user-readable error, or
share the correlation ID for an internal error. Validate and build the repaired
revision and rerun the samples on that deployment. If the start response is
lost, look up recent runs for that deployment and workflow and inspect the
returned IDs before starting another run.

## Activate only after approval

Show the tested deployment ID and trial results. Read the active deployment
with `andon deployments list --active`. If a deployment is active, show the
diff with `andon deployments diff <active_id> <tested_id>`, and how the
organization's schedules and webhooks would fare on each with
`andon deployment-triggers show <tested_id>` and
`andon deployment-triggers show <active_id>`. If the workspace has
no active deployment, tell the person this will be its first active version.

Ask the person to approve activation of the exact tested deployment. If they
decline, keep the deployment inactive. After approval, run
`andon deployments activate <tested_id> --expected-active-deployment <active_id>`.
Omit the flag for the first activation. In MCP, use `diff_deployments`
and `activate_deployment`. For the first activation, pass
`expected_active_deployment_id: null`. If the precondition fails, inspect the
new active deployment, show the updated comparison, and ask again. Read back
the active deployment ID to confirm it matches the tested deployment.

A person starts the first trial. To start runs on a schedule, from a webhook,
or for new email or files after activation, follow [Start and resume runs](/authoring/triggers).
