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.
The CLI is also the foundation of Cargo Skills — structured prompt packages that teach AI agents (Claude, GPT-4o, Gemini) exactly how to use it.
Installation
npm install -g @cargo-ai/cli
Log in with your API token (find it under Settings > API in your Cargo workspace):
cargo-ai login --token < your-api-toke n >
To target a specific workspace:
cargo-ai login --token < your-api-toke n > --workspace-uuid < your-workspace-uui d >
Verify:
cargo-ai whoami
# → {"user":{"uuid":"...","email":"you@example.com"},"workspace":{"uuid":"...","name":"My Workspace"}}
Without a global install, prefix every command with npx @cargo-ai/cli instead of cargo-ai.
API token values are shown only once at creation time. Store them immediately in a secrets manager (GitHub Secrets, AWS Secrets Manager, 1Password, etc.).
The seven skills
The CLI is organized into seven domains. Each domain maps to a dedicated Cargo Skill that any AI agent can load to operate that part of the platform.
Skill Domain What it does cargo-cli-orchestrationRuntime Run tools on single records, trigger batch plays across segments, chat with AI agents, query the data warehouse with SQL, fetch live segment data cargo-cli-storageSchema Inspect model DDL, create and update columns (custom, computed, metric, lookup), manage datasets, set model relationships cargo-cli-connectionConnectors Authenticate connector instances, list available integrations and their action slugs, discover native actions cargo-cli-aiAgents Create and configure agents, manage releases (draft → deploy), upload files for RAG, connect MCP servers, inspect memories cargo-cli-analyticsMeasurement Download run results, export segment data to files, pull per-node error rates and success metrics cargo-cli-billingCosts Track credit consumption by workflow, connector, or agent; check subscription status; view invoices cargo-cli-workspaceAdmin Invite users, create and rotate API tokens, organize resources into folders, manage roles
How the skills relate
Key concepts
Play Tool Trigger Segment-driven (reactive) On-demand (proactive) Run command batch createrun create or batch createBatch data kinds segment, change, filter, recordIdsfile, records
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:
cargo-ai whoami # confirm workspace
cargo-ai orchestration play list # → workflowUuid, segmentUuid
cargo-ai orchestration tool list # → workflowUuid
cargo-ai storage model list # → modelUuid
cargo-ai storage model get-ddl < model-uui d > # → exact SQL table name
cargo-ai connection connector list # → connectorUuid
cargo-ai ai agent list # → agentUuid
cargo-ai segmentation segment list # → segmentUuid
UUID flow table
UUID Produced by Consumed by workflowUuidplay list / tool listrun create, batch create, metricsmodelUuidstorage model listsegment fetch, segment download, SoR DDLsegmentUuidsegmentation segment listbatch create --data '{"kind":"segment",...}'agentUuidai agent listai chat create, agent nodes in workflowsconnectorUuidconnection connector listConnector nodes in workflows, billing filter actionSlugconnection integration getConnector nodes in workflows batchUuidbatch createbatch get, batch download, run filterreleaseUuidbatch getrelease get, batch downloadfolderUuidworkspace folder listplay/tool/agent update --folder-uuid
Async operations
All runs, batches, and agent messages are async. Either use --wait-until-finished to block until completion, or poll manually:
Operation Create Poll Terminal statuses Run run createrun get <uuid> every 2ssuccess, error, cancelledBatch batch createbatch get <uuid> every 5ssuccess, error, cancelledAgent message message createmessage get <uuid> every 2ssuccess, error
Filter syntax
Filters use a two-level structure with conjonction (not conjunction — this is intentional and silent if misspelled):
{
"conjonction" : "and" ,
"groups" : [
{
"conjonction" : "and" ,
"conditions" : [
{ "kind" : "string" , "columnSlug" : "country" , "operator" : "is" , "values" : [ "US" ] },
{ "kind" : "number" , "columnSlug" : "employee_count" , "operator" : "greaterThan" , "value" : 100 }
]
}
]
}
Operators by column type:
Type Available operators stringis, isNot, contains, doesNotContain, startsWith, endsWith, isNull, isNotNull, isEmpty, isNotEmptynumberis, isNot, greaterThan, lowerThan, between, isNull, isNotNulldateis, isNot, greaterThan, lowerThan, between, isNull, isNotNullbooleanisTrue, isFalse, isNull, isNotNullobject / arrayisNull, isNotNull, matchConditions
Error handling
All failed commands exit non-zero and return:
{ "errorMessage" : "Human-readable description of what went wrong" }
To add automatic retries to connector nodes in a workflow, include a retry block in the node definition:
"retry" : {
"maximumAttempts" : 3 ,
"initialInterval" : 1000 ,
"backoffCoefficient" : 2
}
Common gotchas
Gotcha Rule Filter spelling Always write conjonction, never conjunction. Typo fails silently. run create vs batch createrun create is tool-only. Use batch create for plays.Segment fetch flag segment fetch and segment download require --model-uuid, not --segment-uuid.DDL before SQL Run model get-ddl <uuid> first — table names look like datasets_default.models_companies. Token security API token values are shown once. Store immediately. Invoice amounts subscription get-invoices returns amounts in cents. Divide by 100 for dollars.Batch partial failure status: success on a batch can still contain individual run failures — always check failedRunsCount.Rate limits Only kind: "connector" nodes have rate limits. Native nodes do not. Ramp in stages: 1 → 50 → 500 → 1000+.
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.
Build a tool Create your first automation workflow in the Cargo UI.
Build an agent Configure an AI agent with tools, files, and memory.