---
title: Workspaces and data
description: "Keep your checkout in sync with the saved workspace, declare workflows in the manifest, and choose the types and files that travel with a deployment."
---

Keep your checkout in sync with the saved workspace, declare workflows in the manifest, and choose the types and files that travel with a deployment.

## Workspace synchronization and recovery

Start a new local draft with `andon workspace init`. Run `andon workspace pull`
to synchronize a checkout with the saved head, and `andon workspace status`
to see local, incoming, and conflicting paths. A first pull merges files present
on only one side. Overlapping edits leave local files untouched and put the
incoming source under `.andon/incoming/`. Copy in any incoming files you want,
then run `andon workspace pull --keep-local`. It preserves the local version
of each conflicting file and takes other incoming changes. To replace the
checkout with the saved revision, use `andon workspace pull --take-remote`.
Pull keeps replaced files under `.andon/backups/`.

`andon workspace push` uses the checkout's saved revision as the parent.
If the head changed, pull before pushing. `andon workspace validate` checks
local source. Pass `--revision` to check one saved state. A build uses the
checkout's saved revision when `--revision` is omitted and requires a clean
checkout in that case.

Use `andon revisions list`, `andon revisions diff <from> <to>`, and
`andon source-files list` or `show` to inspect saved source. Follow the
`Next:` command to read another chunk. In JSON output, join `content.text`
for a file or join and parse `content.json` for a diff. The complete diff
contains the unified patch and the changed-file list.
`andon revisions restore <revision> --parent-revision <head>` appends the
selected source as a new revision. Pull the result to update the checkout.
After a lost mutation response, run the inspection commands the CLI prints
before deciding whether to send another write.

Declare every workflow in `andon.toml` (`[[workflows]]` with a path under
`andon/`, `andon/workflows/` by convention; only `andon/{data,docs,tests}`
can't host workflows). Undeclared workflow files fail validation.

## Types, layout, and data

- Steps and agents accept primitives, `list`/`dict` composites, stdlib
  `@dataclass`es, and Pydantic models. Prefer `@dataclass` for plain
  records; reach for `BaseModel` when validation or `Field` constraints
  are load-bearing.
- The console builds the run form and the review response form from the
  workflow input type and the wait's response type. Say what an operator
  should see in the type: a field's `Field(title=..., description=...)` is its
  label and hint, and the first of `Field(examples=[...])` is its placeholder.
  A union is a choice between its arms. An arm is labelled by its title, which
  is `model_config = ConfigDict(title="Upload a file")` on a model (its class
  name otherwise) or `Annotated[HttpUrl, Field(title="Link")]` on a primitive,
  and a model arm's docstring is shown when it is chosen. A `Literal` field
  with one value, such as a union's tag, is filled in for the operator unless
  it may also be `None`. A shape without fixed fields, such as a `dict`, a
  tuple or a recursive model, is entered as JSON.
- Mark the field that holds your own identifier for what a run is about, such
  as a claim number, with `CaseKey()` from `andon_dsl.workflows`:
  `claim_number: Annotated[str, CaseKey()]`. It must be one required
  top-level `str` field of the workflow's input type, 1 to 255 characters;
  deploy rejects it on an optional or non-`str` field and on a second field.
  On a field typed with a named `str` alias, such as
  `Annotated[ClaimNumber, CaseKey()]`, the alias must bound it to 1 to 255
  characters.
  Each run records the value, exactly as sent, as its `case_key`, any number
  of runs may share one, and `andon runs list --case <case_key>` and `andon
  signals list --case <case_key>` find a case's runs and what they wait on.
  On any other type, such as a nested model or a step's output, `CaseKey()`
  records no key, but its 1 to 255 character limit still applies wherever
  that field is validated.
- `andon deployments create` binds direct and mapped step calls to their signatures and
  validates constant arguments against the declared parameter types. Pydantic
  validators and dataclass construction hooks such as `__post_init__` can
  therefore run during deployment and again when a step receives its inputs.
  These validators and hooks must be idempotent, deterministic, and free of
  side effects. Read external state, call services, and generate fresh values
  inside step bodies, then pass the results to your models.
- Package by role: `workflows/` (steps + `@workflow` bodies), `agents/`
  (Agent declarations, tools, input models), `schemas/` (shared typed
  records), `logic/` (pure deterministic business logic, such as catalog
  lookups, snapshot builders and validator rules, unit-testable without
  any platform machinery), `prompts/` (StrategyFile markdown).
- Small static data ships in the artifact tree under `andon/data/` and
  is read relative to the module (`Path(__file__).parents[1] / "data"`).
  Large org datasets: upload into an `andon://datasets/{collection}/` key with
  `andon reference upload <collection> <path>` (`--replace` adds a new version),
  pin the key in `andon.toml` `[[reference_data]]`, and read it via
  `reference_data_path("name")`. When the file is on the person's computer,
  `andon upload-links create --collection <collection> --name <name>` (MCP
  `create_upload_link`) gives them a console page that creates it or adds a
  new version. A build pins each file's current version: runs keep reading it
  after a new version is uploaded, until the revision is built again.
  `andon deployment-reference-data show <deployment_id>` shows which version a
  build pinned and whether it is still current; `andon reference list --ref
  <ref>` lists every version kept.
- `andon.toml` and files under `andon/` must be UTF-8 text using the lowercase
  extension `.py`, `.toml`, `.md`, `.txt`, `.json`, or `.csv`. Each file is
  limited to 256 KiB and the full deployed source tree to 5 MiB. Put reusable
  datasets in reference data and runtime or user assets in FileRef storage.
