> ## Documentation Index
> Fetch the complete documentation index at: https://docs.promptingcompany.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Simulations

> Create tasks, queue runs and run experiments that test coding agents against your product, with tpc sim.

# Simulation commands

`tpc sim` runs coding agents against tasks for your product in sandboxes and scores each attempt. This page lists every command group with examples to start from. The [Agent experience guides](https://docs.promptingcompany.com/guides/coding-agent-optimization/overview.md) explain tasks, environments, runs and experiments.

Commands need `--scope <org-slug>/<product-slug>`, and most need a signed-in session from `tpc auth login`; they reject API keys. Some reads and the repository commands `experiment bind`, `bindings`, `compare` and `export` also accept an API key with the matching `simulations:*` scope. Tag commands need only `--scope <org-slug>`. `tpc sim spec`, `tpc sim experiment validate-signal-config` and the local repository commands (`experiment init`, `validate` and `plan`) need neither. Add `--format json` for machine-readable output.

| Command group | Use it to | Read more |
| - | - | - |
| `tpc sim task` | Create, inspect, update, run, export, duplicate and delete tasks, and manage their init setup, tags and secrets | [Tasks](https://docs.promptingcompany.com/guides/coding-agent-optimization/tasks.md) |
| `tpc sim run` | Queue runs for a task or a task directory, and inspect runs | [Runs & iterations](https://docs.promptingcompany.com/guides/coding-agent-optimization/runs.md) |
| `tpc sim analysis` | Read the analysis of a run or a task | [Runs & iterations](https://docs.promptingcompany.com/guides/coding-agent-optimization/runs.md) |
| `tpc sim env` | Manage the environments that attempt tasks | [Simulation environments](https://docs.promptingcompany.com/cli/commands/simulation-environments.md) |
| `tpc sim experiment` | Run tasks across environments as iterations and read results and signals | [Experiments](https://docs.promptingcompany.com/guides/coding-agent-optimization/experiments.md), [Signals](https://docs.promptingcompany.com/guides/coding-agent-optimization/signals.md) |
| `tpc sim experiment init\|validate\|plan\|bind\|compare\|export` | Keep tasks as local folders, push them, and compare or export iterations | [Experiment repositories](https://docs.promptingcompany.com/cli/commands/experiment-repositories.md) |
| `tpc sim tag` | Manage the organization's tags | [Tags](#tags) |
| `tpc sim ax` | Set up the product's Agent Experience experiment or a competitive benchmark | [Agent Experience](https://docs.promptingcompany.com/cli/commands/agent-experience.md) |
| `tpc sim spec`, `tpc sim create` | Print the `simulation.json` contract, or create a task and attach it to existing environments in one step | [Tasks](#tasks) |

## Tasks

```bash theme={null}
tpc sim spec
tpc sim task create --file task.json --scope acme/my-product
tpc sim env task attach env_123 task_123 --scope acme/my-product
tpc sim task run task_123 --scope acme/my-product
```

A new task has no environments; attach at least one before you run it. `tpc sim create --file simulation.json` does both: it creates the task and attaches it to the existing environments listed in `environmentIds`.

`tpc sim task run` queues one run per linked, enabled environment; `--environment-id env_a,env_b` limits it to those. `tpc sim task list`, `get`, `update` and `delete` work as the [Tasks guide](https://docs.promptingcompany.com/guides/coding-agent-optimization/tasks.md#working-with-tasks-from-the-cli) shows. `delete` is a soft delete that keeps run history.

```bash theme={null}
tpc sim task duplicate task_123 --name "Checkout regression v2" --scope acme/my-product
tpc sim task export task_123 --dir ./checkout-regression --scope acme/my-product
tpc sim run ./checkout-regression --scope acme/my-product
```

* `duplicate` copies the definition, goals and category into a new task, named `Copy of <name>` unless you pass `--name`. The copy has no environments.
* `export` writes `task.json` and `instruction.md`, plus `environment.json` when exactly one environment is linked. It includes init commands in full, records each init file's source (repository, ref and target path, or the zip's file name) but not zip contents, and lists secret names but never their values. `--force` overwrites an earlier export.
* `tpc sim run <dir>` creates the task, or updates or reuses one with the same name, and does the same for `environment.json`, then queues runs. Running it again never creates duplicates.

### Init commands and init files

```bash theme={null}
tpc sim task init-commands set task_123 --scope acme/my-product \
  --commands '[{"label":"deps","command":"npm ci","cwd":"/home/agent-user/app"}]'
tpc sim task init-commands list task_123 --scope acme/my-product

tpc sim task init-file add task_123 --scope acme/my-product \
  --repo-url https://github.com/acme/starter --git-ref main --target-path /home/agent-user/app
tpc sim task init-file list task_123 --scope acme/my-product
tpc sim task init-file clear task_123 --scope acme/my-product
```

* `init-commands set` replaces the whole list. It takes a JSON array of `{label?, command, cwd?, timeoutMs?}` or `@<file>`, and `--commands none` clears it. `timeoutMs` defaults to 5 minutes.
* `init-file add` clones a git repository into the sandbox before each run: `--git-ref` defaults to the repository's default branch, `--target-path` to `/home/agent-user`, and `--auth-secret-ref` names a secret holding a git token for a private repository. Zip uploads need the web app.
* `init-file clear` removes every init file from the task. There is no command to remove just one.

Paths, timeouts and counts have limits. See [Limits & constraints](https://docs.promptingcompany.com/guides/coding-agent-optimization/limits.md#hard-limits).

### Task secrets

`tpc sim task secret set|list|link` manages secrets that every run of the task receives, in any environment. Repository tasks use them for verifier keys; see [Verifier secrets](https://docs.promptingcompany.com/cli/commands/experiment-repositories.md#verifier-secrets).

## Tags

Tags belong to the organization and label tasks.

```bash theme={null}
tpc sim tag create regression --color "#ef4444" --scope acme
tpc sim tag list --search regr --scope acme
tpc sim task tag add task_123 regression smoke --scope acme/my-product
tpc sim task tag remove task_123 smoke --scope acme/my-product
tpc sim tag delete tag_123 --scope acme
```

Tag names are stored in lowercase and are unique in the organization. `task tag add` and `remove` take tag names or IDs; the tags must already exist. `task tag remove` leaves the tag in the organization. `tag delete` takes the tag ID and removes the tag from every task and environment.

## Runs and analysis

```bash theme={null}
tpc sim run list --task-id task_123 --status failed --scope acme/my-product
tpc sim run get run_123 --scope acme/my-product
tpc sim analysis get --run-id run_123 --scope acme/my-product
```

`tpc sim run <task-id>` queues runs like `tpc sim task run`. `run get` shows the score, usage and the reasoning effort and speed the run used; `run logs` and `run actions` show its timeline and normalized actions. `analysis get` takes exactly one of `--run-id` or `--task-id`; add `--force` to regenerate a run's analysis. See [Inspecting runs from the CLI](https://docs.promptingcompany.com/guides/coding-agent-optimization/runs.md#inspecting-runs-from-the-cli).

## Experiments

```bash theme={null}
tpc sim experiment create --name "Onboarding friction" \
  --task-ids task_abc,task_def --env-ids env_1,env_2 --scope acme/my-product
tpc sim experiment run exp_789 --watch --scope acme/my-product
tpc sim experiment results exp_789 --scope acme/my-product
```

* `run` starts a new iteration: one run per task and environment. `--watch`, like `tpc sim experiment run status <experiment-id> --watch`, polls every 5 seconds until the iteration completes or fails. Ctrl+C stops polling, not the iteration. `run status` prints the saved failure reason of each failed run.
* `results` reads the latest iteration, or `--iteration <n>`. When the iteration records it, results show execution coverage: runs executed, runs that did not start and runs scored. With no scored run, the average score reads `unknown`. `--error-category <name>` shows the full log of each error in that category.
* `signals` and `validate-signal-config` work with signal configs; see [Signals](https://docs.promptingcompany.com/guides/coding-agent-optimization/signals.md#working-with-signal-configs-from-the-cli).

Change what an experiment runs:

```bash theme={null}
tpc sim experiment task add exp_789 task_ghi --scope acme/my-product
tpc sim experiment task remove exp_789 task_abc --scope acme/my-product
tpc sim experiment env add exp_789 env_3 --scope acme/my-product
tpc sim experiment env remove exp_789 env_1 --scope acme/my-product
tpc sim experiment update exp_789 --env-ids env_2,env_3 --scope acme/my-product
```

`task add|remove` and `env add|remove` change one item and succeed without changes when there is nothing to do. `update --task-ids` and `--env-ids` replace the whole list. Removing a task or environment unlinks it; it doesn't delete it. Changes apply from the next iteration.

```bash theme={null}
tpc sim experiment list --status running --scope acme/my-product
tpc sim experiment get exp_789 --scope acme/my-product
tpc sim experiment delete exp_789 --scope acme/my-product
```

`delete` hides the experiment and its iterations from lists and the web app, and the CLI can't undo it. Its runs keep their scores and logs and stay in `tpc sim run list`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.