Skip to main content
The @cargo-ai/cli package mirrors the full Cargo platform surface as structured shell commands. Every response is JSON, every failure exits non-zero, and every asynchronous operation (runs, batches, agent messages) has a corresponding polling command. This makes the CLI a natural fit for automation pipelines, CI/CD workflows, and AI agents that need to operate Cargo without opening a browser. This is the imperative way to work with Cargo — one-off, scripted commands. For managing a whole workspace as versioned code, use the declarative CDK (cargo-ai cdk, which ships in this same binary); for driving these commands with natural language, use Skills. See CLI, CDK & Skills for how the three fit together.

Installation

Install from npm and authenticate once — the same login the CDK and Skills reuse. The Quickstart has the full walkthrough (install, login, whoami, workspace targeting, and CI token setup):
Without a global install, prefix every command with npx @cargo-ai/cli instead of cargo-ai.

Command domains

The CLI is organized into command groups — run cargo-ai --help for the full list, and cargo-ai <group> --help to drill in. The primary domains: Other groups include content, context, system-of-record, revenue-organization, hosting, and expression.
Cargo Skills package these domains into prompt bundles so an AI agent can operate them from natural language — same commands, driven by an agent. See Skills.

How the domains relate


Key concepts

Plays vs. Tools

Using run create on a play’s workflowUuid returns a playNotCompatible error. Plays must always use batch create.

UUID discovery sequence

Most commands require UUIDs. Always discover them before acting:

UUID flow table

Async operations

All runs, batches, and agent messages are async. Either use --wait-until-finished to block until completion, or poll manually:

Filter syntax

Filters use a two-level structure with conjonction (not conjunction — this is intentional and silent if misspelled):
Operators by column type:

Error handling

All failed commands exit non-zero and print JSON to stderr:
API errors additionally include status and body fields with the HTTP response details. To add automatic retries to connector nodes in a workflow, include a retry block in the node definition:

Common gotchas


Next steps

Cargo Skills

Install Cargo Skills and drive your entire workspace with natural language prompts.

API Reference

Use the REST API directly for programmatic integrations beyond the CLI.

Tools

Define runnable automations in code with defineTool and defineWorkflow.

Agents

Wire up an AI agent with defineAgent — tools, models, and sub-agents.