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

# CLI

> Start, inspect, list, and cancel browser runs from the command line.

The `infragrid` CLI ships with the TypeScript SDK package and uses the same public REST API.

<Note>
  The CLI becomes available through npm when `@infragrid/sdk` is published. From a source checkout, build the SDK and run `node packages/sdk/bin/infragrid.mjs`.
</Note>

## Configure

```bash theme={null}
export INFRAGRID_API_KEY="ig_live_..."
```

Set `INFRAGRID_API_URL` only for an explicitly selected preview API. The CLI falls back to `INFRAGRID_BASE_URL` for SDK compatibility.

## Commands

```bash theme={null}
infragrid run "Open example.com and summarize the page"
infragrid get <run-id>
infragrid list
infragrid cancel <run-id>
```

| Command           | Behavior                                                                                    |
| ----------------- | ------------------------------------------------------------------------------------------- |
| `run "task"`      | Creates a free-form task, prints progress to stderr, waits, and writes final JSON to stdout |
| `get <run-id>`    | Writes one run as JSON                                                                      |
| `list`            | Writes the default bounded run list                                                         |
| `cancel <run-id>` | Cancels a run and writes its state                                                          |

The `run` command exits successfully only when the terminal status is `completed`. Other command failures and non-completed task outcomes use a nonzero exit code.

## Shell automation

Because progress goes to stderr and resources go to stdout, scripts can capture the final JSON without losing human-readable status:

```bash theme={null}
result="$(infragrid run "Summarize example.com")"
status="$(printf '%s' "$result" | jq -r '.status')"
```

<Warning>
  The current CLI starts free-form browser tasks. Use the SDK or REST API for ordered workflows and published Blueprint lifecycle operations.
</Warning>


## Related topics

- [Python SDK](/sdks/python.md)
- [TypeScript SDK](/sdks/typescript.md)
- [API overview](/reference/overview.md)
- [Security model](/security.md)
- [Versioning](/production/versioning.md)
