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.
jqfor 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
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 Open the
continue_with ID, or the run ID, to --continue. In a script, capture it with --json and jq: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:
chat ls prints one tab-separated row per run:
--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 withcloudthinker login --device-auth (the saved login refreshes itself), save the run ID, and let the exit code decide:
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.
Headless chat or headless agent?
Troubleshooting
The command hangs for a few seconds before starting
The command hangs for a few seconds before starting
Stdin is open with no data, so the CLI waits 3 seconds for input. Add
< /dev/null when nothing is piped.The prompt is rejected as too long
The prompt is rejected as too long
The prompt plus piped input is over 50,000 characters. Trim the input, for example with
--tail on logs.--continue fails because a stream is already active
--continue fails because a stream is already active
Another run is still working in that conversation. Wait for it with
chat status <run_id> --wait, then continue.The run exits with code 5
The run exits with code 5
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