Skip to main content
cloudthinker chat -p sends one prompt to CloudThinker in the cloud and prints the answer. Only the answer goes to stdout, so it drops straight into a pipe, a file, or a CI step, and the run keeps going on the server if your terminal disconnects.

Prerequisites

  • The CloudThinker CLI installed and logged in. For CI, see Authenticate a script or CI job: there is no service account or long-lived API key yet, so a job runs on a login or a short-lived token.
  • jq for the scripted examples on this page.
  • Connections for anything you want CloudThinker to inspect, such as an AWS account or a Kubernetes cluster.

Send a prompt

1

Ask a question

A spinner on stderr shows the run status while you wait.Success state: stderr shows one line, then the answer prints on stdout:
Each run uses workspace credits, like a chat turn. A nightly CI job spends them too, so keep an eye on Usage.
2

Pipe or save the answer

stdout holds only the answer, so redirect it like any other command:
3

Follow up in the same conversation

Pass the continue_with ID, or the run ID, to --continue. In a script, capture it with --json and jq:
Open the web_url to see the same conversation in the browser. Only one turn runs in a conversation at a time, so wait for the previous run to finish first.

Send input from another command

Piped stdin joins your prompt, so you can hand CloudThinker logs, diffs, or files:
The prompt and piped data together can be up to 50,000 characters. If stdin is open but sends nothing, the CLI waits 3 seconds and sends the prompt alone. In scripts with nothing to pipe, add < /dev/null to skip the wait. To have a custom agent answer, pass its UUID or alias: --agent <uuid-or-alias>.

Submit now, collect later

A long investigation doesn’t need to hold your terminal. --no-wait returns as soon as the run is queued:
The command prints one JSON object:
Collect the answer later, from any machine logged in to the same workspace:
Plain chat ls prints one tab-separated row per run:
Stopping the wait never cancels the run, and the CLI has no command that cancels one. --timeout (default 2400 seconds) and Ctrl-C only stop the CLI from waiting; the CLI prints the chat status command that picks the run back up. Follow the same run ID rather than sending the prompt again, so the work doesn’t run twice.

Read JSON output

--json writes one JSON object to stdout instead of the plain answer. With --no-wait --json, only run_id, conversation_id, status, and web_url come back, because no answer exists yet. A run that needs an approval stays required_approval until someone decides in the browser; the CLI prints Approval required. Approve in your browser: <link> and exits 5. Branch on the exit code rather than the answer, because answer is null for anything but succeeded:

Exit codes

Branch on the exit code instead of parsing text. chat ls and chat status without --wait exit 0 after a successful read, even if the run is still going. chat status --wait returns the run’s own code.

Use it in CI

Install the CLI on a runner you control, log in on it once with cloudthinker login --device-auth (the saved login refreshes itself), save the run ID, and let the exit code decide:
Code 4 ends this job green on purpose, so a later job can collect the report; report.md is empty until then. Code 5 fails the job here, because nothing happens until a person decides. Change either line to suit your pipeline. To pin a version, download the installer from that release instead of install.sh: https://github.com/cloudthinker-ai/cloudthinker-cli/releases/download/v<VERSION>/cloudthinker-cli-installer.sh. Each release on the releases page lists a SHA-256 checksum for each archive. A headless run follows the workspace Approval mode like chat. If a prompt asks for a change that needs approval, the run pauses with exit code 5 instead of acting.
Under Auto, a write that your rules or the AI check allow runs at once, with no person in the loop. The run acts as the user who logged in on the runner (or whose token the job holds), and that’s who CloudThinker records for it. There is no service account yet, so choose that login with care. See CLI authentication.

Headless chat or headless agent?

Troubleshooting

Stdin is open with no data, so the CLI waits 3 seconds for input. Add < /dev/null when nothing is piped.
The prompt plus piped input is over 50,000 characters. Trim the input, for example with --tail on logs.
Another run is still working in that conversation. Wait for it with chat status <run_id> --wait, then continue.
CloudThinker wants to make a change your workspace requires a person to approve. Open the web_url, decide, then check the same run with chat status <run_id> --wait. Don’t submit a new run to get around the approval.

Next steps

CLI authentication

Log in a runner, or hand a job a short-lived token

CLI reference

Every command, flag, variable, and exit code