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

# Automate Octoparse CLI

> Use Octoparse CLI in CI, scripts, and AI agents with capabilities discovery, JSON output, environment credentials, and exit codes.

Use machine-readable output and capability discovery instead of parsing human-readable help in scripts or agent workflows.

## Discover the current contract

```bash theme={null}
octoparse capabilities --json
```

The response describes supported commands, authentication, browser modes, output schemas, lifecycle events, and recommended agent recipes.

Agents should inspect the contract at the start of a workflow rather than hard-code assumptions about flags or JSON fields.

## Authenticate in CI

```bash theme={null}
OCTO_ENGINE_API_KEY=xxx octoparse task list --json
OCTO_ENGINE_ACCESS_TOKEN=xxx octoparse task list --json
```

Credential priority is access token, API key, then stored credentials from `octoparse auth login`.

<Warning>
  Do not print, commit, or include credentials in shared logs, screenshots, or generated documentation.
</Warning>

## Choose an output mode

```bash theme={null}
octoparse task list --json
octoparse run <taskId> --json
octoparse run <taskId> --jsonl
```

* `--json` returns one result envelope.
* `--jsonl` streams foreground run events as JSON Lines.
* Human output is intended for interactive terminal use.

See [Output and exit codes](../reference/output-and-exit-codes) for schemas, lifecycle events, stdout/stderr behavior, and failure codes.

## Create tasks with an agent

Agents should use `detect --agent` or the prepare / preview / apply workflow, not `--auto`.

```bash theme={null}
octoparse detect <url> \
  --agent \
  --agent-command "path/to/trusted-agent" \
  --goal "Extract product titles and prices" \
  --run-sample 5 \
  --json
```

Follow `machineContract.recipes.createTaskFromUrlWithAgent` from the capabilities response. Only pass a trusted executable to `--agent-command`.

## Confirm state-changing commands

Commands that rename, move, delete, update, or change schedules may require `--yes`. Use `capabilities --json` to discover confirmation requirements before constructing automation.

## Internal commands

`env` switches internal API environments, and `runs` inspects internal local artifacts. They are not part of the primary user workflow. Prefer public task-ID and lot-ID commands unless Octoparse support instructs you otherwise.
