Skip to content

How-to guides

Use with coding agents

What get gives a coding agent, how it edits and saves a workflow, and the MCP and API paths for the same operations.

Claude Code, Cursor, Codex and other coding agents work from a directory that get writes.

What get gives an agent

  • A primer, which opens .sim/AGENTS.md. get prints a short summary instead (the files written, the guide, and the editLoop command to run). It covers the edit loop, how block identity, references and renames work, failures and retries, test runs, deletes, deploy, exit codes, and the params of each builder the workflow already uses.
  • .sim/AGENTS.md: the primer followed by a reference, by task. .sim/GUIDE-advanced.md beside it has the rest, by task, in a workflow directory and a workspace directory alike.
  • .sim/examples/: one correct example of each common block to copy from.
  • .sim/sdk/: the type declarations, with .sim/sdk/INDEX.md listing the builders.

Point the agent at .sim/AGENTS.md before it edits.

The loop

  1. sim workflows source get <workflow> --dir <dir> && cat <dir>/.sim/AGENTS.md writes the workflow and the guide and reads the guide's primer in the same call. <workflow> is the workflow's id or its exact name.

  2. Write every file the change needs.

  3. Run one chained command, then fix whatever it reports in the next step:

    Code
    sim workflows source check --dir <dir> && sim workflows source apply --dir <dir> --yes --run '{...}' --deploy

    A non-zero exit code stops the chain at the first failure. apply compiles the source and compares it with the saved draft again, so an agent can skip --dry. check also type-checks the directory, so the chain needs no separate tsc. People and CI use apply --dry to review the plan, and status shows what changed and what to run next.

    --run dry-runs the saved draft with that input, and --deploy deploys only if the run completed; a run that fails exits 1, deploys nothing, and maps the failing block to its file and line. Drop --deploy to keep the change a draft. The result opens with a one-line summary and ends with errors, warnings, live and next, so a | head or | tail of it still shows the outcome.

    The dry run (also sim workflows run <workflowId> --dry) tests the saved draft without sending its writes: each write returns a placeholder and is listed under sideEffects with the request it would have sent, so the agent checks payloads instead of cleaning up rows or messages. --allow <block> sends one block's writes for real against a test resource, and --draft runs everything for real.

For a whole workspace, use sim workspaces source with the same steps: its chained command is sim workspaces source check --dir <dir> && sim workspaces source apply --dir <dir> --yes --run <key>='{...}', one --run per workflow folder (workflows/<key>/) to test, and deployments/ is applied only if every run completed. See Test workflows on apply.

Look things up

  • sim workflows source find <block> prints one block of the workflow by name, key or identifier, from the directory without a request: its declaration with line numbers, its function file, its incoming and outgoing wiring and every block that reads its outputs, each as file:line. A part of a name prints every block it matches.
  • sim workflows source params <builder> prints a builder in brief (an example call, the required params with types, the optional ones by name and the outputs) from the cached block catalog without a request. --full prints every param with its type, options, default and doc. A legacy builder names the one that replaces it, and a namespace such as gmail lists its builders.
  • sim workflows source resources lists the tables, knowledge bases, credentials, workflows, skills, custom tools, MCP servers and environment variable names the file can name.
  • sim workflows source catalog shows the block catalog the source is checked against.

Exit codes and retries

An agent can branch on the exit code: 5 means the workflow changed and it must get into a fresh directory, 14 means it forgot --yes, and 9 means wait a minute. See Exit codes.

Over MCP and the API

getWorkflowSource returns a workflow as TypeScript source files with its lock and base. Edit the files and send them back, with the same lock and base, through applyWorkflowSource, first with query: {"dry": true}. One call replaces a batch of graph operations. See MCP tools and Build and run workflows.

Was this helpful?
Suggest an edit