{"id":"8de09614-3ca0-4afa-a12a-f4c394b23cb4","entityType":"agent","slug":"clawhub-cargo-ai-cargo-orchestration","name":"cargo-orchestration","canonicalUrl":"https://www.xpersona.co/agent/clawhub-cargo-ai-cargo-orchestration","canonicalPath":"/agent/clawhub-cargo-ai-cargo-orchestration","generatedAt":"2026-10-10T07:41:55.802Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-09T17:31:49.426Z","emptyReason":null},"description":"Make Cargo actually run something, or show what it would run — execute one connector action, run a multi-step workflow, trigger a batch across a whole segment or model, message an AI agent, build or edit a node graph, draw a workflow, tool or play as a diagram, and query the runtime tables (runs, batches, spans, records) with SQL. Triggers: \"run this on all my contacts\", \"execute the action\", \"kick off a batch\", \"build a workflow\", \"schedule a play\", \"make it run every morning\", \"ask the agent\", \"show me the workflow\", \"what does this tool do\", \"visualize this play\", \"draw the graph\", \"explain this workflow\", \"how many runs failed today\", \"what is the output schema for this action\", \"add a step that\". Skip when: explaining why a run misbehaved — use cargo-diagnostics; downloading result files — use cargo-analytics; committing the workflow as code — use cargo-project.","descriptionLabel":"Source description","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 2.2K downloads reported by the source. Last updated 10/9/2026.","installCommand":"clawhub skill install s178dcd9wkfn0a2fqrygmt3jzn87j9e1:cargo-orchestration","sourceUrl":"https://clawhub.ai/cargo-ai/cargo-orchestration","homepage":"https://clawhub.ai/cargo-ai/skills/cargo-orchestration","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/cargo-ai/cargo-orchestration","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/cargo-ai/skills/cargo-orchestration","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":67,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"cargo-orchestration technical dossier on Xpersona with agent coverage, OPENCLEW support, and live trust metadata."},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-09T17:31:49.426Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":1,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile"}},"adoption":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-09T17:31:49.426Z","emptyReason":null},"stars":null,"forks":null,"downloads":2208,"packageName":null,"latestVersion":"1.13.0","tractionLabel":"2.2K downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-09T17:31:49.426Z","emptyReason":null},"lastUpdatedAt":"2026-10-09T17:31:49.426Z","lastCrawledAt":"2026-10-09T17:31:49.426Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-10T17:31:49.426Z","lastVerifiedAt":null,"highlights":[{"version":"1.13.0","createdAt":"2026-09-24T19:38:19.916Z","changelog":"**cargo-orchestration 1.13.0** - Updated node selection guidance: now recommends building node graphs in the order of dedicated action → expression → HTTP → script, with new emphasis on preferring existing actions and inline JavaScript before code or HTTP steps. - Expanded and clarified the reference to `references/node-selection.md`, detailing expression usage, action-first design, and common pitfalls with inline logic. - Cleaned up supporting documentation, ensuring references align with the new workflow design guidance. - Removed the unused or deprecated `skill-card.md` file.","fileCount":18,"zipByteSize":69315},{"version":"1.12.1","createdAt":"2026-09-18T23:16:20.400Z","changelog":"- Documentation updated across references and SKILL.md for clarity and guidance. - Minor refinements to orchestration usage instructions and terminology. - Expanded reference sections and example links. - Removed obsolete skill-card.md file.","fileCount":18,"zipByteSize":67906},{"version":"1.12.0","createdAt":"2026-09-16T07:26:58.978Z","changelog":"cargo-orchestration v1.12.0 - Version bump from 1.11.3 to 1.12.0. - Removed the redundant skill-card.md file. - Minor updates to documentation and metadata in SKILL.md and skill-metadata.json.","fileCount":18,"zipByteSize":67778},{"version":"1.11.3","createdAt":"2026-09-14T06:27:34.584Z","changelog":"- Updated the skill version to 1.11.3. - Adjusted references, replacing \"cargo-cdk\" with \"cargo-project\" for workflow commits. - Removed the file skill-card.md. - Minor content and reference tweaks in SKILL.md to align with documentation changes.","fileCount":18,"zipByteSize":67647},{"version":"1.11.2","createdAt":"2026-09-10T18:18:35.890Z","changelog":"cargo-orchestration 1.11.2 - Documentation improvements to SKILL.md and node reference files (node-selection.md, nodes.md). - Removed redundant skill-card.md file. - Updated version metadata to 1.11.2. - No functional or CLI changes; this is a documentation and cleanup release.","fileCount":18,"zipByteSize":67679},{"version":"1.11.1","createdAt":"2026-09-02T23:42:17.770Z","changelog":"cargo-orchestration 1.11.1 - Updated documentation and internal references in SKILL.md and examples. - Removed skill-card.md. - No user-facing feature changes; maintenance and doc cleanup release.","fileCount":18,"zipByteSize":67456},{"version":"1.11.0","createdAt":"2026-09-01T23:30:40.388Z","changelog":"cargo-orchestration v1.11.0 - Updated SKILL.md to document new per-node orchestration execution fee (0.01 credits per node, applies to all nodes). - Clarified cost calculation and approval quoting for sampled batches and graph execution. - Updated references and examples for actions, plays, templates, troubleshooting, and diagrams. - Removed obsolete skill-card.md file. - Improved documentation in node diagram and troubleshooting guides. - Minor fixes and consistency improvements across reference files.","fileCount":18,"zipByteSize":67676},{"version":"1.9.0","createdAt":"2026-08-27T23:44:54.396Z","changelog":"cargo-orchestration 1.9.0 - Added documentation for action discovery: users can now search available actions before crafting JSON payloads, using action list commands. - Updated example sections to show how to look up actions by keyword when the specific operation is not yet known. - Clarified recommended usage flows, highlighting `action list` for integration, tool, and agent discovery in a single query. - Removed the deprecated skill-card.md file.","fileCount":18,"zipByteSize":66458}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s178dcd9wkfn0a2fqrygmt3jzn87j9e1:cargo-orchestration","setupComplexity":"low","setupSteps":["Install using `clawhub skill install s178dcd9wkfn0a2fqrygmt3jzn87j9e1:cargo-orchestration` in an isolated environment before connecting it to live workloads.","No published capability contract is available yet, so validate auth and request/response behavior manually.","Review the upstream CLAWHUB listing at https://clawhub.ai/cargo-ai/cargo-orchestration before using production credentials."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-cargo-ai-cargo-orchestration/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-cargo-ai-cargo-orchestration/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-cargo-ai-cargo-orchestration/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-cargo-ai-cargo-orchestration/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-cargo-ai-cargo-orchestration/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-cargo-ai-cargo-orchestration/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-10T07:41:55.797Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-cargo-ai-cargo-orchestration/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-cargo-ai-cargo-orchestration/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-cargo-ai-cargo-orchestration/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-cargo-ai-cargo-orchestration/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-09T17:31:49.426Z","emptyReason":null},"readme":"Skill: cargo-orchestration\n\nOwner: cargo-ai\n\nSummary: Make Cargo actually run something, or show what it would run — execute one connector action, run a multi-step workflow, trigger a batch across a whole segment or model, message an AI agent, build or edit a node graph, draw a workflow, tool or play as a diagram, and query the runtime tables (runs, batches, spans, records) with SQL. Triggers: \"run this on all my contacts\", \"execute the action\", \"kick off a batch\", \"build a workflow\", \"schedule a play\", \"make it run every morning\", \"ask the agent\", \"show me the workflow\", \"what does this tool do\", \"visualize this play\", \"draw the graph\", \"explain this workflow\", \"how many runs failed today\", \"what is the output schema for this action\", \"add a step that\". Skip when: explaining why a run misbehaved — use cargo-diagnostics; downloading result files — use cargo-analytics; committing the workflow as code — use cargo-project.\n\nTags: latest:1.13.0\n\nVersion history:\n\nv1.13.0 | 2026-09-24T19:38:19.916Z | auto\n\n**cargo-orchestration 1.13.0**\n\n- Updated node selection guidance: now recommends building node graphs in the order of dedicated action → expression → HTTP → script, with new emphasis on preferring existing actions and inline JavaScript before code or HTTP steps.\n- Expanded and clarified the reference to `references/node-selection.md`, detailing expression usage, action-first design, and common pitfalls with inline logic.\n- Cleaned up supporting documentation, ensuring references align with the new workflow design guidance.\n- Removed the unused or deprecated `skill-card.md` file.\n\nv1.12.1 | 2026-09-18T23:16:20.400Z | auto\n\n- Documentation updated across references and SKILL.md for clarity and guidance.\n- Minor refinements to orchestration usage instructions and terminology.\n- Expanded reference sections and example links.\n- Removed obsolete skill-card.md file.\n\nv1.12.0 | 2026-09-16T07:26:58.978Z | auto\n\ncargo-orchestration v1.12.0\n\n- Version bump from 1.11.3 to 1.12.0.\n- Removed the redundant skill-card.md file.\n- Minor updates to documentation and metadata in SKILL.md and skill-metadata.json.\n\nv1.11.3 | 2026-09-14T06:27:34.584Z | auto\n\n- Updated the skill version to 1.11.3.\n- Adjusted references, replacing \"cargo-cdk\" with \"cargo-project\" for workflow commits.\n- Removed the file skill-card.md.\n- Minor content and reference tweaks in SKILL.md to align with documentation changes.\n\nv1.11.2 | 2026-09-10T18:18:35.890Z | auto\n\ncargo-orchestration 1.11.2\n\n- Documentation improvements to SKILL.md and node reference files (node-selection.md, nodes.md).\n- Removed redundant skill-card.md file.\n- Updated version metadata to 1.11.2.\n- No functional or CLI changes; this is a documentation and cleanup release.\n\nv1.11.1 | 2026-09-02T23:42:17.770Z | auto\n\ncargo-orchestration 1.11.1\n\n- Updated documentation and internal references in SKILL.md and examples.\n- Removed skill-card.md.\n- No user-facing feature changes; maintenance and doc cleanup release.\n\nv1.11.0 | 2026-09-01T23:30:40.388Z | auto\n\ncargo-orchestration v1.11.0\n\n- Updated SKILL.md to document new per-node orchestration execution fee (0.01 credits per node, applies to all nodes).\n- Clarified cost calculation and approval quoting for sampled batches and graph execution.\n- Updated references and examples for actions, plays, templates, troubleshooting, and diagrams.\n- Removed obsolete skill-card.md file.\n- Improved documentation in node diagram and troubleshooting guides.\n- Minor fixes and consistency improvements across reference files.\n\nv1.9.0 | 2026-08-27T23:44:54.396Z | auto\n\ncargo-orchestration 1.9.0\n\n- Added documentation for action discovery: users can now search available actions before crafting JSON payloads, using action list commands.\n- Updated example sections to show how to look up actions by keyword when the specific operation is not yet known.\n- Clarified recommended usage flows, highlighting `action list` for integration, tool, and agent discovery in a single query.\n- Removed the deprecated skill-card.md file.\n\nv1.8.0 | 2026-08-16T05:41:24.870Z | auto\n\n- Added ASCII diagram output for workflow, tool, and play visualizations (requires CLI ≥ 1.0.56).\n- Expanded skill description and triggers to include “show me the workflow”, “draw the graph”, and related diagram queries.\n- Updated documentation to clarify the new --format ascii option for node diagrams, with usage guidance.\n- Improved references and instructions in SKILL.md to highlight places where diagram output, format selection, and related documentation are relevant.\n- Removed redundant/obsolete file (skill-card.md).\n\nv1.7.0 | 2026-08-15T01:08:51.362Z | auto\n\ncargo-orchestration 1.7.0\n\n- Added new node diagram documentation: how to render node/workflow graphs as flowcharts, with usage details and best practices.\n- Updated main guide to highlight the new diagramming feature (`node diagram`) for visualizing workflows, including references to the new documentation.\n- Expanded references with a new link: `references/node-diagram.md`.\n- Removed outdated documentation (`skill-card.md`).\n- Updated references and example links for clarity and navigation.\n\nv1.6.3 | 2026-08-15T00:25:51.256Z | auto\n\n- Version bump to 1.6.3.\n- Documentation updates in SKILL.md and references/polling.md.\n- Removed obsolete skill-card.md file.\n- Updated skill-metadata.json for version consistency.\n\nv1.6.2 | 2026-08-14T20:06:08.439Z | auto\n\n- Expanded and clarified skill description for better guidance on when and when not to use the skill.\n- Added a new \"Bootstrap\" section with clear installation and login steps for first-time users.\n- Updated references and terminology for greater accuracy and discoverability.\n- Improved organization and instructions in documentation, including better explanations for plays vs. tools and UI locations.\n- Removed the deprecated skill-card.md file to keep documentation current.\n\nv1.6.1 | 2026-08-11T21:43:27.914Z | auto\n\ncargo-orchestration 1.6.1\n\n- Updated login instructions to recommend `cargo-ai login --email` for CLI sign-in, removing browser requirement.\n- Compatibility notes clarified in the description and prerequisites section.\n- Removed outdated `skill-card.md` file to streamline documentation.\n\nv1.6.0 | 2026-08-08T21:20:59.253Z | auto\n\ncargo-orchestration 1.6.0\n\n- Added guidance for batch operations: documents the new \"sample gate\" recommended workflow for action execute-batch and batch create (run a sample, estimate cost, prompt approval before proceeding).\n- Minor documentation updates and clarifications in SKILL.md.\n- Removed the skill-card.md file.\n\nv1.5.2 | 2026-08-08T18:35:14.871Z | auto\n\n- Added support and documentation for node-level execution with the new debug-only surface (`node execute`), clarifying its intended use and requirements.\n- Updated SKILL.md to explain the distinction between `action execute` (default) and `node execute` (debug/testing a node within a workflow).\n- Added skill-metadata.json; removed deprecated skill-card.md file.\n- Revised examples and references to reflect latest orchestration features and best practices.\n\nv1.5.1 | 2026-07-10T00:54:58.368Z | auto\n\n- Add new action: action get-output-schema now allows you to resolve an action's output schema without executing it.\n- References and help now include a pointer to the cargo-diagnostics skill for forensic debugging and deeper analysis.\n- Updated execute-batch and example commands for connector actions to use camelCase actionSlug (e.g., enrichCompany).\n- Removed redundant/unlinked skill-card.md file.\n- Expanded documentation with improved guidance on diagnostics and output schema resolution.\n\nv1.5.0 | 2026-05-30T13:09:09.228Z | auto\n\n**Skill: cargo-orchestration**  \n**Version: 1.5.0**\n\n- Added a new reference: `references/node-selection.md` to guide node selection and best practices (including a decision table and tips on avoiding unnecessary Python/script nodes).\n- Expanded documentation in SKILL.md to include advice on preferring built-in actions and expressions over custom scripting.\n- Updated references section in SKILL.md to highlight the new `node-selection.md` and provide clearer navigation and context for node creation and selection.\n- Minor clarifications and improvements throughout SKILL.md.\n\nv1.4.1 | 2026-05-28T22:12:39.383Z | auto\n\n- Example reference files were reorganized into a new references/examples/ directory for actions, tools, plays, agents, queries, segments, and templates.\n- Outdated reference files were removed and replaced with new, example-focused documentation.\n- Prerequisites and installation instructions now refer to a shared prerequisites guide.\n- Minor metadata update: CLI dependency now uses \"@cargo-ai/cli@latest\" for installation.\n- SKILL.md reference links and documentation updated for clarity and improved organization.\n\nv1.4.0 | 2026-05-28T18:26:13.056Z | auto\n\nVersion 1.4.0\n\n- Expanded documentation in SKILL.md with detailed usage examples, terminology, quick references, and compatibility rules.\n- Added comprehensive guidance for discovering required resource UUIDs and differentiating between tools, plays, and workflows.\n- Included polling strategies, troubleshooting references, and integration instructions for async operations.\n- Outlined command compatibility and best practices for interacting with various Cargo platform orchestration features.\n\nArchive index:\n\nArchive v1.13.0: 18 files, 69315 bytes\n\nFiles: references/examples/actions.md (14007b), references/examples/agents.md (6789b), references/examples/plays.md (9632b), references/examples/queries.md (4459b), references/examples/segments.md (9523b), references/examples/templates.md (7581b), references/examples/tools.md (13771b), references/filter-syntax.md (9458b), references/node-diagram.md (11492b), references/node-selection.md (4829b), references/nodes.md (42694b), references/polling.md (7071b), references/response-shapes.md (16080b), references/troubleshooting.md (17220b), skill-card.md (2485b), skill-metadata.json (2146b), SKILL.md (31698b), _meta.json (139b)\n\nFile v1.13.0:SKILL.md\n\n---\nname: cargo-orchestration\ndescription: \"Make Cargo actually run something, or show what it would run — execute one connector action, run a multi-step workflow, trigger a batch across a whole segment or model, message an AI agent, build or edit a node graph, draw a workflow, tool or play as a diagram, and query the runtime tables (runs, batches, spans, records) with SQL. Triggers: \\\"run this on all my contacts\\\", \\\"execute the action\\\", \\\"kick off a batch\\\", \\\"build a workflow\\\", \\\"schedule a play\\\", \\\"make it run every morning\\\", \\\"ask the agent\\\", \\\"show me the workflow\\\", \\\"what does this tool do\\\", \\\"visualize this play\\\", \\\"draw the graph\\\", \\\"explain this workflow\\\", \\\"how many runs failed today\\\", \\\"what is the output schema for this action\\\", \\\"add a step that\\\". Skip when: explaining why a run misbehaved — use cargo-diagnostics; downloading result files — use cargo-analytics; committing the workflow as code — use cargo-project.\"\nversion: \"1.13.0\"\ncompatibility: Requires @cargo-ai/cli (npm). Sign in or create an account with `cargo-ai login --email` (emailed code, no browser), `--oauth`, or an API token\nhomepage: https://github.com/getcargohq/cargo-skills\nmetadata:\n  author: getcargo\n  openclaw:\n    requires:\n      bins:\n        - cargo-ai\n    install:\n      - kind: node\n        package: \"@cargo-ai/cli@latest\"\n        bins:\n          - cargo-ai\n    homepage: https://github.com/getcargohq/cargo-skills\n---\n\n# Cargo CLI — Orchestration\n\nRuntime operations for the Cargo platform.\n\n**What do you want to run?**\n\n```\nNeed to run something?\n├── Don't know the action yet    → action list <keywords>\n├── One action, one record       → action execute\n├── One action, many records     → action execute-batch\n├── Multiple actions chained\n│   ├── One-off / ad-hoc         → run create --nodes (one record)\n│   │                              batch create --nodes (many records)\n│   └── Reusable workflow        → build a tool, then run create --workflow-uuid\n│                                  or batch create --workflow-uuid\n├── Conversational AI agent      → message create\n└── Testing ONE node of a\n    workflow you're building     → node execute (debug only — see below)\n```\n\n> **Fanning out across many records (`action execute-batch`, `batch create`)? Sample first.** Run 10–20 records, report the observed cost and hit-rate, then ask the user to approve the full enrollment — quoting the **record count** and the **credit estimate**. See [Create a batch → the sample gate](#the-sample-gate).\n\n> **Every node execution costs 0.01 credits — 1 credit per 100 — whatever the node is.**\n> `branch`, `filter`, `switch`, `variables` and the rest carry no provider price, but\n> they are not free: the charge is per *execution*, so a graph's cost has two terms,\n> `(provider cost × records) + (nodes × records ÷ 100)`. On step-heavy, action-light\n> graphs the second term dominates. It shows up in **no** per-node field — not\n> `executions[].creditsUsedCount`, not `spans.execution_credits_used_count` — only in\n> `billing usage get-metrics --unit orchestration.executions`. Quote both terms in the\n> approval message ([`../cargo-gtm/references/cost-discipline.md`](../cargo-gtm/references/cost-discipline.md) §1).\n\n> **Find the action before you hand-write the JSON.** `cargo-ai orchestration\n> action list <keywords>` searches the integration catalog, Cargo native actions,\n> workspace tools, and agents in one call — free, runs nothing — and each result\n> carries a ready-to-paste `action` object (with `connectorUuid` already filled\n> in), the action's **credit costs**, and its autocomplete slugs. Narrow with\n> `--kind connector|native|tool|agent`, `--integration-slug <slug>`, `--limit`\n> (default 20, max 50). `unknown command` means the CLI predates it — refresh.\n\n> **`action execute`, not `node execute`, is the default for running something.**\n> `node execute` is a **debug** surface for a node that already lives in a workflow:\n> it requires `--workflow-uuid`, `--release-uuid`, `--node`, `--computed-config`\n> **and** `--context` (all five, enforced client-side), and it bills like any live\n> call. If you just want an operation's output — enrich a domain, call a connector\n> action, invoke a tool or agent — use `action execute` / `action execute-batch`\n> with a small `--action` + `--data` payload. Only reach for `node execute` when\n> verifying one node's behavior before running the full graph.\n\n> **Terminology:** An orchestration **tool** is a saved on-demand workflow (listed via `tool list`). An **action** is a single operation you execute without building a workflow — it can embed a saved orchestration tool (`kind: \"tool\"`), call a third-party connector (`kind: \"connector\"`), invoke an AI agent (`kind: \"agent\"`), or run a built-in platform operation (`kind: \"native\"`).\n\n> **Composing a node graph? Build it from dedicated actions + expressions, in this order:**\n> 1. **A dedicated action.** Search first with `action list <keywords>` (free): connector\n>    actions, native actions (`agent`, `modelUpsert`, `branch`, `group`…), tools.\n> 2. **An expression** for the glue. It's inline JavaScript in the field that needs the\n>    value: reshaping, payloads, conditions, arrays.\n> 3. **HTTP**, only if step 1 found no action for that API.\n> 4. **A `script` node**, only if the logic can't fit in an expression.\n>\n> See **`references/node-selection.md`**.\n\n> **Show the graph, don't describe it.** Before deploying a draft, and whenever\n> the user asks what a workflow or play does, draw it:\n> `cargo-ai orchestration node diagram --workflow-uuid <uuid> --format ascii --raw`\n> (free, runs nothing; `--format` needs CLI ≥ 1.0.56, the command itself ≥ 1.0.54).\n> Routing, fallback edges, and which steps bill are what the user is actually\n> approving, and prose flattens all three. **Pick the format by where the output\n> goes:** `ascii` renders a picture a person can read in a terminal or a chat\n> reply; `mermaid` (the default) is source code, correct only when you are\n> pasting into a PR, a doc, or a page that renders it. Sources, the ASCII legend,\n> cost marking, and the duplicate-slug footgun: **`references/node-diagram.md`**.\n\n**References:**\n\n> `references/examples/actions.md` — action execute and execute-batch examples\n> `references/examples/tools.md` — tool (on-demand workflow) examples\n> `references/examples/plays.md` — play (segment-driven automation) examples\n> `references/examples/agents.md` — AI agent chat examples\n> `references/examples/templates.md` — pre-built workflow templates\n> `references/examples/queries.md` — `orchestration query execute` (ClickHouse: runs/batches/spans/records) SQL examples. For `storage query` (workspace storage), see the `cargo-storage` skill.\n> `references/examples/segments.md` — segment fetch and filter examples\n> `references/nodes.md` — full node creation guide (kinds, native actions, expressions, validation, routing)\n> `references/node-diagram.md` — **draw a node graph as a Mermaid flowchart** (`node diagram`): every source (workflow / draft / release / run / raw nodes), marking paid nodes, highlighting a failing node, and why diagrams key on `uuid` rather than `slug`\n> `references/node-selection.md` — **build from dedicated actions + expressions** (action → expression → HTTP → `script`, in that order): expressions are inline JavaScript, where the logic goes (inline in one field, a shared `variables` node, or a `script`), native actions to prefer over code/HTTP, and expression traps (silent empty paths, ISO strings arriving as `Date`, testing with `expression eval`)\n> `references/filter-syntax.md` — complete filter condition reference\n> `references/polling.md` — async polling patterns, error handling, retry strategies\n> `references/response-shapes.md` — full JSON response structures\n> `references/troubleshooting.md` — common errors, plus a \"Debugging a workflow run\" section for runs that succeed but produce wrong output (wrong-branch routing, empty downstream values)\n\n> **Diagnosing after the fact?** For the ordered forensic runbooks built on these surfaces — trace one run, sweep a batch for errors grouped by root cause, profile a play's credit spend — load the [`cargo-diagnostics`](../cargo-diagnostics/SKILL.md) skill.\n\n## Bootstrap\n\nAlready signed in (`cargo-ai whoami` returns a workspace)? Skip to the next section.\n\n```bash\nnpm install -g @cargo-ai/cli            # no global install? prefix every command with `npx @cargo-ai/cli`\ncargo-ai login --email you@company.com  # emailed code, no browser; creates the account on first use\n                                        # alternatives: --oauth (browser) · --token <api-token> (CI)\ncargo-ai whoami                         # confirm the active workspace before any write\n```\n\nEvery command prints JSON to stdout; failures exit non-zero with `{\"errorMessage\": \"...\"}`. Anything that creates a run or a batch is async — pass `--wait-until-finished` or poll the matching `get`. When the full skill bundle is installed, [`../cargo/references/prerequisites.md`](../cargo/references/prerequisites.md) adds the CLI version pin, token scopes, and the admin-only surface.\n\n## Discover resources first\n\nMost commands require UUIDs. Always discover them before acting.\n\n```bash\ncargo-ai orchestration action list <query>  # actions across connectors, native, tools, agents (+ credits)\ncargo-ai orchestration play list            # all plays (name, workflowUuid, modelUuid, segmentUuid)\ncargo-ai orchestration tool list            # all tools (name, workflowUuid, description)\ncargo-ai orchestration workflow list        # all workflows (uuid only — no name)\ncargo-ai orchestration template list       # all workflow templates (slug, name, kind)\ncargo-ai ai agent list                     # all agents (uuid, name)\ncargo-ai ai template list                  # all AI agent templates (slug, name, languageModelSlug)\ncargo-ai storage model list                # all models (uuid, name, slug, columns)\ncargo-ai storage dataset list              # all datasets\ncargo-ai segmentation segment list         # all segments (uuid, name, modelUuid)\ncargo-ai connection connector list         # all connectors\n```\n\n**Plays vs tools:** Both are backed by a workflow. A **play** is a segment-driven automation — it reacts to data changes in a segment (records added, updated, removed). A **tool** is an on-demand workflow — triggered manually, via API, or on a cron schedule. Workflows don't have a `name` field; use `play list` or `tool list` to find names and extract the `workflowUuid`.\n\n**Retrieve in the UI:** plays live at `app.getcargo.io/workspaces/<WORKSPACE_UUID>/plays/<PLAY_UUID>` and tools at `app.getcargo.io/workspaces/<WORKSPACE_UUID>/tools/<TOOL_UUID>`. Get `<WORKSPACE_UUID>` from `cargo-ai whoami` under `workspace.uuid`.\n\n**Designing a new tool or play?** Check templates first — they are pre-built node graphs for common automation patterns (enrichment pipelines, CRM syncs, lead scoring) and are an excellent starting point. List templates with `cargo-ai orchestration template list` and inspect a specific one with `cargo-ai orchestration template get <slug>`. Templates are tagged by `kind` so you can find ones suited for tools (`\"kind\":\"tool\"`) or plays (`\"kind\":\"play\"`) right away. See `references/examples/templates.md` for the full guide.\n\n**Compatibility rules:**\n\n- **`run create`** — only works with **tool** workflows (or no `workflowUuid`). Play workflows return `playNotCompatible`.\n- **`batch create`** — allowed data kinds depend on the workflow type:\n  - **Play** workflows: `filter`, `recordIds`, `segment`, `change`. Trigger a play with `filter`; `segment` takes a standalone segment only, never the `segmentUuid` from `play list`.\n  - **Tool** workflows (or no `workflowUuid`): `file`, `records`\n\n## Quick reference\n\n```bash\n# Find an action (free — no run, no credits)\ncargo-ai orchestration action list enrich company\ncargo-ai orchestration action list send --kind connector --integration-slug slack\n\n# Single actions\ncargo-ai orchestration action execute --action '{\"kind\":\"tool\",\"toolUuid\":\"<uuid>\"}' --data '{\"domain\":\"acme.com\"}'\ncargo-ai orchestration action execute-batch --action '{\"kind\":\"connector\",\"integrationSlug\":\"clearbit\",\"actionSlug\":\"enrichCompany\"}' --records '[{...},{...}]'\ncargo-ai orchestration action get-output-schema --action '{\"kind\":\"connector\",\"integrationSlug\":\"clearbit\",\"actionSlug\":\"enrichCompany\"}' # → {\"schema\": <JSON Schema>} without executing\n\n# Workflows (chain multiple actions)\ncargo-ai orchestration run create --workflow-uuid <uuid> --data '{\"company\":\"Acme\",\"domain\":\"acme.com\"}'\ncargo-ai orchestration run create --data '{\"domain\":\"acme.com\"}' --nodes '[...]'\ncargo-ai orchestration batch create --workflow-uuid <uuid> --data '{\"kind\":\"filter\",\"modelUuid\":\"...\",\"filter\":{\"conjonction\":\"and\",\"groups\":[]}}'\n\n# AI agents\ncargo-ai ai message create --chat-uuid <uuid> --parts '[{\"type\":\"text\",\"text\":\"...\"}]'\n\n# Data\ncargo-ai orchestration query execute \"SELECT count() FROM runs WHERE status='error'\" # ClickHouse: spans, runs, batches, records\ncargo-ai segmentation segment fetch --model-uuid <uuid> --filter '{\"conjonction\":\"and\",\"groups\":[]}' --fetching-limit 100\n# For SQL against workspace storage (Companies, Contacts, …), see the cargo-storage skill: `storage query execute`\n```\n\n## Polling async operations\n\nAll operations are asynchronous. Either poll until terminal state, or pass `--wait-until-finished` to block.\n\n`action execute` returns a run. `action execute-batch` returns a batch. They poll the same way:\n\n| Result type     | Poll command         | Interval | Done when                                      |\n| --------------- | -------------------- | -------- | ---------------------------------------------- |\n| Run             | `run get <uuid>`     | 2s       | `status` is `success`, `error`, or `cancelled` |\n| Batch           | `batch get <uuid>`   | 5s       | `status` is `success`, `error`, or `cancelled` |\n| Agent message   | `message get <uuid>` | 2s       | `status` is `success` or `error`               |\n\nFor long-running batches (1000+ records), increase the interval to 10-15s after the first minute.\n\n## Execute actions\n\nRun a single action — no workflow or node graph needed.\n\n### Find it first — `action list`\n\n```bash\ncargo-ai orchestration action list enrich company          # all kinds\ncargo-ai orchestration action list --kind tool             # this workspace's tools\ncargo-ai orchestration action list send --kind connector --integration-slug slack\n```\n\nFree, executes nothing. All query terms must match (AND); a hit on the action\nslug or name ranks above the integration, which ranks above the description.\nReturns `{query, totalMatches, results[]}` where each result carries `name`,\n`description`, `score`, an `action` object to paste straight into `execute` /\n`execute-batch` / `get-output-schema`, the workspace `connectors` for that\nintegration, `credits` (the cost table, when the action bills), and\n`autocompletes` (config fields that need a picked id — a HubSpot object type, a\nSlack channel). Defaults to 20 results, max 50.\n\n```bash\n# One action, one record → returns a run\ncargo-ai orchestration action execute \\\n  --action '{\"kind\":\"connector\",\"integrationSlug\":\"clearbit\",\"actionSlug\":\"enrichCompany\"}' \\\n  --data '{\"domain\":\"acme.com\"}' \\\n  --wait-until-finished\n\n# One action, many records → returns a batch\ncargo-ai orchestration action execute-batch \\\n  --action '{\"kind\":\"tool\",\"toolUuid\":\"<tool-uuid>\"}' \\\n  --records '[{\"domain\":\"acme.com\"},{\"domain\":\"globex.com\"}]' \\\n  --wait-until-finished\n```\n\nAction kinds: `tool`, `connector`, `agent`, `native`. See `references/examples/actions.md` for all action kinds, parameters, retry config, response shapes, and end-to-end examples.\n\n> **A top-level action has no `config` — omit it.** Inputs belong in `--data` /\n> `--records`; `execute` and `execute-batch` take the action with no `config` key\n> at all, which is exactly what `action list` hands back, so its result pastes\n> straight in. (`\"config\": {}` is still accepted there, harmlessly.)\n>\n> **`get-output-schema` takes the same pair.** The action object from\n> `action list`, plus `--data` when the action's output depends on its inputs —\n> a HubSpot object type or a target sheet decides which fields come back\n> (`--data` needs **CLI ≥ 1.0.67**; the config-less `--action` works from 1.0.66).\n> Workflow **nodes**, an alert's `--actions`, a play's `healthAlertActions`, and\n> an agent's or MCP server's `--actions` are where `config` still lives; that is\n> a node's configuration, not an action's input.\n>\n> **Inputs put in `config` are now dropped, not rejected.** The guard that used to\n> answer `A top-level action does not use action.config…` is gone, so the action\n> runs with *no input* — you get a provider-side missing-field error or an empty\n> result that never mentions `config`. Check this first when a call comes back\n> empty for no visible reason.\n\n> **`execute-batch` bills per record.** Pass a 10–20 record slice of `--records` first, report the observed per-record cost and hit-rate, and get approval (with the full record count and credit estimate) before sending the rest — same gate as [Create a batch](#the-sample-gate).\n\n### Resolve an action's output schema (without executing)\n\n**Never guess what an action outputs.** Two free sources — no run, no credits:\n\n1. **Connector actions:** the integration catalog carries the output schema inline — `integration get <slug>` (and `integration list`) return `actions.<actionSlug>.output.schema` next to the input `config.jsonSchema`. Not every action declares one.\n2. **Any action kind** (`tool` / `connector` / `agent` / `native`) — resolve it with the same `--action` object as `action execute`:\n\n```bash\ncargo-ai orchestration action get-output-schema \\\n  --action '{\"kind\":\"connector\",\"integrationSlug\":\"clearbit\",\"actionSlug\":\"enrichCompany\"}'\n# → {\"schema\": {\"type\": \"object\", \"properties\": {...}}}  — the JSON Schema is under the top-level \"schema\" key\n\n# When the output depends on the inputs, pass them exactly as `execute` takes\n# them (--data needs CLI >= 1.0.67):\ncargo-ai orchestration action get-output-schema \\\n  --action '{\"kind\":\"connector\",\"integrationSlug\":\"hubspot\",\"actionSlug\":\"findRecords\"}' \\\n  --data '{\"objectType\":\"contacts\"}' \n```\n\nActions that declare no output schema fail with `\"Action has no output schema.\"` (non-zero exit, status 404) — that's the signal to fall back to inspecting `runContext` from a real run. Use these to:\n\n- Know which fields a downstream node can read (`{{nodes.<slug>.<field>}}`) **before** wiring the graph.\n- See an `agent` action's real output envelope — a default free-text agent resolves to `{\"schema\":{\"type\":\"object\",\"properties\":{\"answer\":{\"type\":\"string\"}}}}`, which is why downstream references need `{{nodes.<slug>.answer...}}`.\n- Map an action's output onto storage columns without a throwaway run.\n\nSee `references/examples/actions.md` (\"Resolve an action's output schema\") for verified per-kind examples and the response/error shapes.\n\n## Create a run\n\nA run processes a single record through a workflow. Use `run create` when you need to **chain multiple actions** together via a node graph, or when running an existing tool workflow.\n\n**Runs only work with tool workflows.** Play workflows return `playNotCompatible` — use `batch create` instead.\n\n```bash\ncargo-ai orchestration run create \\\n  --workflow-uuid <tool.workflowUuid> \\\n  --data '{\"company\":\"Acme\",\"domain\":\"acme.com\"}'\n# → Poll with: cargo-ai orchestration run get <run-uuid>\n\n# Or wait synchronously — blocks until the run reaches a terminal state and returns the final result\ncargo-ai orchestration run create \\\n  --workflow-uuid <tool.workflowUuid> \\\n  --data '{\"company\":\"Acme\",\"domain\":\"acme.com\"}' \\\n  --wait-until-finished\n```\n\nAlso supports `--release-uuid` to pin a specific release.\n\n**Cancelling runs:**\n\n```bash\ncargo-ai orchestration run cancel --workflow-uuid <uuid> --uuids run-uuid-1,run-uuid-2\n```\n\nSee `references/examples/tools.md` for file uploads, monitoring, and cancellation. See `references/nodes.md` for custom node graphs.\n\n## Create a batch\n\n> **Sample first, then ask before enrolling everything — blocking.** A batch fans one workflow across every record in its data source, so a mistake and a full bill land together. Never enroll a full segment/file/model on the first attempt: run a **10–20 record sample**, report what it cost and returned, then ask the user to approve the full enrollment with the **record count and credit estimate** in the question. Mechanics below; the spend rules behind it are [`../cargo-gtm/references/cost-discipline.md`](../cargo-gtm/references/cost-discipline.md).\n\n### The sample gate\n\n**1. Count the pool first (free).** Never quote an estimate from a guess:\n\n```bash\ncargo-ai segmentation segment get <segment-uuid>          # → recordsCount (also on `segment list`)\ncargo-ai storage query execute \"SELECT count() FROM <dataset>.<model>\"   # for a filter/model source\n# For a file source: wc -l on the CSV, minus the header row.\n```\n\n**2. Run 10–20 records through the exact workflow and config.** Sample by data kind:\n\n```bash\n# Play workflow, segment source → reuse the segment's own filter, capped by `limit`\ncargo-ai segmentation segment get <segment-uuid>          # → copy .filter and .modelUuid\ncargo-ai orchestration batch create \\\n  --workflow-uuid <play.workflowUuid> \\\n  --data '{\"kind\":\"filter\",\"modelUuid\":\"<modelUuid>\",\"filter\":<segment.filter>,\"limit\":15}' \\\n  --wait-until-finished\n\n# Play workflow, explicit records → pick 10–20 ids\ncargo-ai orchestration batch create \\\n  --workflow-uuid <play.workflowUuid> \\\n  --data '{\"kind\":\"recordIds\",\"modelUuid\":\"<modelUuid>\",\"ids\":[\"id-1\",\"…\",\"id-15\"]}'\n\n# Tool workflow, inline records → slice the array\ncargo-ai orchestration batch create \\\n  --workflow-uuid <tool.workflowUuid> \\\n  --data '{\"kind\":\"records\",\"records\":[ /* first 15 only */ ]}'\n\n# Tool workflow, file → upload a truncated CSV (header + 15 rows), not the full file\nhead -n 16 leads.csv > leads-sample.csv\ncargo-ai workspaceManagement file upload --file ./leads-sample.csv\n```\n\n`limit` is the sampling lever for `kind: \"filter\"`. `kind: \"segment\"` and `kind: \"change\"` have **no limit** — they always enroll the whole set, so sample via `filter` or `recordIds` and switch to `segment` only for the approved full run.\n\n**3. Report the sample, then ask.** The confirmation must carry both numbers the user needs to decide:\n\n```\nSample: 15 of 1,240 records · 6.2 credits (0.41/record) · 13/15 enriched (87%)\nFull enrollment: 1,225 remaining records ≈ 502 credits (balance: 780)\n\nEnroll all 1,225? Or:\n  1. Enroll all 1,225 (≈502 cr, leaves ~278)\n  2. Trim scope — e.g. the 610 records with a domain set (≈250 cr)\n  3. Stop here and review the sample output first\n```\n\nWait for an explicit answer. **Do not enroll the full set on an unanswered question**, and don't treat approval of the sample as approval of the full run. Skip the gate only when the batch is free (no paid nodes) *and* small, or when the user has already named the scope and approved the cost this session.\n\nBatches process multiple records at once. Allowed data kinds depend on the workflow type:\n\n- **Play** workflows: `filter`, `recordIds`, `segment`, `change`\n- **Tool** workflows (or no `workflowUuid`): `file`, `records`\n\nUse `filter` to trigger a play — it queries the model directly. `segment` only\naccepts a **standalone** segment from `segmentation segment list`; passing the\n`segmentUuid` that `play list` returns is rejected (`segmentLinkedToPlay`, or\n`noRecords` on older backends) because a play's generated segment never has a\npopulated record count.\n\n```bash\n# Play workflow — run over the play's model (empty filter = all rows)\ncargo-ai orchestration batch create \\\n  --workflow-uuid <play.workflowUuid> \\\n  --data '{\"kind\":\"filter\",\"modelUuid\":\"...\",\"filter\":{\"conjonction\":\"and\",\"groups\":[]}}'\n\n# Tool workflow — run on a file\ncargo-ai orchestration batch create \\\n  --workflow-uuid <tool.workflowUuid> \\\n  --data '{\"kind\":\"file\",\"s3Filename\":\"...\"}'\n# → Poll with: cargo-ai orchestration batch get <batch-uuid>\n\n# Or wait synchronously — blocks until the batch reaches a terminal state and returns the final result\ncargo-ai orchestration batch create \\\n  --workflow-uuid <play.workflowUuid> \\\n  --data '{\"kind\":\"filter\",\"modelUuid\":\"...\",\"filter\":{\"conjonction\":\"and\",\"groups\":[]}}' \\\n  --wait-until-finished\n```\n\n**Downloading results:** get the `releaseUuid` from batch get, then `cargo-ai orchestration release get <release-uuid>` to find `nodes[].slug`, then `cargo-ai orchestration batch download --uuid <batch-uuid> --output-node-slug <slug>`.\n\n**Cancelling a batch:**\n\n```bash\ncargo-ai orchestration batch cancel <batch-uuid>\n```\n\nSee `references/examples/plays.md` and `references/examples/tools.md` for filtering, record IDs, file uploads, monitoring, and cancellation.\n\n## Send a message to an AI agent\n\n```bash\ncargo-ai ai agent list                                    # 1. Find the agent\ncargo-ai ai chat create \\                                 # 2. Create a chat\n  --trigger '{\"type\":\"draft\"}' \\\n  --agent-uuid <agent-uuid> --name \"Research session\"\ncargo-ai ai message create \\                              # 3. Send a message\n  --chat-uuid <chat-uuid> \\\n  --parts '[{\"type\":\"text\",\"text\":\"Find the VP of Sales at Acme Corp\"}]'\n# → Extract assistantMessage.uuid, poll with: cargo-ai ai message get <uuid>\n#   Done when .message.status is \"success\" (read .parts) or \"error\" (read .errorMessage)\n```\n\nAlso supports `--actions`, `--resources`, `--language-model-slug`, `--temperature`, `--max-steps`, and `--wait-until-finished` (blocks until the assistant message reaches a terminal status). See `references/examples/agents.md` for multi-turn conversations, action/resource injection, and model selection.\n\n## Inspect records\n\nRecords are individual items processed by a workflow. Use these commands to list, count, download, or cancel records within a workflow.\n\n`record download-outputs` is the **record**-grained sibling of `run download-outputs`: one row per record rather than per run. It pages with `--limit` / `--offset` (CLI ≥ 1.0.90), which is how you export a set too large for one file — walk it in fixed slices rather than asking for everything and timing out.\n\n```bash\n# List records for a workflow\ncargo-ai orchestration record list --workflow-uuid <uuid> --limit 50\n\n# Filter by batch or status\ncargo-ai orchestration record list --workflow-uuid <uuid> --batch-uuid <uuid> --statuses error\n\n# Count records\ncargo-ai orchestration record count --workflow-uuid <uuid>\n\n# Download records as a file\ncargo-ai orchestration record download --workflow-uuid <uuid>\n\n# Download one output node's data, per record, paging through a large set\ncargo-ai orchestration record download-outputs \\\n  --workflow-uuid <uuid> \\\n  --output-node-slug <slug> \\\n  --limit 1000 --offset 2000\n\n# Get per-node execution metrics\ncargo-ai orchestration record get-metrics --workflow-uuid <uuid>\n\n# Cancel records\ncargo-ai orchestration record cancel --workflow-uuid <uuid> --ids record-id-1,record-id-2\n```\n\n## Query orchestration history (orchestration query)\n\nRun SQL against orchestration runtime tables — `spans`, `runs`, `batches`, `records` — with `orchestration query execute`. Use this for ad-hoc analytics on workflow execution (error rates, throughput, slowest nodes) without the workflow-scoped filters of `run get-metrics` / `run count`.\n\n```bash\ncargo-ai orchestration query execute \"SELECT count() FROM runs WHERE status = 'error'\"\ncargo-ai orchestration query execute \"SELECT status, count() FROM batches GROUP BY status\"\ncargo-ai orchestration query execute \"SELECT * FROM spans ORDER BY execution_started_at DESC LIMIT 10\"\n```\n\nTables are referenced without a schema prefix — just `spans`, `runs`, `batches`, or `records`. Workspace scoping is applied automatically. The query is read-only; DDL, table functions, dictionary accessors, and introspection are denied. See `references/examples/queries.md` for the schemas, example queries, and limits.\n\n## Fetch segment data\n\nRetrieve live records from a segment. **IMPORTANT:** requires `--model-uuid` (not `--segment-uuid`). Get the `modelUuid` from `segment list`. Filter JSON uses `conjonction` (not `conjunction`) — this is intentional.\n\n```bash\ncargo-ai segmentation segment fetch \\\n  --model-uuid <uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}' \\\n  --fetching-limit 100 --fetching-offset 0\n```\n\nSupports `--sort`, `--enrich`, and `--sync`. See `references/filter-syntax.md` for the full filter syntax and `references/examples/segments.md` for filtering, pagination, sorting, enrollment filters, and enrichment.\n\n**Managing segments:**\n\n```bash\n# Update a segment's name or filter\ncargo-ai segmentation segment update --uuid <segment-uuid> --name \"Updated Name\"\ncargo-ai segmentation segment update --uuid <segment-uuid> --filter '{\"conjonction\":\"and\",\"groups\":[...]}'\n\n# Remove a segment (fails if linked to a workflow)\ncargo-ai segmentation segment remove <segment-uuid>\n```\n\n## Use a workflow template\n\nTemplates are pre-built node graphs for common automation patterns (enrichment pipelines, CRM syncs, lead scoring). Browse with `template list`, inspect with `template get <slug>`, fill in placeholders, validate, and run.\n\n```bash\ncargo-ai orchestration template list              # list available templates\ncargo-ai orchestration template get <slug>        # get template nodes + config\n```\n\nSee `references/examples/templates.md` for the full guide including placeholder conventions and end-to-end examples.\n\n## Validate and test nodes\n\nAlways validate custom node graphs before running them.\n\n```bash\ncargo-ai orchestration node validate --nodes '[...]'\n# → { \"outcome\": \"valid\" } or { \"outcome\": \"notValid\", \"invalidNodes\": [...] }\n```\n\nThen **show it before deploying it** — `validate` proves the graph is well-formed,\nnot that it does what the user asked for:\n\n```bash\ncargo-ai orchestration node diagram --nodes '[...]' --format ascii --raw   # free, runs nothing\n```\n\nSame command draws a deployed workflow (`--workflow-uuid`), a draft (`--draft`), a\nrelease (`--release-uuid`), or the graph a run executed (`--run-uuid`). See\n`references/node-diagram.md`.\n\nFor debugging, use `node compute` (dry-run expressions) or `node execute` (live test of one node **of an existing workflow** — needs `--workflow-uuid` + `--release-uuid` + `--computed-config`, and costs credits; for anything that isn't node-level debugging, use `action execute` instead). For runs that complete with `status: success` but produce wrong output (wrong branch taken, empty downstream values), use `run.executions[].title` from `run get` only as a quick summary — it may be truncated — and read `runContext.<nodeSlug>` (returned at the top level of the same `run get <run-uuid>` response) to verify field-level data. See `references/troubleshooting.md` → \"Debugging a workflow run\" and `references/nodes.md` for the full node creation guide, validation error codes, and examples.\n\n## Help\n\nEvery command supports `--help`:\n\n```bash\ncargo-ai orchestration run create --help\ncargo-ai orchestration template list --help\ncargo-ai orchestration node validate --help\ncargo-ai ai message create --help\ncargo-ai orchestration query execute --help\n```\n\nFile v1.13.0:_meta.json\n\n{\n  \"ownerId\": \"kn7by8t6yt9yghbxtxz6hv0bts87k6bq\",\n  \"slug\": \"cargo-orchestration\",\n  \"version\": \"1.13.0\",\n  \"publishedAt\": 1790278699916\n}\n\nFile v1.13.0:references/examples/actions.md\n\n# Action examples\n\n## What is an action?\n\nAn **action** is a single operation you can execute without building a workflow. Use `action execute` for one record, or `action execute-batch` for multiple records.\n\nActions come in four kinds:\n\n| Kind        | What it does                         | Required fields                                |\n| ----------- | ------------------------------------ | ---------------------------------------------- |\n| `tool`      | Run an orchestration tool            | `toolUuid` or `templateSlug` or `releaseUuid`  |\n| `connector` | Call a third-party service           | `integrationSlug` + `actionSlug`               |\n| `agent`     | Invoke an AI agent                   | `agentUuid` or `templateSlug` or `releaseUuid` |\n| `native`    | Run a built-in platform action       | `actionSlug`                                   |\n\n`config` is where a **node** keeps its configuration; a top-level action has none — its inputs go in `--data` (single) or `--records` (batch). Omit the key on `execute` / `execute-batch`: that is the shape `action list` returns, and `\"config\": {}` is merely tolerated there.\n\n`get-output-schema` takes the same pair — the action, plus `--data` when the output depends on the inputs (a HubSpot object type, a target sheet). Nodes, alert `--actions`, play `healthAlertActions`, and agent / MCP-server `--actions` are where `config` still belongs: it is a node's configuration, never an action's input.\n\n> **When to use actions vs workflows:** Actions are for running a **single operation** without building a workflow graph. If you need to **chain multiple operations** together (enrichment → scoring → CRM push), use `run create --nodes` or `batch create --nodes` instead. See `tools.md` for workflow examples.\n\n---\n\n## Find an action — `action list`\n\nFree: no run, no credits. Searches the integration catalog, Cargo native actions, this workspace's tools, and its agents in one call.\n\n```bash\ncargo-ai orchestration action list enrich company\ncargo-ai orchestration action list --kind tool\ncargo-ai orchestration action list send --kind connector --integration-slug slack\ncargo-ai orchestration action list verify email --limit 5\n```\n\n| Flag | Meaning |\n| --- | --- |\n| `[query...]` | Space-separated keywords. **All** terms must match (AND), against action slug, name, description, and integration. Omit to browse. |\n| `--kind` | One of `connector`, `native`, `tool`, `agent`. `tool` and `agent` need a signed-in workspace. |\n| `--integration-slug` | Restrict connector results to one integration. |\n| `--limit` | Default 20, max 50. |\n\nResponse:\n\n```json\n{\n  \"query\": \"enrich company\",\n  \"totalMatches\": 37,\n  \"results\": [\n    {\n      \"name\": \"Enrich company\",\n      \"description\": \"Return firmographics for a domain…\",\n      \"score\": 12,\n      \"action\": {\n        \"kind\": \"connector\",\n        \"integrationSlug\": \"aiArk\",\n        \"actionSlug\": \"enrichCompany\",\n        \"connectorUuid\": \"<uuid>\"\n      },\n      \"connectors\": [{ \"uuid\": \"<uuid>\", \"slug\": \"aiArk\", \"name\": \"AI Ark\" }],\n      \"credits\": [{ \"...\": \"cost table for this action\" }],\n      \"autocompletes\": [{ \"slug\": \"<slug>\", \"params\": { \"...\": \"...\" } }]\n    }\n  ]\n}\n```\n\nNotes worth knowing:\n\n- **`results[].action` is the payload** — pass it verbatim to `execute`, `execute-batch`, or `get-output-schema`. `connectorUuid` is resolved to the integration's default connector (or the first one) and sits **at the top level of the action, never inside `config`**.\n- **`credits`** is the action's cost table when it bills — the cheapest pre-flight cost check there is. Cross-check a GTM provider's playbook (`../../../cargo-gtm/provider-playbooks/<slug>.md`) before fanning out.\n- **`autocompletes`** flags config fields that need a picked id (HubSpot object type, Slack channel, Metabase question). Resolve those to concrete values before running — over MCP that is the `autocomplete_action` tool; over the CLI, use the integration's own list actions.\n- Ranking: action slug/name > integration > description. `score` is comparable within one response only.\n- Structural native nodes (`start`, `end`, `branch`, `delay`, `filter`, `group`, `split`, `switch`, `note`) are excluded — they belong in a node graph, not in `action execute`. See `nodes.md`. **Excluded is not free:** they carry no provider price, but each one still bills the 0.01-credit execution charge every time it runs, like any other node ([`../troubleshooting.md`](../troubleshooting.md)).\n- `unknown command` means the CLI predates `action list` — refresh it (`npm install -g @cargo-ai/cli@…`).\n\n---\n\n## Execute one action on one record\n\n```bash\n# Tool action\ncargo-ai orchestration action execute \\\n  --action '{\"kind\":\"tool\",\"toolUuid\":\"<tool-uuid>\"}' \\\n  --data '{\"domain\":\"acme.com\"}'\n\n# Connector action\ncargo-ai orchestration action execute \\\n  --action '{\"kind\":\"connector\",\"integrationSlug\":\"clearbit\",\"actionSlug\":\"enrichCompany\"}' \\\n  --data '{\"domain\":\"acme.com\"}'\n\n# Agent action\ncargo-ai orchestration action execute \\\n  --action '{\"kind\":\"agent\",\"agentUuid\":\"<agent-uuid>\"}' \\\n  --data '{\"company\":\"Acme Corp\"}'\n```\n\nReturns a `run` object. Poll with `run get <uuid>` until terminal, or pass `--wait-until-finished`:\n\n```bash\ncargo-ai orchestration action execute \\\n  --action '{\"kind\":\"connector\",\"integrationSlug\":\"clearbit\",\"actionSlug\":\"enrichCompany\"}' \\\n  --data '{\"domain\":\"acme.com\"}' \\\n  --wait-until-finished\n```\n\nCustom polling interval (default 5000ms):\n\n```bash\ncargo-ai orchestration action execute \\\n  --action '{\"kind\":\"tool\",\"toolUuid\":\"<tool-uuid>\"}' \\\n  --data '{\"domain\":\"acme.com\"}' \\\n  --wait-until-finished --polling-interval 2000\n```\n\n### Response\n\n```json\n{\n  \"run\": {\n    \"uuid\": \"run-uuid\",\n    \"status\": \"pending\",\n    \"createdAt\": \"2025-01-15T10:00:00Z\"\n  }\n}\n```\n\nWith `--wait-until-finished`, the response contains the terminal run state:\n\n```json\n{\n  \"run\": {\n    \"uuid\": \"run-uuid\",\n    \"status\": \"success\",\n    \"createdAt\": \"2025-01-15T10:00:00Z\",\n    \"finishedAt\": \"2025-01-15T10:00:05Z\"\n  }\n}\n```\n\n**Status values:** `pending`, `running`, `success`, `error`, `cancelled`.\n\n---\n\n## Execute one action on many records\n\n```bash\ncargo-ai orchestration action execute-batch \\\n  --action '{\"kind\":\"tool\",\"toolUuid\":\"<tool-uuid>\"}' \\\n  --records '[{\"domain\":\"acme.com\"},{\"domain\":\"globex.com\"},{\"domain\":\"initech.com\"}]'\n```\n\nReturns a `batch` object. Poll with `batch get <uuid>` until terminal, or pass `--wait-until-finished`:\n\n```bash\ncargo-ai orchestration action execute-batch \\\n  --action '{\"kind\":\"connector\",\"integrationSlug\":\"clearbit\",\"actionSlug\":\"enrichCompany\"}' \\\n  --records '[{\"domain\":\"acme.com\"},{\"domain\":\"globex.com\"}]' \\\n  --wait-until-finished\n```\n\n### Webhook notification\n\nGet notified when the batch completes instead of polling:\n\n```bash\ncargo-ai orchestration action execute-batch \\\n  --action '{\"kind\":\"tool\",\"toolUuid\":\"<tool-uuid>\"}' \\\n  --records '[{\"domain\":\"acme.com\"},{\"domain\":\"globex.com\"}]' \\\n  --webhook-url \"https://hooks.example.com/done\" \\\n  --webhook-secret \"my-secret\"\n```\n\n### Response\n\n```json\n{\n  \"batch\": {\n    \"uuid\": \"batch-uuid\",\n    \"status\": \"pending\",\n    \"createdAt\": \"2025-01-15T10:00:00Z\"\n  }\n}\n```\n\nWith `--wait-until-finished`:\n\n```json\n{\n  \"batch\": {\n    \"uuid\": \"batch-uuid\",\n    \"status\": \"success\",\n    \"runsCount\": 3,\n    \"executedRunsCount\": 3,\n    \"failedRunsCount\": 0,\n    \"creditsUsedCount\": 3,\n    \"createdAt\": \"2025-01-15T10:00:00Z\",\n    \"finishedAt\": \"2025-01-15T10:00:15Z\"\n  }\n}\n```\n\n---\n\n## Retry configuration\n\nAdd a `retry` object to the action for automatic retries on transient failures. `initialInterval` is in seconds, not milliseconds:\n\n```bash\ncargo-ai orchestration action execute \\\n  --action '{\n    \"kind\":\"connector\",\n    \"integrationSlug\":\"clearbit\",\n    \"actionSlug\":\"enrichCompany\",\n    \"retry\":{\"maximumAttempts\":3,\"initialInterval\":1,\"backoffCoefficient\":2}\n  }' \\\n  --data '{\"domain\":\"acme.com\"}' \\\n  --wait-until-finished\n```\n\n---\n\n## Discovering action parameters\n\nTo find the right values for each action kind:\n\n```bash\n# Tool actions — find toolUuid\ncargo-ai orchestration tool list\n# → Extract .tools[].uuid\n\n# Connector actions — find integrationSlug + actionSlug\ncargo-ai connection integration list\ncargo-ai connection integration get <slug>\n# → Extract actions from the integration\n\n# Agent actions — find agentUuid\ncargo-ai ai agent list\n# → Extract .agents[].uuid\n\n# Connector actions — find connectorUuid (optional, for authenticated connectors)\ncargo-ai connection connector list\n# → Extract .connectors[].uuid\n```\n\n---\n\n## Resolve an action's output schema\n\n**Never guess what an action outputs.** There are two free ways to discover what an action **produces** — no run, no credits.\n\n### 1. Connector actions: read `output.schema` from the integration catalog\n\n`integration get <slug>` (and `integration list`) return each action's output schema inline, next to its input schema:\n\n```bash\ncargo-ai connection integration get waterfall\n# → .integration.actions.verifyEmail.config.schema   — input (what you pass)\n# → .integration.actions.verifyEmail.output.schema   — output (what it emits)\n```\n\n**Not every action declares an output schema** — e.g. `waterfall.verifyEmail`, `clearbit.enrichCompany`, and most `hubspot` record actions do, while `waterfall.detectJobChange`, `waterfall.searchProspects`, and `salesNavigator.searchAccounts` don't (no `output` key). When it's absent, the only way to see the real shape is `runContext` from an actual run.\n\n### 2. Any action kind: `action get-output-schema`\n\nFor non-connector kinds (`tool`, `agent`, `native`) — or when you already have the action object in hand — resolve the same schema without touching the catalog:\n\n```bash\ncargo-ai orchestration action get-output-schema \\\n  --action '{\"kind\":\"connector\",\"integrationSlug\":\"clearbit\",\"actionSlug\":\"enrichCompany\"}'\n```\n\nIt accepts the same `--action` object as `action execute` — the one `action list` returns — so it works for every kind:\n\n```bash\n# Tool action — resolves the tool workflow's output-node schema\ncargo-ai orchestration action get-output-schema \\\n  --action '{\"kind\":\"tool\",\"toolUuid\":\"<tool-uuid>\"}'\n\n# Agent action — resolves the deployed release's output schema\ncargo-ai orchestration action get-output-schema \\\n  --action '{\"kind\":\"agent\",\"agentUuid\":\"<agent-uuid>\"}'\n\n# Native action\ncargo-ai orchestration action get-output-schema \\\n  --action '{\"kind\":\"native\",\"actionSlug\":\"<slug>\"}'\n```\n\n**When the output depends on the inputs, pass `--data`** (**CLI ≥ 1.0.67**). Some connector actions\nshape their output from what they are given — a HubSpot object type decides which\nfields come back, a Google Sheet decides the columns. `--data` takes the same\nobject `action execute` does; omit it and you get the action's generic schema:\n\n```bash\ncargo-ai orchestration action get-output-schema \\\n  --action '{\"kind\":\"connector\",\"integrationSlug\":\"hubspot\",\"actionSlug\":\"findRecords\"}' \\\n  --data '{\"objectType\":\"contacts\"}'\n```\n\n### Response\n\nThe JSON Schema sits under a top-level **`schema`** key (not returned bare), and for connector actions it is exactly the catalog's `output.schema` — e.g. `waterfall` / `verifyEmail` resolves to:\n\n```json\n{\n  \"schema\": {\n    \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n    \"type\": \"object\",\n    \"properties\": {\n      \"email\": { \"type\": \"string\" },\n      \"domain\": { \"type\": \"string\" },\n      \"email_status\": { \"type\": \"string\" },\n      \"smtp_provider\": { \"type\": \"string\" },\n      \"mx_records\": { \"type\": \"array\", \"items\": { \"type\": \"string\" } }\n    }\n  }\n}\n```\n\nAn `agent` action without a structured `output.jsonSchema` resolves to `{\"schema\":{\"type\":\"object\",\"properties\":{\"answer\":{\"type\":\"string\"}}}}` — the free-text answer envelope. This is the authoritative confirmation that downstream references must go through `.answer` (`{{nodes.<slug>.answer}}`, or `{{nodes.<slug>.answer.<field>}}` for structured agents).\n\nTwo distinct failure modes, both non-zero exit with `status: 404`:\n\n- `\"Action not found.\"` — the `actionSlug` / `toolUuid` / `agentUuid` doesn't exist. Slugs are exact and case-sensitive (`enrichCompany`, not `company_enrich`); list them via `integration get <slug>` → `.integration.actions` keys.\n- `\"Action has no output schema.\"` — the action exists but declares no output schema (its catalog entry has no `output` key). Fall back to running it once and reading `runContext.<nodeSlug>` from `run get`.\n\n### Why it's useful\n\n- **Wire a node graph correctly the first time.** Know which fields exist before referencing them downstream as `{{nodes.<slug>.<field>}}` — avoids the silent-`undefined` footgun (see `../node-selection.md`).\n- **Know an agent's output envelope** (`.answer` vs structured fields) before writing branch/filter expressions against it.\n- **Map onto storage columns** ahead of a batch, without a throwaway run to inspect the output.\n\n---\n\n## End-to-end: enrich a company with a connector action\n\n```bash\n# 1. Find the integration and action\ncargo-ai connection integration get clearbit\n# → Find actionSlug: \"enrichCompany\" (slugs are exact — keys of .integration.actions)\n\n# 2. Execute\ncargo-ai orchestration action execute \\\n  --action '{\"kind\":\"connector\",\"integrationSlug\":\"clearbit\",\"actionSlug\":\"enrichCompany\"}' \\\n  --data '{\"domain\":\"acme.com\"}' \\\n  --wait-until-finished\n# → Done. Check run.status for success/error.\n```\n\n## End-to-end: run a tool action on multiple leads\n\n```bash\n# 1. Find the tool\ncargo-ai orchestration tool list\n# → Find \"Lead Enrichment\", extract uuid\n\n# 2. Execute batch\ncargo-ai orchestration action execute-batch \\\n  --action '{\"kind\":\"tool\",\"toolUuid\":\"<tool-uuid>\"}' \\\n  --records '[\n    {\"email\":\"alice@acme.com\",\"company\":\"Acme\"},\n    {\"email\":\"bob@globex.com\",\"company\":\"Globex\"},\n    {\"email\":\"carol@initech.com\",\"company\":\"Initech\"}\n  ]' \\\n  --wait-until-finished\n# → Check batch.status, batch.failedRunsCount\n```\n\nFile v1.13.0:references/examples/agents.md\n\n# AI agent examples\n\n## Basic chat: ask a question and get a response\n\n```bash\n# 1. Find the right agent by name\ncargo-ai ai agent list\n# → Match by name, extract agent uuid\n\n# 2. Create a chat session\ncargo-ai ai chat create \\\n  --trigger '{\"type\":\"draft\"}' \\\n  --agent-uuid <agent-uuid> \\\n  --name \"Quick question\"\n# → Extract chat.uuid\n\n# 3. Send a message\ncargo-ai ai message create \\\n  --chat-uuid <chat-uuid> \\\n  --parts '[{\"type\":\"text\",\"text\":\"What is Acme Corp'\\''s employee count?\"}]'\n```\n\nMessage create response:\n\n```json\n{\n  \"userMessage\": { \"uuid\": \"user-msg-uuid\", \"status\": \"success\" },\n  \"assistantMessage\": {\n    \"uuid\": \"assistant-msg-uuid\",\n    \"status\": \"pending\",\n    \"parts\": []\n  }\n}\n```\n\n```bash\n# 4. Poll for the response (repeat every 2s)\ncargo-ai ai message get <assistant-msg-uuid>\n```\n\nPoll until `status` is `success` or `error`:\n\n```json\n{\n  \"message\": {\n    \"uuid\": \"assistant-msg-uuid\",\n    \"status\": \"success\",\n    \"parts\": [\n      { \"type\": \"text\", \"text\": \"Acme Corp has approximately 500 employees...\" }\n    ],\n    \"errorMessage\": null\n  }\n}\n```\n\nStatus values: `pending` → `generating` → `success` or `error`. On `error`, read `.message.errorMessage`.\n\n## Multi-turn conversation\n\n```bash\n# 1. Create a chat\ncargo-ai ai chat create \\\n  --trigger '{\"type\":\"draft\"}' \\\n  --agent-uuid <agent-uuid> \\\n  --name \"Lead research\"\n# → Extract chat.uuid\n\n# 2. First message\ncargo-ai ai message create \\\n  --chat-uuid <chat-uuid> \\\n  --parts '[{\"type\":\"text\",\"text\":\"Find the VP of Sales at Acme Corp\"}]'\n# → Poll assistantMessage.uuid until success\n\n# 3. Follow-up in the same chat (agent remembers context)\ncargo-ai ai message create \\\n  --chat-uuid <chat-uuid> \\\n  --parts '[{\"type\":\"text\",\"text\":\"Now find their email address\"}]'\n# → Poll the new assistantMessage.uuid\n\n# 4. Another follow-up\ncargo-ai ai message create \\\n  --chat-uuid <chat-uuid> \\\n  --parts '[{\"type\":\"text\",\"text\":\"Draft a cold outreach email to them\"}]'\n# → Poll again\n```\n\n## Reuse an existing chat session\n\n```bash\n# 1. List existing chats for an agent\ncargo-ai ai chat list --agent-uuid <agent-uuid> --limit 10\n# → Find a chat by name or pick the most recent one\n\n# 2. Send a message in the existing chat\ncargo-ai ai message create \\\n  --chat-uuid <existing-chat-uuid> \\\n  --parts '[{\"type\":\"text\",\"text\":\"Any updates on the Acme deal?\"}]'\n# → Poll for response\n```\n\n## Send a message with actions\n\nGive the agent access to specific actions for enrichment, CRM actions, etc.\n\n```bash\ncargo-ai ai message create \\\n  --chat-uuid <chat-uuid> \\\n  --parts '[{\"type\":\"text\",\"text\":\"Enrich this lead and add to Salesforce\"}]' \\\n  --actions '[{\"slug\":\"clearbit\",\"kind\":\"tool\",\"toolUuid\": \"<tool-uuid>\",\"config\":{}},{\"slug\":\"salesforce\",\"kind\":\"tool\",\"config\":{}}]'\n# → The agent can use these actions during its response\n```\n\n## Send a message with model resources\n\nGive the agent access to a data model to query.\n\n```bash\n# 1. Find the model UUID\ncargo-ai storage model list\n\n# 2. Send message with the model as a resource\ncargo-ai ai message create \\\n  --chat-uuid <chat-uuid> \\\n  --parts '[{\"type\":\"text\",\"text\":\"Find all companies in France with more than 100 employees\"}]' \\\n  --resources '[{\"slug\":\"companies\",\"kind\":\"model\",\"integrationSlug\":\"salesforce\",\"modelUuid\":\"<model-uuid>\"}]'\n```\n\n## Use a specific language model and temperature\n\n```bash\ncargo-ai ai message create \\\n  --chat-uuid <chat-uuid> \\\n  --parts '[{\"type\":\"text\",\"text\":\"Write a creative subject line for this campaign\"}]' \\\n  --language-model-slug gpt-4o \\\n  --temperature 0.9\n```\n\nLower temperature (0.0–0.3) for factual/structured tasks, higher (0.7–1.0) for creative tasks.\n\n## Send a message with actions, resources, and custom model\n\nFull example combining all options.\n\n```bash\ncargo-ai ai message create \\\n  --chat-uuid <chat-uuid> \\\n  --parts '[{\"type\":\"text\",\"text\":\"Research Acme Corp, enrich their data, and update our CRM\"}]' \\\n  --actions '[{\"slug\":\"clearbit\",\"kind\":\"tool\",\"config\":{}},{\"slug\":\"salesforce\",\"kind\":\"tool\",\"config\":{}}]' \\\n  --resources '[{\"slug\":\"companies\",\"kind\":\"model\",\"integrationSlug\":\"salesforce\",\"modelUuid\":\"<model-uuid>\"}]' \\\n  --language-model-slug gpt-4o \\\n  --temperature 0.3 \\\n  --max-steps 10\n```\n\n## List messages in a chat\n\n```bash\ncargo-ai ai message list --chat-uuid <chat-uuid> --limit 20\n# → Returns all messages in order (both user and assistant)\n```\n\n## Check all chats for an agent\n\n```bash\n# All chats\ncargo-ai ai chat list --agent-uuid <agent-uuid>\n\n# With pagination\ncargo-ai ai chat list --agent-uuid <agent-uuid> --limit 5 --offset 0\n```\n\n## End-to-end: use an AI template to create an agent and run a research task\n\nThis example uses an AI template to bootstrap a lead researcher agent, then sends it a research task.\n\n```bash\n# Step 1 — Browse AI templates\ncargo-ai ai template list\n# → Find slug: \"lead-researcher\"\n#   languageModelSlug: \"gpt-4o\", temperature: 0.3\n\n# Step 2 — Create an agent\ncargo-ai ai agent create \\\n  --name \"Lead Researcher\" \\\n  --icon-color purple --icon-face 🔍\n# → Extract agent.uuid (e.g. \"agent-abc\")\n\n# Step 3 — Configure the draft release with template settings\ncargo-ai ai release update-draft --agent-uuid agent-abc \\\n  --system-prompt \"You are a research assistant. Given a company domain and a contact name, find their role, LinkedIn profile URL, and email address. Return structured JSON with keys: role, linkedin_url, email.\" \\\n  --language-model-slug gpt-4o \\\n  --temperature 0.3\n\n# Step 4 — Attach a knowledge file (optional — ICP criteria, product info, etc.)\ncargo-ai content file upload --file ./icp-criteria.pdf\n# → Extract file.uuid\n\n# Step 5 — Give the agent access to actions (optional — connectors as actions)\ncargo-ai orchestration tool list\n# → Find a \"Find Email\" tool, extract uuid\n\n# Step 6 — Create a chat session\ncargo-ai ai chat create \\\n  --trigger '{\"type\":\"draft\"}' \\\n  --agent-uuid agent-abc \\\n  --name \"Lead research — Acme Corp\"\n# → Extract chat.uuid\n\n# Step 7 — Send the research request\ncargo-ai ai message create \\\n  --chat-uuid <chat-uuid> \\\n  --parts '[{\"type\":\"text\",\"text\":\"Research the VP of Sales at acme.com. Find their name, LinkedIn URL, and email address.\"}]' \\\n  --actions '[{\"slug\":\"find_email\",\"kind\":\"tool\",\"toolUuid\":\"<email-finder-tool-uuid>\",\"config\":{}}]' \\\n  --max-steps 10\n# → Extract assistantMessage.uuid\n\n# Step 8 — Poll for the response (every 2s)\ncargo-ai ai message get <assistant-msg-uuid>\n# → Done when message.status is \"success\" (read .parts) or \"error\" (read .errorMessage)\n\n# Step 9 — Follow up in the same chat\ncargo-ai ai message create \\\n  --chat-uuid <chat-uuid> \\\n  --parts '[{\"type\":\"text\",\"text\":\"Now draft a personalised cold outreach email to this person.\"}]'\n# → Poll again\n```\n\nFile v1.13.0:references/examples/plays.md\n\n# Play examples\n\n## What is a play?\n\nA **play** is a segment-driven automation. It is linked to a specific model and segment, and runs its workflow automatically when records in that segment change (are added, updated, or removed). Plays are the reactive side of Cargo — \"when this data changes, do that.\"\n\nKey properties of a play:\n\n- **`name`** — human-readable name (workflows themselves don't have names)\n- **`workflowUuid`** — the underlying workflow that executes\n- **`modelUuid`** — the data model the play operates on\n- **`segmentUuid`** — the segment that triggers runs\n- **`changeKinds`** — which segment changes trigger a run (`added`, `updated`, `removed`)\n- **`schedule`** — optional cron schedule for periodic re-evaluation\n- **`isEnabled`** — whether the play is active\n\n## List all plays\n\n```bash\ncargo-ai orchestration play list\n```\n\nResponse:\n\n```json\n{\n  \"plays\": [\n    {\n      \"uuid\": \"play-uuid\",\n      \"name\": \"Enrich new companies\",\n      \"workflowUuid\": \"workflow-uuid\",\n      \"modelUuid\": \"model-uuid\",\n      \"segmentUuid\": \"segment-uuid\",\n      \"changeKinds\": [\"added\", \"updated\"],\n      \"isEnabled\": true,\n      \"schedule\": null,\n      \"description\": \"Enriches companies when they enter the segment\"\n    }\n  ]\n}\n```\n\n## Find a play's workflow UUID\n\nPlays have names — workflows don't. Use the play to find the right workflow and model.\n\n```bash\n# 1. Find the play\ncargo-ai orchestration play list\n# → Extract play.workflowUuid and play.modelUuid\n\n# 2. Create a batch over the play's model (empty filter = all rows)\ncargo-ai orchestration batch create \\\n  --workflow-uuid <play.workflowUuid> \\\n  --data '{\"kind\":\"filter\",\"modelUuid\":\"<play.modelUuid>\",\"filter\":{\"conjonction\":\"and\",\"groups\":[]}}'\n\n# 3. Poll until done\ncargo-ai orchestration batch get <batch-uuid>\n\n# Or block until finished — returns the final batch result without a separate poll step\ncargo-ai orchestration batch create \\\n  --workflow-uuid <play.workflowUuid> \\\n  --data '{\"kind\":\"filter\",\"modelUuid\":\"<play.modelUuid>\",\"filter\":{\"conjonction\":\"and\",\"groups\":[]}}' \\\n  --wait-until-finished\n```\n\nAn empty filter (`{\"conjonction\":\"and\",\"groups\":[]}`) enrols every row in the model;\nadd conditions to narrow it — see `references/filter-syntax.md` for the full shape.\n\n> **Never pass `play.segmentUuid` to `{\"kind\":\"segment\"}`.** That UUID points at\n> the play's internally generated segment, whose record count is never\n> populated — the batch is rejected (`segmentLinkedToPlay`, or `noRecords` on\n> older backends) no matter how many rows the model holds. `{\"kind\":\"segment\"}`\n> is only for standalone segments from `segmentation segment list`.\n\n## Update a play's workflow\n\nTo change what a play does, update its draft release and deploy it. The draft release holds the unpublished node graph for the workflow.\n\n> **Looking for inspiration?** Before designing a node graph from scratch, check `cargo-ai orchestration template list` for pre-built patterns (lead scoring, enrichment pipelines, CRM syncs). Use `cargo-ai orchestration template get <slug>` to copy a ready-made node graph and adapt it instead of starting from zero. Templates tagged `\"kind\":\"play\"` are designed for segment-driven automations.\n\n```bash\n# Step 1 — Find the play and its workflowUuid\ncargo-ai orchestration play list\n# → Find \"Enrich new companies\", extract play.workflowUuid\n\n# Step 2 — Get the current draft release (contains the current node graph)\ncargo-ai orchestration release get-draft --workflow-uuid <play.workflowUuid>\n# → Copy the \"nodes\" array and make your changes\n\n# Step 3 — Update the draft release with your new nodes\ncargo-ai orchestration release update-draft \\\n  --workflow-uuid <play.workflowUuid> \\\n  --nodes '[...your updated node graph...]'\n\n# Step 4 — Validate the updated nodes before deploying\ncargo-ai orchestration node validate --nodes '[...your updated node graph...]'\n# → { \"outcome\": \"valid\" }\n\n# Step 5 — Deploy the draft release\ncargo-ai orchestration release deploy-draft \\\n  --workflow-uuid <play.workflowUuid> \\\n  --nodes '[...your updated node graph...]' \\\n  --form-fields 'null' \\\n  --description \"Your release description\"\n```\n\n> **Do not skip validation.** Deploying an invalid node graph will cause runs to fail. Always run `node validate` before `release deploy-draft`.\n\n> **Do not pass `--version` to `release deploy-draft`.** The deploy-specific `--version` flag is shadowed by the global `--version` flag — passing it causes the command to print the CLI version (e.g. `1.0.11`) and exit 0 **without deploying**. Omit it and let the server auto-assign (first deploy → `1.0.0`, then `1.0.1`, etc.). Always confirm the deploy worked with `release get-deployed --workflow-uuid <uuid>` — the response should show `status: \"deployed\"`, not `draft`.\n\n---\n\n## Run a play's workflow on specific records\n\n> **`run create` is not compatible with play workflows** — it will return\n> `playNotCompatible`. Always use `batch create` for plays.\n>\n> Allowed batch data kinds for plays: `segment`, `change`, `filter`, `recordIds`.\n\n### By filter (query the model)\n\n```bash\ncargo-ai orchestration batch create \\\n  --workflow-uuid <play.workflowUuid> \\\n  --data '{\"kind\":\"filter\",\"modelUuid\":\"<play.modelUuid>\",\"filter\":{\"field\":\"domain\",\"operator\":\"is\",\"value\":\"acme.com\"},\"limit\":10}'\n```\n\n### By record IDs\n\n```bash\ncargo-ai orchestration batch create \\\n  --workflow-uuid <play.workflowUuid> \\\n  --data '{\"kind\":\"recordIds\",\"modelUuid\":\"<play.modelUuid>\",\"ids\":[\"record-id-1\",\"record-id-2\"]}'\n```\n\n## Monitor a play's runs\n\n```bash\n# List recent runs\ncargo-ai orchestration run list \\\n  --workflow-uuid <play.workflowUuid> \\\n  --limit 20\n\n# Count errors\ncargo-ai orchestration run count \\\n  --workflow-uuid <play.workflowUuid> \\\n  --statuses error\n\n# List running batches\ncargo-ai orchestration batch list \\\n  --workflow-uuids <play.workflowUuid> \\\n  --statuses running\n```\n\n## Cancel runs and batches\n\n```bash\n# Cancel specific runs\ncargo-ai orchestration run cancel \\\n  --workflow-uuid <play.workflowUuid> \\\n  --uuids <run-uuid-1>,<run-uuid-2>\n\n# Cancel a batch\ncargo-ai orchestration batch cancel <batch-uuid>\n```\n\n## End-to-end: use a template to run a play\n\nThis example takes a \"lead-scoring\" play template, fills in its placeholders, validates the node graph, and runs it against the play's segment.\n\n```bash\n# Step 1 — List available play templates\ncargo-ai orchestration template list\n# → Find slug: \"lead-scoring\", kind: \"play\"\n\n# Step 2 — Get the template's node graph\ncargo-ai orchestration template get lead-scoring\n# → Copy the \"nodes\" array. It will contain __REPLACE_WITH_*__ placeholders.\n\n# Step 3 — Discover what you need to fill in\ncargo-ai connection connector list\n# → Find your connector UUIDs (e.g. a Clearbit connector)\ncargo-ai ai agent list\n# → Find agentUuid if the template uses an agent node\n\n# Step 4 — Validate the node graph after filling in placeholders\ncargo-ai orchestration node validate --nodes '[\n  {\n    \"uuid\": \"77777777-7777-4777-a777-777777777777\", \"slug\": \"start\", \"kind\": \"native\", \"actionSlug\": \"start\",\n    \"config\": {}, \"childrenUuids\": [\"88888888-8888-4888-a888-888888888888\"], \"fallbackOnFailure\": false,\n    \"position\": {\"x\": 0, \"y\": 0}\n  },\n  {\n    \"uuid\": \"88888888-8888-4888-a888-888888888888\", \"slug\": \"score\", \"kind\": \"native\", \"actionSlug\": \"agent\",\n    \"config\": {\n      \"prompt\": {\n        \"kind\": \"templateExpression\",\n        \"expression\": \"Score this lead from 1-10 based on ICP fit. Company: {{nodes.start.company}}, Domain: {{nodes.start.domain}}, Employee count: {{nodes.start.employee_count}}. Return score and reasoning.\",\n        \"instructTo\": \"none\",\n        \"fromRecipe\": false\n      },\n      \"advancedSettings\": {\n        \"connectorUuid\": \"<openai-connector-uuid>\",\n        \"languageModelSlug\": \"gpt-4.1-mini\",\n        \"temperature\": 0.1\n      }\n    },\n    \"childrenUuids\": [\"99999999-9999-4999-a999-999999999999\"], \"fallbackOnFailure\": false,\n    \"position\": {\"x\": 0, \"y\": 166}\n  },\n  {\n    \"uuid\": \"99999999-9999-4999-a999-999999999999\", \"slug\": \"end\", \"kind\": \"native\", \"actionSlug\": \"end\",\n    \"config\": {\n      \"variables\": [\n        {\"name\": \"score\", \"type\": \"number\", \"value\": {\"kind\": \"templateExpression\", \"expression\": \"{{nodes.score.score}}\", \"instructTo\": \"none\", \"fromRecipe\": false}},\n        {\"name\": \"reasoning\", \"type\": \"string\", \"value\": {\"kind\": \"templateExpression\", \"expression\": \"{{nodes.score.reasoning}}\", \"instructTo\": \"none\", \"fromRecipe\": false}}\n      ]\n    },\n    \"childrenUuids\": [], \"fallbackOnFailure\": false,\n    \"position\": {\"x\": 0, \"y\": 332}\n  }\n]'\n# → { \"outcome\": \"valid\" }\n\n# Step 5 — Find the play's workflowUuid and modelUuid\ncargo-ai orchestration play list\n# → Find \"Lead Scoring\", extract workflowUuid and modelUuid\n\n# Step 6 — Run the template nodes against the play's model (empty filter = all rows)\ncargo-ai orchestration batch create \\\n  --workflow-uuid <play.workflowUuid> \\\n  --data '{\"kind\":\"filter\",\"modelUuid\":\"<play.modelUuid>\",\"filter\":{\"conjonction\":\"and\",\"groups\":[]}}' \\\n  --nodes '[...validated nodes from step 4...]'\n# → Extract batch.uuid\n\n# Step 7 — Poll until finished (every 5s)\ncargo-ai orchestration batch get <batch-uuid>\n# → Done when .status is \"success\", \"error\", or \"cancelled\"\n\n# Alternative to steps 6+7 — block until finished in one command\ncargo-ai orchestration batch create \\\n  --workflow-uuid <play.workflowUuid> \\\n  --data '{\"kind\":\"filter\",\"modelUuid\":\"<play.modelUuid>\",\"filter\":{\"conjonction\":\"and\",\"groups\":[]}}' \\\n  --nodes '[...validated nodes from step 4...]' \\\n  --wait-until-finished\n```\n\nFile v1.13.0:references/examples/queries.md\n\n# Orchestration query examples\n\nRun SQL against orchestration runtime tables — `runs`, `batches`, `spans`, `records` — with `cargo-ai orchestration query execute`. Use this for ad-hoc analytics on workflow execution (error rates, throughput, slowest nodes, per-node failure breakdowns) without the workflow-scoped filters of `run get-metrics` / `run count`.\n\nThe backing store is ClickHouse; queries are read-only and exit non-zero with `{\"errorMessage\": \"...\"}` on error.\n\n> For SQL against workspace storage (Companies, Contacts, Deals…), use `cargo-ai storage query execute \"<sql>\"` — documented in the `cargo-storage` skill (`references/examples/queries.md`).\n\n## Basic query flow\n\n```bash\ncargo-ai orchestration query execute \\\n  \"SELECT count() FROM runs WHERE status = 'error'\"\n```\n\nSuccess response:\n\n```json\n{\n  \"rows\": [{ \"count()\": 42 }]\n}\n```\n\n## Tables\n\nTables are referenced **without** a schema prefix. The query engine scopes every read to your workspace automatically.\n\n| Table     | Use it for                                                                 |\n| --------- | -------------------------------------------------------------------------- |\n| `runs`    | Per-record workflow executions (status, timing, executions array, batch)   |\n| `batches` | Batch-level rows: counts (`runs_count`, `failed_runs_count`), credit usage |\n| `spans`   | Flattened per-node execution rows (one row per node execution)             |\n| `records` | Materialized view over `runs` keyed by record id                           |\n\nCommon columns: `workspace_uuid`, `workflow_uuid`, `batch_uuid`, `release_uuid`, `status`, `created_at`, `updated_at`, `finished_at`, `credits_used_count`. See the migration files in `apps/backend/src/domains/orchestration/migrations/` for the full schema.\n\n## Example queries\n\n```bash\n# Error rate across the whole workspace\ncargo-ai orchestration query execute \\\n  \"SELECT countIf(status='error') / count() AS error_rate FROM runs WHERE created_at > now() - INTERVAL 1 DAY\"\n\n# Errors per workflow over the last week\ncargo-ai orchestration query execute \\\n  \"SELECT workflow_uuid, count() AS errors FROM runs WHERE status='error' AND created_at > now() - INTERVAL 7 DAY GROUP BY workflow_uuid ORDER BY errors DESC\"\n\n# Batch status breakdown\ncargo-ai orchestration query execute \\\n  \"SELECT status, count() FROM batches GROUP BY status\"\n\n# Slowest node executions in the last hour\ncargo-ai orchestration query execute \\\n  \"SELECT node_slug, node_kind, dateDiff('second', execution_started_at, execution_finished_at) AS duration_s\n   FROM spans\n   WHERE execution_finished_at > now() - INTERVAL 1 HOUR\n   ORDER BY duration_s DESC\n   LIMIT 20\"\n\n# Per-node failure counts\ncargo-ai orchestration query execute \\\n  \"SELECT node_slug, count() AS failures\n   FROM spans\n   WHERE execution_status='error' AND execution_started_at > now() - INTERVAL 1 DAY\n   GROUP BY node_slug\n   ORDER BY failures DESC\"\n\n# Credit spend by workflow this month\ncargo-ai orchestration query execute \\\n  \"SELECT workflow_uuid, sum(credits_used_count) AS credits\n   FROM batches\n   WHERE created_at >= toStartOfMonth(now())\n   GROUP BY workflow_uuid\n   ORDER BY credits DESC\"\n```\n\n## Common table expressions\n\n```bash\ncargo-ai orchestration query execute \\\n  \"WITH recent AS (SELECT * FROM runs WHERE created_at > now() - INTERVAL 1 DAY)\n   SELECT status, count() FROM recent GROUP BY status\"\n```\n\n## Limits and restrictions\n\nOrchestration queries run as a read-only ClickHouse user with per-query caps:\n\n| Limit                | Value      |\n| -------------------- | ---------- |\n| `max_execution_time` | 30s        |\n| `max_result_rows`    | 10 000     |\n| `max_rows_to_read`   | 10 000 000 |\n| `max_columns_to_read`| 50         |\n| `max_subquery_depth` | 5          |\n\nDDL, introspection functions, table functions (`merge`, `cluster`, `remote`, `url`, `s3`, `file`, …), dictionary accessors, and the query cache are all denied. Wrap heavy aggregations in time filters (`created_at > now() - INTERVAL N DAY`) to stay under the row-scan cap.\n\n## Error handling\n\n```json\n{ \"errorMessage\": \"Code: 158. Memory limit exceeded ...\" }\n```\n\nCommon causes:\n- Scanned too many rows → narrow the time window with a `created_at`/`execution_started_at` predicate\n- Forbidden function (e.g. `system.tables`, `cluster()`, `url()`) → use only `SELECT` against the four tables above\n- Too many result rows → add a `LIMIT` or aggregate before returning\n\nFile v1.13.0:references/examples/segments.md\n\n# Segment data examples\n\n**Remember:** `segment fetch` and `segment download` require `--model-uuid`, not `--segment-uuid`. Get the `modelUuid` from `segment list`.\n\n**Remember:** filter JSON uses `conjonction` (not `conjunction`).\n\n## Fetch all records (no filter)\n\n```bash\n# 1. Find the model UUID\ncargo-ai segmentation segment list\n# → Extract modelUuid from the segment you want\n\n# 2. Fetch with empty filter\ncargo-ai segmentation segment fetch \\\n  --model-uuid <model-uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}' \\\n  --fetching-limit 100 --fetching-offset 0\n```\n\nResponse:\n\n```json\n{\n  \"records\": [\n    { \"_id\": \"rec-1\", \"name\": \"Acme Corp\", \"domain\": \"acme.com\", \"employee_count\": 500 },\n    { \"_id\": \"rec-2\", \"name\": \"Globex\", \"domain\": \"globex.com\", \"employee_count\": 1200 }\n  ],\n  \"count\": 2,\n  \"columns\": [\n    { \"slug\": \"_id\", \"type\": \"string\", \"label\": \"ID\", \"modelUuid\": \"model-uuid\" },\n    { \"slug\": \"name\", \"type\": \"string\", \"label\": \"Company Name\", \"modelUuid\": \"model-uuid\" }\n  ]\n}\n```\n\n## Fetch with pagination\n\n```bash\n# Page 1\ncargo-ai segmentation segment fetch \\\n  --model-uuid <model-uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}' \\\n  --fetching-limit 50 --fetching-offset 0\n\n# Page 2\ncargo-ai segmentation segment fetch \\\n  --model-uuid <model-uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}' \\\n  --fetching-limit 50 --fetching-offset 50\n\n# Page 3\ncargo-ai segmentation segment fetch \\\n  --model-uuid <model-uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}' \\\n  --fetching-limit 50 --fetching-offset 100\n```\n\n## Fetch with sorting\n\n```bash\n# Sort by creation date (newest first)\ncargo-ai segmentation segment fetch \\\n  --model-uuid <model-uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}' \\\n  --sort '[{\"columnSlug\":\"created_at\",\"kind\":\"desc\"}]' \\\n  --fetching-limit 100\n\n# Sort by employee count (highest first)\ncargo-ai segmentation segment fetch \\\n  --model-uuid <model-uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}' \\\n  --sort '[{\"columnSlug\":\"employee_count\",\"kind\":\"desc\"}]' \\\n  --fetching-limit 50\n```\n\n## Filter by string column\n\n```bash\n# Companies in the US\ncargo-ai segmentation segment fetch \\\n  --model-uuid <model-uuid> \\\n  --filter '{\n    \"conjonction\": \"and\",\n    \"groups\": [{\n      \"conjonction\": \"and\",\n      \"conditions\": [\n        {\"kind\": \"string\", \"columnSlug\": \"country\", \"operator\": \"is\", \"values\": [\"US\"]}\n      ]\n    }]\n  }' \\\n  --fetching-limit 100\n\n# Companies whose name contains \"tech\"\ncargo-ai segmentation segment fetch \\\n  --model-uuid <model-uuid> \\\n  --filter '{\n    \"conjonction\": \"and\",\n    \"groups\": [{\n      \"conjonction\": \"and\",\n      \"conditions\": [\n        {\"kind\": \"string\", \"columnSlug\": \"name\", \"operator\": \"contains\", \"values\": \"tech\"}\n      ]\n    }]\n  }' \\\n  --fetching-limit 100\n```\n\n## Filter by number column\n\n```bash\n# Companies with 100+ employees\ncargo-ai segmentation segment fetch \\\n  --model-uuid <model-uuid> \\\n  --filter '{\n    \"conjonction\": \"and\",\n    \"groups\": [{\n      \"conjonction\": \"and\",\n      \"conditions\": [\n        {\"kind\": \"number\", \"columnSlug\": \"employee_count\", \"operator\": \"greaterThan\", \"value\": 100}\n      ]\n    }]\n  }' \\\n  --fetching-limit 100\n\n# Companies with 50–200 employees\ncargo-ai segmentation segment fetch \\\n  --model-uuid <model-uuid> \\\n  --filter '{\n    \"conjonction\": \"and\",\n    \"groups\": [{\n      \"conjonction\": \"and\",\n      \"conditions\": [\n        {\"kind\": \"number\", \"columnSlug\": \"employee_count\", \"operator\": \"between\", \"firstValue\": 50, \"lastValue\": 200}\n      ]\n    }]\n  }' \\\n  --fetching-limit 100\n```\n\n## Filter by date column\n\n```bash\n# Created after a specific date\ncargo-ai segmentation segment fetch \\\n  --model-uuid <model-uuid> \\\n  --filter '{\n    \"conjonction\": \"and\",\n    \"groups\": [{\n      \"conjonction\": \"and\",\n      \"conditions\": [\n        {\"kind\": \"date\", \"columnSlug\": \"created_at\", \"operator\": \"greaterThan\", \"value\": \"2025-01-01\"}\n      ]\n    }]\n  }' \\\n  --fetching-limit 100\n\n# Created in a date range\ncargo-ai segmentation segment fetch \\\n  --model-uuid <model-uuid> \\\n  --filter '{\n    \"conjonction\": \"and\",\n    \"groups\": [{\n      \"conjonction\": \"and\",\n      \"conditions\": [\n        {\"kind\": \"date\", \"columnSlug\": \"created_at\", \"operator\": \"between\", \"firstValue\": \"2025-01-01\", \"lastValue\": \"2025-03-31\"}\n      ]\n    }]\n  }' \\\n  --fetching-limit 100\n```\n\n## Filter by boolean column\n\n```bash\n# Only customers\ncargo-ai segmentation segment fetch \\\n  --model-uuid <model-uuid> \\\n  --filter '{\n    \"conjonction\": \"and\",\n    \"groups\": [{\n      \"conjonction\": \"and\",\n      \"conditions\": [\n        {\"kind\": \"boolean\", \"columnSlug\": \"is_customer\", \"operator\": \"isTrue\"}\n      ]\n    }]\n  }' \\\n  --fetching-limit 100\n```\n\n## Combine multiple conditions (AND)\n\n```bash\n# US companies with 100+ employees, created after 2025-01-01\ncargo-ai segmentation segment fetch \\\n  --model-uuid <model-uuid> \\\n  --filter '{\n    \"conjonction\": \"and\",\n    \"groups\": [{\n      \"conjonction\": \"and\",\n      \"conditions\": [\n        {\"kind\": \"string\", \"columnSlug\": \"country\", \"operator\": \"is\", \"values\": [\"US\"]},\n        {\"kind\": \"number\", \"columnSlug\": \"employee_count\", \"operator\": \"greaterThan\", \"value\": 100},\n        {\"kind\": \"date\", \"columnSlug\": \"created_at\", \"operator\": \"greaterThan\", \"value\": \"2025-01-01\"}\n      ]\n    }]\n  }' \\\n  --sort '[{\"columnSlug\":\"employee_count\",\"kind\":\"desc\"}]' \\\n  --fetching-limit 50\n```\n\n## Sort by multiple columns\n\n```bash\ncargo-ai segmentation segment fetch \\\n  --model-uuid <model-uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}' \\\n  --sort '[{\"columnSlug\":\"country\",\"kind\":\"asc\"},{\"columnSlug\":\"employee_count\",\"kind\":\"desc\"}]' \\\n  --fetching-limit 100\n```\n\n## OR logic across groups\n\n```bash\n# Companies in the US OR companies with 500+ employees\ncargo-ai segmentation segment fetch \\\n  --model-uuid <model-uuid> \\\n  --filter '{\n    \"conjonction\": \"or\",\n    \"groups\": [\n      {\n        \"conjonction\": \"and\",\n        \"conditions\": [\n          {\"kind\": \"string\", \"columnSlug\": \"country\", \"operator\": \"is\", \"values\": [\"US\"]}\n        ]\n      },\n      {\n        \"conjonction\": \"and\",\n        \"conditions\": [\n          {\"kind\": \"number\", \"columnSlug\": \"employee_count\", \"operator\": \"greaterThan\", \"value\": 500}\n        ]\n      }\n    ]\n  }' \\\n  --fetching-limit 100\n```\n\n## Filter for non-null values\n\n```bash\n# Only records with an email\ncargo-ai segmentation segment fetch \\\n  --model-uuid <model-uuid> \\\n  --filter '{\n    \"conjonction\": \"and\",\n    \"groups\": [{\n      \"conjonction\": \"and\",\n      \"conditions\": [\n        {\"kind\": \"string\", \"columnSlug\": \"email\", \"operator\": \"isNotNull\"}\n      ]\n    }]\n  }' \\\n  --fetching-limit 100\n```\n\n## Filter records NOT enrolled in a workflow\n\nFind records that have never been processed by a specific play or tool. First get the `workflowUuid` from `play list` or `tool list`.\n\n```bash\n# 1. Find the workflow UUID from the play\ncargo-ai orchestration play list\n# → Extract play.workflowUuid\n\n# 2. Fetch records that have never entered this workflow\ncargo-ai segmentation segment fetch \\\n  --model-uuid <model-uuid> \\\n  --filter '{\n    \"conjonction\": \"and\",\n    \"groups\": [{\n      \"conjonction\": \"and\",\n      \"conditions\": [\n        {\n          \"kind\": \"enrollment\",\n          \"workflowUuid\": \"<workflow-uuid>\",\n          \"activityKind\": \"workflowEntered\",\n          \"frequency\": {\"operator\": \"not\"},\n          \"period\": {\"operator\": \"moreThan\", \"value\": 0, \"unit\": \"day\"}\n        }\n      ]\n    }]\n  }' \\\n  --fetching-limit 100\n```\n\n## Filter records enrolled in a workflow in the last 30 days\n\n```bash\ncargo-ai segmentation segment fetch \\\n  --model-uuid <model-uuid> \\\n  --filter '{\n    \"conjonction\": \"and\",\n    \"groups\": [{\n      \"conjonction\": \"and\",\n      \"conditions\": [\n        {\n          \"kind\": \"enrollment\",\n          \"workflowUuid\": \"<workflow-uuid>\",\n          \"activityKind\": \"workflowEntered\",\n          \"frequency\": {\"operator\": \"moreThan\", \"value\": 0},\n          \"period\": {\"operator\": \"lessThan\", \"value\": 30, \"unit\": \"day\"}\n        }\n      ]\n    }]\n  }' \\\n  --fetching-limit 100\n```\n\n## Combine enrollment with other conditions\n\nUS companies not yet enrolled in the enrichment workflow:\n\n```bash\ncargo-ai segmentation segment fetch \\\n  --model-uuid <model-uuid> \\\n  --filter '{\n    \"conjonction\": \"and\",\n    \"groups\": [{\n      \"conjonction\": \"and\",\n      \"conditions\": [\n        {\"kind\": \"string\", \"columnSlug\": \"country\", \"operator\": \"is\", \"values\": [\"US\"]},\n        {\n          \"kind\": \"enrollment\",\n          \"workflowUuid\": \"<workflow-uuid>\",\n          \"activityKind\": \"workflowEntered\",\n          \"frequency\": {\"operator\": \"not\"},\n          \"period\": {\"operator\": \"moreThan\", \"value\": 0, \"unit\": \"day\"}\n        }\n      ]\n    }]\n  }' \\\n  --fetching-limit 100\n```\n\n## Fetch with enrichment and sync\n\nEnrichment triggers any connected enrichment tools on the records. Sync writes the results back to the model.\n\n```bash\ncargo-ai segmentation segment fetch \\\n  --model-uuid <model-uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}' \\\n  --fetching-limit 50 \\\n  --enrich --sync\n```\n\n## Discover column slugs before filtering\n\n```bash\n# List models to see all columns with their slugs and types\ncargo-ai storage model list\n# → models[].columns[].slug — use these in filter conditions\n# → models[].columns[].type — use to pick the right condition kind:\n#     \"string\" → kind \"string\"\n#     \"number\" → kind \"number\"\n#     \"date\" → kind \"date\"\n#     \"boolean\" → kind \"boolean\"\n#     \"object\" → kind \"object\"\n#     \"array\" → kind \"array\"\n```\n\nFile v1.13.0:references/examples/templates.md\n\n# Orchestration templates\n\n## What is a template?\n\nA **template** is a pre-built workflow blueprint — a ready-to-use node graph that captures common automation patterns (enrichment pipelines, CRM syncs, AI research flows, lead scoring). Templates serve two purposes:\n\n1. **Design-time inspiration** — when building or updating a tool or play, browse templates to find one close to your use case, then copy its node graph into your draft release as a starting point instead of designing from scratch.\n2. **Runtime shortcut** — plug a template's nodes directly into `run create` or `batch create` via the `--nodes` flag without modifying the tool's stored definition.\n\nTemplates are read-only. You discover them by slug, inspect their node graph and expected input schema, then either adapt the graph for a draft release or pass it directly as `--nodes` when creating a run or batch.\n\n## List all templates\n\n```bash\ncargo-ai orchestration template list\n```\n\nResponse:\n\n```json\n{\n  \"templates\": [\n    {\n      \"slug\": \"company-enrichment\",\n      \"name\": \"Company Enrichment\",\n      \"description\": \"Enrich a company record with firmographic data from Clearbit\",\n      \"kind\": \"tool\"\n    },\n    {\n      \"slug\": \"lead-scoring\",\n      \"name\": \"Lead Scoring\",\n      \"description\": \"Score inbound leads based on ICP fit\",\n      \"kind\": \"play\"\n    }\n  ]\n}\n```\n\nKey fields:\n\n- **`slug`** — identifier used to fetch the template\n- **`name`** — human-readable name\n- **`kind`** — `\"tool\"` (on-demand) or `\"play\"` (segment-driven)\n\n## Get a template by slug\n\n```bash\ncargo-ai orchestration template get <slug>\n```\n\nExample:\n\n```bash\ncargo-ai orchestration template get company-enrichment\n```\n\nResponse:\n\n```json\n{\n  \"template\": {\n    \"slug\": \"company-enrichment\",\n    \"name\": \"Company Enrichment\",\n    \"description\": \"Enrich a company record with firmographic data from Clearbit\",\n    \"kind\": \"tool\",\n    \"nodes\": [\n      {\n        \"uuid\": \"44444444-4444-4444-a444-444444444444\",\n        \"slug\": \"start\",\n        \"kind\": \"native\",\n        \"actionSlug\": \"start\",\n        \"config\": {},\n        \"childrenUuids\": [\"55555555-5555-4555-a555-555555555555\"],\n        \"fallbackOnFailure\": false,\n        \"position\": { \"x\": 0, \"y\": 0 }\n      },\n      {\n        \"uuid\": \"55555555-5555-4555-a555-555555555555\",\n        \"slug\": \"enrich_company\",\n        \"kind\": \"connector\",\n        \"integrationSlug\": \"clearbit\",\n        \"actionSlug\": \"enrichCompanyFromDomain\",\n        \"connectorUuid\": \"__REPLACE_WITH_CONNECTOR_UUID__\",\n        \"config\": {\n          \"domain\": {\n            \"kind\": \"templateExpression\",\n            \"expression\": \"{{nodes.start.domain}}\",\n            \"instructTo\": \"none\",\n            \"fromRecipe\": false\n          }\n        },\n        \"childrenUuids\": [\"66666666-6666-4666-a666-666666666666\"],\n        \"fallbackOnFailure\": false,\n        \"position\": { \"x\": 0, \"y\": 166 }\n      },\n      {\n        \"uuid\": \"66666666-6666-4666-a666-666666666666\",\n        \"slug\": \"end\",\n        \"kind\": \"native\",\n        \"actionSlug\": \"end\",\n        \"config\": {\n          \"variables\": [\n            {\n              \"name\": \"company_name\",\n              \"type\": \"string\",\n              \"value\": {\n                \"kind\": \"templateExpression\",\n                \"expression\": \"{{nodes.enrich_company.name}}\",\n                \"instructTo\": \"none\",\n                \"fromRecipe\": false\n              }\n            }\n          ]\n        },\n        \"childrenUuids\": [],\n        \"fallbackOnFailure\": false,\n        \"position\": { \"x\": 0, \"y\": 332 }\n      }\n    ]\n  }\n}\n```\n\n## Use a template as inspiration when building a tool or play\n\nWhen creating or redesigning a tool or play, start with a template rather than building nodes from scratch. Copy the template's node graph into the draft release, replace any placeholders, then deploy.\n\n```bash\n# 1. Find a template that matches your use case\ncargo-ai orchestration template list\n# → Find \"company-enrichment\" (kind: \"tool\") or \"lead-scoring\" (kind: \"play\")\n\n# 2. Inspect the node graph — understand the structure and spot placeholders\ncargo-ai orchestration template get company-enrichment\n\n# 3. Fill in placeholders (connectorUuid, agentUuid, etc.) and validate\ncargo-ai orchestration node validate --nodes '[...modified nodes...]'\n# → { \"outcome\": \"valid\" }\n\n# 4. Find your tool's workflowUuid\ncargo-ai orchestration tool list\n# → Extract tool.workflowUuid\n\n# 5. Save the adapted nodes to the draft release\ncargo-ai orchestration release update-draft \\\n  --workflow-uuid <tool.workflowUuid> \\\n  --nodes '[...validated nodes...]'\n\n# 6. Deploy the draft release\ncargo-ai orchestration release deploy-draft \\\n  --workflow-uuid <tool.workflowUuid> \\\n  --nodes '[...validated nodes...]' \\\n  --form-fields 'null' \\\n  --description \"Based on company-enrichment template\"\n```\n\n> For plays, the same pattern applies — just use `play list` and replace `run create` with `batch create` in any test steps.\n\n## Use a template to run a tool\n\nThe standard pattern:\n\n1. List templates to find the right slug\n2. Get the template to inspect its nodes\n3. Replace any `__REPLACE_WITH_*__` placeholders in the node graph\n4. Validate the nodes before running\n5. Run against a tool workflow\n\n```bash\n# 1. Find the template\ncargo-ai orchestration template list\n# → Find \"company-enrichment\"\n\n# 2. Get the node graph\ncargo-ai orchestration template get company-enrichment\n# → Copy the \"nodes\" array, replace connectorUuid placeholders\n\n# 3. Find your connector UUID\ncargo-ai connection connector list\n# → Find your Clearbit connector, extract its uuid\n\n# 4. Validate the modified nodes\ncargo-ai orchestration node validate --nodes '[...modified nodes...]'\n# → { \"outcome\": \"valid\" }\n\n# 5. Find the tool\ncargo-ai orchestration tool list\n# → Find your tool, extract workflowUuid\n\n# 6. Run\ncargo-ai orchestration run create \\\n  --workflow-uuid <tool.workflowUuid> \\\n  --data '{\"domain\":\"acme.com\"}' \\\n  --nodes '[...validated nodes...]'\n# → Poll with: cargo-ai orchestration run get <run-uuid>\n```\n\n## Use a template to run a play\n\nFor `kind: \"play\"` templates, use `batch create` instead of `run create`:\n\n```bash\n# 1. Get the template\ncargo-ai orchestration template get lead-scoring\n\n# 2. Replace placeholders, validate\ncargo-ai orchestration node validate --nodes '[...]'\n\n# 3. Find the play's workflowUuid and modelUuid\ncargo-ai orchestration play list\n\n# 4. Batch run over the play's model (empty filter = all rows)\ncargo-ai orchestration batch create \\\n  --workflow-uuid <play.workflowUuid> \\\n  --data '{\"kind\":\"filter\",\"modelUuid\":\"<play.modelUuid>\",\"filter\":{\"conjonction\":\"and\",\"groups\":[]}}' \\\n  --nodes '[...validated nodes...]'\n# → Poll with: cargo-ai orchestration batch get <batch-uuid>\n```\n\n## Placeholder convention\n\nTemplate node graphs use `__REPLACE_WITH_*__` strings to mark values that must be substituted before use:\n\n| Placeholder                       | Replace with                                                    |\n| --------------------------------- | --------------------------------------------------------------- |\n| `__REPLACE_WITH_CONNECTOR_UUID__` | UUID from `cargo-ai connection connector list`                  |\n| `__REPLACE_WITH_TOOL_UUID__`      | UUID from `cargo-ai orchestration tool list`                    |\n| `__REPLACE_WITH_AGENT_UUID__`     | UUID from `cargo-ai ai agent list`                              |\n| `__REPLACE_WITH_MODEL_UUID__`     | UUID from `cargo-ai storage model list`                         |\n\nAlways run `node validate` after substitution to confirm there are no structural errors.\n\nFile v1.13.0:references/examples/tools.md\n\n# Tool examples\n\n## What is a tool?\n\nA **tool** is an on-demand workflow. Unlike plays (which react to segment changes), tools are triggered manually, via API, or on a cron schedule. Tools are the proactive side of Cargo — \"run this workflow right now on this data.\"\n\nKey properties of a tool:\n\n- **`name`** — human-readable name (workflows themselves don't have names)\n- **`workflowUuid`** — the underlying workflow that executes\n- **`description`** — what the tool does\n- **`creditsCost`** — estimated credit cost per run\n- **`triggers`** — optional cron triggers for scheduled execution\n- **`isReadOnly`** — whether the tool can be modified\n\n## List all tools\n\n```bash\ncargo-ai orchestration tool list\n```\n\nResponse:\n\n```json\n{\n  \"tools\": [\n    {\n      \"uuid\": \"tool-uuid\",\n      \"name\": \"Company Enrichment\",\n      \"workflowUuid\": \"workflow-uuid\",\n      \"description\": \"Enriches a company record with firmographic data\",\n      \"creditsCost\": { \"kind\": \"minMax\" },\n      \"triggers\": [],\n      \"isReadOnly\": false\n    }\n  ]\n}\n```\n\n## Find a tool's workflow UUID\n\nTools have names — workflows don't. Use the tool to find the right workflow.\n\n```bash\n# 1. List tools, find by name\ncargo-ai orchestration tool list\n# → Find \"Company Enrichment\", extract tool.workflowUuid\n\n# 2. Use the workflowUuid for run/batch commands\ncargo-ai orchestration run create \\\n  --workflow-uuid <workflow-uuid-from-tool> \\\n  --data '{\"company\":\"Acme Corp\",\"domain\":\"acme.com\"}'\n```\n\n## Update a tool's workflow\n\nTo change what a tool does, update its draft release and deploy it. The draft release holds the unpublished node graph for the workflow.\n\n> **Looking for inspiration?** Before designing a node graph from scratch, check `cargo-ai orchestration template list` for pre-built patterns (enrichment pipelines, CRM syncs, AI research flows). Use `cargo-ai orchestration template get <slug>` to copy a ready-made node graph and adapt it instead of starting from zero. Templates tagged `\"kind\":\"tool\"` are designed for on-demand workflows.\n\n```bash\n# Step 1 — Find the tool and its workflowUuid\ncargo-ai orchestration tool list\n# → Find \"Company Enrichment\", extract tool.workflowUuid\n\n# Step 2 — Get the current draft release (contains the current node graph)\ncargo-ai orchestration release get-draft --workflow-uuid <tool.workflowUuid>\n# → Copy the \"nodes\" array and make your changes\n\n# Step 3 — Update the draft release with your new nodes\ncargo-ai orchestration release update-draft \\\n  --workflow-uuid <tool.workflowUuid> \\\n  --nodes '[...your updated node graph...]'\n\n# Step 4 — Validate the updated nodes before deploying\ncargo-ai orchestration node validate --nodes '[...your updated node graph...]'\n# → { \"outcome\": \"valid\" }\n\n# Step 5 — Deploy the draft release\ncargo-ai orchestration release deploy-draft \\\n  --workflow-uuid <tool.workflowUuid> \\\n  --nodes '[...your updated node graph...]' \\\n  --form-fields 'null' \\\n  --description \"Your release description\"\n```\n\n> **Do not skip validation.** Deploying an invalid node graph will cause runs to fail. Always run `node validate` before `release deploy-draft`.\n\n---\n\n## Run a tool on a single record\n\nThe most common use case — run an existing tool workflow on one record. Tools support both `run create` (single record) and `batch create` (multiple records). Allowed batch data kinds for tools: `file`, `records`.\n\n```bash\n# 1. Find the tool\ncargo-ai orchestration tool list\n# → Extract tool.workflowUuid\n\n# 2. Run with inline record data\ncargo-ai orchestration run create \\\n  --workflow-uuid <tool.workflowUuid> \\\n  --data '{\"company\":\"Acme Corp\",\"domain\":\"acme.com\",\"employee_count\":500}'\n\n# Or block until finished — returns the final run result without a separate poll step\ncargo-ai orchestration run create \\\n  --workflow-uuid <tool.workflowUuid> \\\n  --data '{\"company\":\"Acme Corp\",\"domain\":\"acme.com\",\"employee_count\":500}' \\\n  --wait-until-finished\n```\n\nRun create response:\n\n```json\n{\n  \"run\": {\n    \"uuid\": \"run-uuid\",\n    \"workflowUuid\": \"...\",\n    \"status\": \"pending\",\n    \"createdAt\": \"2025-01-15T10:00:00Z\"\n  }\n}\n```\n\n```bash\n# 3. Poll run status every 2s\ncargo-ai orchestration run get <run-uuid>\n```\n\nPoll until `status` is `success`, `error`, or `cancelled`:\n\n```json\n{\n  \"run\": {\n    \"uuid\": \"run-uuid\",\n    \"status\": \"success\",\n    \"createdAt\": \"...\",\n    \"finishedAt\": \"2025-01-15T10:00:05Z\"\n  }\n}\n```\n\n## Upload a CSV file\n\nBefore running a tool on records from a file, you must upload the CSV first. The upload returns the `s3Filename` needed by batch commands.\n\n```bash\ncargo-ai workspaceManagement file upload --file ./my-companies.csv\n```\n\nResponse:\n\n```json\n{\n  \"s3Filename\": \"abc123-my-companies.csv\",\n  \"contentType\": \"text/csv\",\n  \"name\": \"my-companies.csv\"\n}\n```\n\nYou can also inspect which columns the file contains:\n\n```bash\ncargo-ai workspaceManagement file list-columns --s3-filename abc123-my-companies.csv\n```\n\n## Run a tool on records from a file\n\n```bash\n# 1. Find the tool\ncargo-ai orchestration tool list\n# → Extract tool.workflowUuid\n\n# 2. Upload the CSV\ncargo-ai workspaceManagement file upload --file ./my-companies.csv\n# → Extract s3Filename from the response\n\n\n# 3. Create the batch\ncargo-ai orchestration batch create \\\n  --workflow-uuid <tool.workflowUuid> \\\n  --data '{\"kind\":\"file\",\"s3Filename\":\"<s3Filename>\"}'\n# → Extract batch.uuid\n\n# 4. Poll until finished (repeat every 5s)\ncargo-ai orchestration batch get <batch-uuid>\n# → Done when .status is \"success\", \"error\", or \"cancelled\"\n# → Extract batch.releaseUuid\n\n# Or skip polling — block until finished and get the final batch result in one step\ncargo-ai orchestration batch create \\\n  --workflow-uuid <tool.workflowUuid> \\\n  --data '{\"kind\":\"file\",\"s3Filename\":\"<s3Filename>\"}' \\\n  --wait-until-finished\n# → Returns the final batch result directly\n\n# 5. Download results\ncargo-ai orchestration batch download \\\n  --uuid <batch-uuid> \\\n  --output-node-slug end\n```\n\n## Monitor a tool's runs\n\n```bash\n# List recent runs\ncargo-ai orchestration run list \\\n  --workflow-uuid <tool.workflowUuid> \\\n  --limit 20\n\n# Running and pending runs\ncargo-ai orchestration run list \\\n  --workflow-uuid <tool.workflowUuid> \\\n  --statuses running,pending\n\n# Error runs\ncargo-ai orchestration run list \\\n  --workflow-uuid <tool.workflowUuid> \\\n  --statuses error \\\n  --limit 10\n\n# Count errors\ncargo-ai orchestration run count \\\n  --workflow-uuid <tool.workflowUuid> \\\n  --statuses error\n```\n\n## Monitor running batches\n\n```bash\n# List all running batches for the tool\ncargo-ai orchestration batch list \\\n  --workflow-uuids <tool.workflowUuid> \\\n  --statuses running\n\n# Check a specific batch\ncargo-ai orchestration batch get <batch-uuid>\n```\n\n## Cancel runs and batches\n\n```bash\n# Cancel specific runs\ncargo-ai orchestration run cancel \\\n  --workflow-uuid <tool.workflowUuid> \\\n  --uuids <run-uuid-1>,<run-uuid-2>\n\n# Cancel a batch (stops all remaining runs)\ncargo-ai orchestration batch cancel <batch-uuid>\n```\n\n## Run with custom nodes (ad-hoc workflow)\n\nThe `--nodes` flag lets you run a custom node graph at runtime without modifying the tool's published definition. When using `--nodes`, you do not need to pass `--workflow-uuid` — the nodes define the entire workflow inline. Every graph needs a `start` node and an `end` node, linked via `childrenUuids`.\n\n> See `../nodes.md` for the full node creation guide — node kinds, native actions, config expressions, routing, and more examples.\n\nMinimal example — start, enrich via connector, output:\n\n```bash\ncargo-ai orchestration run create \\\n  --data '{\"domain\":\"acme.com\"}' \\\n  --nodes '[\n    {\n      \"uuid\":\"11111111-1111-4111-a111-111111111111\",\"slug\":\"start\",\"kind\":\"native\",\"actionSlug\":\"start\",\n      \"config\":{},\"childrenUuids\":[\"22222222-2222-4222-a222-222222222222\"],\"fallbackOnFailure\":false,\n      \"position\":{\"x\":0,\"y\":0}\n    },\n    {\n      \"uuid\":\"22222222-2222-4222-a222-222222222222\",\"slug\":\"enrich_company\",\"kind\":\"connector\",\n      \"integrationSlug\":\"clearbit\",\"actionSlug\":\"enrichCompanyFromDomain\",\n      \"connectorUuid\":\"<connector-uuid>\",\n      \"config\":{\n        \"domain\":{\"kind\":\"templateExpression\",\"expression\":\"{{nodes.start.domain}}\",\"instructTo\":\"none\",\"fromRecipe\":false}\n      },\n      \"childrenUuids\":[\"33333333-3333-4333-a333-333333333333\"],\"fallbackOnFailure\":false,\n      \"position\":{\"x\":0,\"y\":166}\n    },\n    {\n      \"uuid\":\"33333333-3333-4333-a333-333333333333\",\"slug\":\"end\",\"kind\":\"native\",\"actionSlug\":\"end\",\n      \"config\":{\n        \"variables\":[\n          {\"name\":\"company_name\",\"type\":\"string\",\"value\":{\"kind\":\"templateExpression\",\"expression\":\"{{nodes.enrich_company.name}}\",\"instructTo\":\"none\",\"fromRecipe\":false}}\n        ]\n      },\n      \"childrenUuids\":[],\"fallbackOnFailure\":false,\n      \"position\":{\"x\":0,\"y\":332}\n    }\n  ]'\n```\n\nValidate before running:\n\n```bash\ncargo-ai orchestration node validate --nodes '[...]'\n# → { \"outcome\": \"valid\" } or { \"outcome\": \"notValid\", \"invalidNodes\": [...] }\n```\n\nCustom node runs are polled the same way as regular runs:\n\n```bash\ncargo-ai orchestration run get <run-uuid>\n```\n\n### Common errors\n\n| Error                         | Cause                                                | Fix                              |\n| ----------------------------- | ---------------------------------------------------- | -------------------------------- |\n| `startNodeNotFound`           | No node with `slug:\"start\"` and `actionSlug:\"start\"` | Add the required start node      |\n| `invalidReleaseOrCustomNodes` | Both `--release-uuid` and `--nodes` provided         | Use one or the other, not both   |\n| `nodesNotFound`               | `childrenUuids` references a UUID not in the array   | Verify all UUID cross-references |\n\n## Run a tool multiple times on different records\n\n```bash\n# Run on first record\ncargo-ai orchestration run create \\\n  --workflow-uuid <tool.workflowUuid> \\\n  --data '{\"company\":\"Acme Corp\",\"domain\":\"acme.com\"}'\n\n# Run on second record\ncargo-ai orchestration run create \\\n  --workflow-uuid <tool.workflowUuid> \\\n  --data '{\"company\":\"Globex Inc\",\"domain\":\"globex.com\"}'\n\n# Poll each run separately\ncargo-ai orchestration run get <run-uuid-1>\ncargo-ai orchestration run get <run-uuid-2>\n```\n\n## End-to-end: use a template to run a tool\n\nThis example takes a \"company-enrichment\" tool template, fills in its connector placeholder, validates, and runs it on a single record.\n\n```bash\n# Step 1 — List available tool templates\ncargo-ai orchestration template list\n# → Find slug: \"company-enrichment\", kind: \"tool\"\n\n# Step 2 — Get the template's node graph\ncargo-ai orchestration template get company-enrichment\n# → Copy the \"nodes\" array. It contains __REPLACE_WITH_CONNECTOR_UUID__ placeholders.\n\n# Step 3 — Find your connector UUID\ncargo-ai connection connector list\n# → Find your Clearbit connector, extract uuid (e.g. \"abc-123\")\n\n# Step 4 — Fill in placeholders and validate\ncargo-ai orchestration node validate --nodes '[\n  {\n    \"uuid\": \"44444444-4444-4444-a444-444444444444\", \"slug\": \"start\", \"kind\": \"native\", \"actionSlug\": \"start\",\n    \"config\": {}, \"childrenUuids\": [\"55555555-5555-4555-a555-555555555555\"], \"fallbackOnFailure\": false,\n    \"position\": {\"x\": 0, \"y\": 0}\n  },\n  {\n    \"uuid\": \"55555555-5555-4555-a555-555555555555\", \"slug\": \"enrich_company\", \"kind\": \"connector\",\n    \"integrationSlug\": \"clearbit\", \"actionSlug\": \"enrichCompanyFromDomain\",\n    \"connectorUuid\": \"abc-123\",\n    \"config\": {\n      \"domain\": {\n        \"kind\": \"templateExpression\",\n        \"expression\": \"{{nodes.start.domain}}\",\n        \"instructTo\": \"none\",\n        \"fromRecipe\": false\n      }\n    },\n    \"childrenUuids\": [\"66666666-6666-4666-a666-666666666666\"], \"fallbackOnFailure\": false,\n    \"position\": {\"x\": 0, \"y\": 166}\n  },\n  {\n    \"uuid\": \"66666666-6666-4666-a666-666666666666\", \"slug\": \"end\", \"kind\": \"native\", \"actionSlug\": \"end\",\n    \"config\": {\n      \"variables\": [\n        {\"name\": \"company_name\", \"type\": \"string\", \"value\": {\"kind\": \"templateExpression\", \"expression\": \"{{nodes.enrich_company.name}}\", \"instructTo\": \"none\", \"fromRecipe\": false}},\n        {\"name\": \"industry\", \"type\": \"string\", \"value\": {\"kind\": \"templateExpression\", \"expression\": \"{{nodes.enrich_company.category.industry}}\", \"instructTo\": \"none\", \"fromRecipe\": false}},\n        {\"name\": \"employees\", \"type\": \"string\", \"value\": {\"kind\": \"templateExpression\", \"expression\": \"{{nodes.enrich_company.metrics.employeesRange}}\", \"instructTo\": \"none\", \"fromRecipe\": false}}\n      ]\n    },\n    \"childrenUuids\": [], \"fallbackOnFailure\": false,\n    \"position\": {\"x\": 0, \"y\": 332}\n  }\n]'\n# → { \"outcome\": \"valid\" }\n\n# Step 5 — (Optional) Preview expression resolution without side effects\ncargo-ai orchestration node compute \\\n  --node '{\"uuid\":\"55555555-5555-4555-a555-555555555555\",\"slug\":\"enrich_company\",\"kind\":\"connector\",\"integrationSlug\":\"clearbit\",\"actionSlug\":\"enrichCompanyFromDomain\",\"connectorUuid\":\"abc-123\",\"config\":{\"domain\":{\"kind\":\"templateExpression\",\"expression\":\"{{nodes.start.domain}}\",\"instructTo\":\"none\",\"fromRecipe\":false}},\"childrenUuids\":[\"66666666-6666-4666-a666-666666666666\"],\"fallbackOnFailure\":false,\"position\":{\"x\":0,\"y\":166}}' \\\n  --context '{\"nodes\":{\"start\":{\"domain\":\"acme.com\"}}}'\n# → Shows resolved config: { \"domain\": \"acme.com\" }\n\n# Step 6 — Find the tool's workflowUuid\ncargo-ai orchestration tool list\n# → Find \"Company Enrichment\", extract workflowUuid\n\n# Step 7 — Run\ncargo-ai orchestration run create \\\n  --workflow-uuid <tool.workflowUuid> \\\n  --data '{\"domain\":\"acme.com\"}' \\\n  --nodes '[...validated nodes from step 4...]'\n# → Extract run.uuid\n\n# Step 8 — Poll until done (every 2s)\ncargo-ai orchestration run get <run-uuid>\n# → Done when status is \"success\", \"error\", or \"cancelled\"\n```\n\nFile v1.13.0:references/filter-syntax.md\n\n# Filter syntax\n\nComplete reference for building segment filter conditions in the Cargo CLI.\n\n> **CRITICAL — common silent failure:**\n> Every filter object uses the key `conjonction` — **not** `conjunction`.\n> This is intentional (French spelling). A typo here does **not** throw an error — it simply returns no records.\n> Double-check this spelling every time you write a filter. Search for `conjunction` in your JSON before running.\n\n## Structure\n\nA filter has two levels of nesting: top-level groups joined by a conjunction, and each group contains conditions joined by their own conjunction.\n\n```json\n{\n  \"conjonction\": \"and\",\n  \"groups\": [\n    {\n      \"conjonction\": \"and\",\n      \"conditions\": [\n        { \"kind\": \"string\", \"columnSlug\": \"domain\", \"operator\": \"contains\", \"values\": \"acme\" }\n      ]\n    }\n  ]\n}\n```\n\n- Top-level `conjonction`: `\"and\"` or `\"or\"` — joins the groups\n- Group-level `conjonction`: `\"and\"` or `\"or\"` — joins the conditions within a group\n- Empty filter (all records): `{\"conjonction\":\"and\",\"groups\":[]}`\n\n## Condition kinds and operators\n\n### string\n\n```json\n{ \"kind\": \"string\", \"columnSlug\": \"name\", \"operator\": \"is\", \"values\": [\"Acme Corp\"] }\n{ \"kind\": \"string\", \"columnSlug\": \"name\", \"operator\": \"isNot\", \"values\": [\"Test\"] }\n{ \"kind\": \"string\", \"columnSlug\": \"name\", \"operator\": \"contains\", \"values\": \"acme\" }\n{ \"kind\": \"string\", \"columnSlug\": \"name\", \"operator\": \"doesNotContain\", \"values\": \"test\" }\n{ \"kind\": \"string\", \"columnSlug\": \"name\", \"operator\": \"startsWith\", \"values\": \"A\" }\n{ \"kind\": \"string\", \"columnSlug\": \"name\", \"operator\": \"endsWith\", \"values\": \"Corp\" }\n{ \"kind\": \"string\", \"columnSlug\": \"name\", \"operator\": \"isNull\" }\n{ \"kind\": \"string\", \"columnSlug\": \"name\", \"operator\": \"isNotNull\" }\n{ \"kind\": \"string\", \"columnSlug\": \"name\", \"operator\": \"isEmpty\" }\n{ \"kind\": \"string\", \"columnSlug\": \"name\", \"operator\": \"isNotEmpty\" }\n```\n\nOperators with values: `is`, `isNot`, `contains`, `doesNotContain`, `startsWith`, `endsWith`.\n`values` can be a string or an array of strings.\n\nOperators without values: `isNull`, `isNotNull`, `isEmpty`, `isNotEmpty`.\n\n### number\n\n```json\n{ \"kind\": \"number\", \"columnSlug\": \"employee_count\", \"operator\": \"is\", \"value\": 500 }\n{ \"kind\": \"number\", \"columnSlug\": \"employee_count\", \"operator\": \"isNot\", \"value\": 0 }\n{ \"kind\": \"number\", \"columnSlug\": \"employee_count\", \"operator\": \"greaterThan\", \"value\": 100 }\n{ \"kind\": \"number\", \"columnSlug\": \"employee_count\", \"operator\": \"lowerThan\", \"value\": 1000 }\n{ \"kind\": \"number\", \"columnSlug\": \"employee_count\", \"operator\": \"between\", \"firstValue\": 100, \"lastValue\": 500 }\n{ \"kind\": \"number\", \"columnSlug\": \"employee_count\", \"operator\": \"isNull\" }\n{ \"kind\": \"number\", \"columnSlug\": \"employee_count\", \"operator\": \"isNotNull\" }\n```\n\nNote: single-value operators use `value` (not `values`). `between` uses `firstValue` and `lastValue`.\n\n### date\n\n```json\n{ \"kind\": \"date\", \"columnSlug\": \"created_at\", \"operator\": \"is\", \"value\": \"2025-01-15\" }\n{ \"kind\": \"date\", \"columnSlug\": \"created_at\", \"operator\": \"isNot\", \"value\": \"2025-01-15\" }\n{ \"kind\": \"date\", \"columnSlug\": \"created_at\", \"operator\": \"greaterThan\", \"value\": \"2025-01-01\" }\n{ \"kind\": \"date\", \"columnSlug\": \"created_at\", \"operator\": \"lowerThan\", \"value\": \"2025-06-01\" }\n{ \"kind\": \"date\", \"columnSlug\": \"created_at\", \"operator\": \"between\", \"firstValue\": \"2025-01-01\", \"lastValue\": \"2025-06-30\" }\n{ \"kind\": \"date\", \"columnSlug\": \"created_at\", \"operator\": \"isNull\" }\n{ \"kind\": \"date\", \"columnSlug\": \"created_at\", \"operator\": \"isNotNull\" }\n```\n\nSame structure as `number` but `value`/`firstValue`/`lastValue` are ISO date strings.\n\n### boolean\n\n```json\n{ \"kind\": \"boolean\", \"columnSlug\": \"is_customer\", \"operator\": \"isTrue\" }\n{ \"kind\": \"boolean\", \"columnSlug\": \"is_customer\", \"operator\": \"isFalse\" }\n{ \"kind\": \"boolean\", \"columnSlug\": \"is_customer\", \"operator\": \"isNull\" }\n{ \"kind\": \"boolean\", \"columnSlug\": \"is_customer\", \"operator\": \"isNotNull\" }\n```\n\n### object / array\n\n```json\n{ \"kind\": \"object\", \"columnSlug\": \"metadata\", \"operator\": \"isNull\" }\n{ \"kind\": \"object\", \"columnSlug\": \"metadata\", \"operator\": \"isNotNull\" }\n{ \"kind\": \"object\", \"columnSlug\": \"metadata\", \"operator\": \"matchConditions\" }\n```\n\nFor `matchConditions`, nest `objectProperty` conditions inside.\n\n### objectProperty\n\nUsed to filter on nested properties within object or array columns:\n\n```json\n{\n  \"kind\": \"objectProperty\",\n  \"columnSlug\": \"metadata\",\n  \"propertyName\": \"industry\",\n  \"operator\": \"is\",\n  \"value\": \"SaaS\"\n}\n```\n\nSupports: `is`, `isNot`, `contains`, `doesNotContain`, `startsWith`, `endsWith`, `greaterThan`, `lowerThan`, `between`, `isNull`, `isNotNull`, `isEmpty`, `isNotEmpty`.\n\nFor `between`: use `value` and `otherValue`.\n\n### segment\n\nFilter records that belong (or don't belong) to another segment:\n\n```json\n{ \"kind\": \"segment\", \"operator\": \"in\", \"segmentUuid\": \"other-segment-uuid\" }\n{ \"kind\": \"segment\", \"operator\": \"notIn\", \"segmentUuid\": \"other-segment-uuid\" }\n```\n\n### enrollment\n\nFilter records based on whether they have been enrolled (or not) in a workflow. Useful to find records that have never been processed by a play/tool.\n\n**Records NOT enrolled in a workflow (never entered):**\n\n```json\n{\n  \"kind\": \"enrollment\",\n  \"workflowUuid\": \"<workflow-uuid>\",\n  \"activityKind\": \"workflowEntered\",\n  \"frequency\": { \"operator\": \"not\" },\n  \"period\": { \"operator\": \"moreThan\", \"value\": 0, \"unit\": \"day\" }\n}\n```\n\n**Records enrolled more than 3 times:**\n\n```json\n{\n  \"kind\": \"enrollment\",\n  \"workflowUuid\": \"<workflow-uuid>\",\n  \"activityKind\": \"workflowEntered\",\n  \"frequency\": { \"operator\": \"moreThan\", \"value\": 3 },\n  \"period\": { \"operator\": \"moreThan\", \"value\": 0, \"unit\": \"day\" }\n}\n```\n\n**Records that left a workflow in the last 30 days:**\n\n```json\n{\n  \"kind\": \"enrollment\",\n  \"workflowUuid\": \"<workflow-uuid>\",\n  \"activityKind\": \"workflowLeft\",\n  \"frequency\": { \"operator\": \"moreThan\", \"value\": 0 },\n  \"period\": { \"operator\": \"lessThan\", \"value\": 30, \"unit\": \"day\" }\n}\n```\n\n**Records where a specific node was executed:**\n\n```json\n{\n  \"kind\": \"enrollment\",\n  \"workflowUuid\": \"<workflow-uuid>\",\n  \"activityKind\": \"workflowNodeExecuted\",\n  \"nodeSlug\": \"enrich_company\",\n  \"frequency\": { \"operator\": \"moreThan\", \"value\": 0 },\n  \"period\": { \"operator\": \"moreThan\", \"value\": 0, \"unit\": \"day\" }\n}\n```\n\n`activityKind` values: `workflowEntered`, `workflowNodeExecuted`, `workflowLeft`.\n\n`frequency.operator` values: `not` (never), `moreThan`, `lessThan`, `exactly`.\n\n`period.operator` values: `moreThan`, `lessThan`, `exactly`. `unit` is always `\"day\"`.\n\n`nodeSlug` is optional — only used with `workflowNodeExecuted`.\n\n### occurrence\n\nFilter records based on related model activity (e.g. a contact's company has certain events).\n\n```json\n{\n  \"kind\": \"occurrence\",\n  \"relatedModelUuid\": \"<related-model-uuid>\",\n  \"frequency\": { \"operator\": \"moreThan\", \"value\": 0 },\n  \"period\": { \"operator\": \"lessThan\", \"value\": 30, \"unit\": \"day\" },\n  \"conjonction\": \"and\",\n  \"conditions\": [\n    { \"kind\": \"string\", \"columnSlug\": \"event_type\", \"operator\": \"is\", \"values\": [\"meeting_booked\"] }\n  ]\n}\n```\n\nSame `frequency` and `period` syntax as enrollment. The `conditions` array can contain any string/number/date/boolean conditions to filter the related model's records.\n\n### sql\n\nRaw SQL clause (advanced):\n\n```json\n{ \"kind\": \"sql\", \"name\": \"custom_filter\", \"clause\": \"revenue > 1000000 AND country = 'US'\" }\n```\n\n## Complete example\n\nFilter for companies with 100+ employees whose name contains \"tech\", created after 2025-01-01:\n\n```json\n{\n  \"conjonction\": \"and\",\n  \"groups\": [\n    {\n      \"conjonction\": \"and\",\n      \"conditions\": [\n        { \"kind\": \"number\", \"columnSlug\": \"employee_count\", \"operator\": \"greaterThan\", \"value\": 100 },\n        { \"kind\": \"string\", \"columnSlug\": \"name\", \"operator\": \"contains\", \"values\": \"tech\" },\n        { \"kind\": \"date\", \"columnSlug\": \"created_at\", \"operator\": \"greaterThan\", \"value\": \"2025-01-01\" }\n      ]\n    }\n  ]\n}\n```\n\n## OR logic\n\nFilter for companies in the US OR with 500+ employees:\n\n```json\n{\n  \"conjonction\": \"or\",\n  \"groups\": [\n    {\n      \"conjonction\": \"and\",\n      \"conditions\": [\n        { \"kind\": \"string\", \"columnSlug\": \"country\", \"operator\": \"is\", \"values\": [\"US\"] }\n      ]\n    },\n    {\n      \"conjonction\": \"and\",\n      \"conditions\": [\n        { \"kind\": \"number\", \"columnSlug\": \"employee_count\", \"operator\": \"greaterThan\", \"value\": 500 }\n      ]\n    }\n  ]\n}\n```\n\n## Sort syntax\n\nSort is an **array** of sort objects. Each object has `columnSlug` and `kind`.\n\n```json\n[{\"columnSlug\": \"created_at\", \"kind\": \"desc\"}]\n```\n\n- `columnSlug` — the column slug to sort by (from `model list` → `columns[].slug`)\n- `kind` — `\"asc\"` (ascending) or `\"desc\"` (descending)\n\nMultiple sort columns (first by country ascending, then by employee count descending):\n\n```json\n[{\"columnSlug\": \"country\", \"kind\": \"asc\"}, {\"columnSlug\": \"employee_count\", \"kind\": \"desc\"}]\n```\n\nUsage with `--sort`:\n\n```bash\ncargo-ai segmentation segment fetch \\\n  --model-uuid <uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}' \\\n  --sort '[{\"columnSlug\":\"created_at\",\"kind\":\"desc\"}]' \\\n  --fetching-limit 100\n```\n\n## Tips\n\n- Get available column slugs from `cargo-ai storage model list` → `columns[].slug`\n- Use the column `type` to pick the right condition `kind` (string → string, number → number, etc.)\n- An empty filter `{\"conjonction\":\"and\",\"groups\":[]}` returns all records\n- `relatedModelUuid` is optional on conditions — only needed for cross-model filters\n\nFile v1.13.0:references/node-diagram.md\n\n# Diagramming a node graph\n\nA workflow the user can't see is a workflow they can't approve. A node graph is a\ndirected graph with routing, fallbacks, and paid steps in it — prose flattens all\nthree. Draw it instead: it costs nothing, and the command renders two formats from\nthe same graph — ASCII for a terminal, Mermaid for anything that renders Mermaid\n(GitHub, the Cargo docs, a published page). See [The ASCII format](#the-ascii-format-cli--1056).\n\n`cargo-ai orchestration node diagram` does it (**CLI ≥ 1.0.54**; `unknown command`\nmeans the pin hasn't moved yet — bump per [`../../cargo/SKILL.md`](../../cargo/SKILL.md)\n§ \"At session start\"). Free, runs nothing, no credits — same family as\n`node validate`.\n\n## When to draw one\n\n- **At the plan gate**, before `release deploy-draft` / `project deploy` — the diagram\n  *is* the \"nodes and data flow\" half of the plan ([`../../cargo/references/interaction.md`](../../cargo/references/interaction.md) §1).\n- **When explaining an existing workflow, tool, or play** — \"what does this play\n  do?\" is one command against its `workflowUuid`.\n- **When reporting a trace** — the graph with the failing node marked red, next to\n  the error ([`../../cargo-diagnostics/references/run-trace.md`](../../cargo-diagnostics/references/run-trace.md)).\n\nSkip it for a linear graph of three nodes or fewer, or a one-node change — say what\nchanged in a sentence instead. A diagram of `start → enrich → end` is ceremony.\n\n## Generate it\n\n```bash\n# An existing workflow, tool, or play (workflowUuid from `tool list` / `play list`)\n# --format ascii when SHOWING it to someone; drop it when pasting into a PR or doc\ncargo-ai orchestration node diagram --workflow-uuid <uuid> --format ascii --raw\n\n# The draft you are about to deploy — the plan-gate case\ncargo-ai orchestration node diagram --workflow-uuid <uuid> --draft --raw\n\n# A graph you are authoring, before it exists server-side\ncargo-ai orchestration node diagram --nodes '[...]' --raw\n\n# The graph a run executed, with the failing node marked\ncargo-ai orchestration node diagram --run-uuid <uuid> --highlight <node-slug> --raw\n```\n\nPass exactly one source: `--nodes` (or `-` to read stdin), `--file <path>`,\n`--workflow-uuid` (deployed, `--draft` for the draft), `--release-uuid`, or\n`--run-uuid`.\n\n| Flag | Effect |\n| --- | --- |\n| `--format ascii\\|mermaid` | `ascii` to show it in a terminal, `mermaid` to paste it somewhere that renders it (default). CLI ≥ 1.0.56. |\n| `--title <text>` | Title rendered above the diagram. |\n| `--direction TD\\|LR` | Mermaid flow direction (default `TD`; `LR` reads better for long linear graphs). Ignored by `--format ascii`. |\n| `--paid <slugs>` | Comma-separated node slugs/uuids that bill credits — marked 💳. |\n| `--highlight <slugs>` | Comma-separated slugs/uuids to mark — red in Mermaid, `◀━` in ASCII. The failing node in a trace. |\n| `--raw` | Print the diagram itself instead of JSON: plain text for `ascii`, a fenced block for `mermaid`. |\n\nWithout `--raw` it returns `{\"diagram\": \"...\", \"format\": \"ascii\"|\"mermaid\", \"warnings\": [...]}`\nlike every other command. **Read the `warnings`** — they carry the structural\nproblems a tidy drawing would otherwise hide (nodes unreachable from `start`,\ndangling `childrenUuids`) and belong in what you tell the user.\n\n`--run-uuid` handles both run shapes: a run from `action execute` carries its own\n`nodes`, a run of a deployed tool or play carries only a `releaseUuid`, and the\ncommand follows whichever it has.\n\n## What maps to what\n\nYou rarely need this table — the command emits it — but it is what to check when\nreading a diagram someone else produced, or hand-writing one for a graph that\nisn't in Cargo yet.\n\n| Node | Mermaid | Rendered as |\n| --- | --- | --- |\n| `start` / `end` | `n0([\"start\"])` | stadium |\n| `branch`, `filter`, `switch`, `split` | `n1{\"Enterprise?\"}` | diamond |\n| `connector` | `n2[\"Enrich Company<br/>companyEnrich.enrichByDomain\"]` | rectangle |\n| `tool` | `n3[[\"tool e487d28e\"]]` | subroutine box |\n| `agent` (node kind or native action) | `n4{{\"Apply the taxonomy\"}}` | hexagon |\n| `python`, `script` | `n5[/\"Score and band\"/]` | parallelogram |\n| `variables`, `delay`, other native | `n6(\"Coalesce CRM over enrichment\")` | rounded |\n| `group` | rectangle + `subgraph` holding its `_nodes` | box-in-box |\n\nEdges come from `childrenUuids`, in order, labelled by what the routing node means:\n\n| Node | Edge labels |\n| --- | --- |\n| `branch` | `yes` (index 0, condition matched), `no` (index 1) |\n| `filter` | `if true` — a false filter ends the run, so there is no second edge |\n| `switch` | the `routes[i].name` matching each child index |\n| `split` | `A <pct>%` / `B <100-pct>%` |\n| `fallbackChildUuid` → a *different* node | a **dashed** `-. on failure .->` edge — the waterfall pattern |\n| `fallbackChildUuid` → the node's own next step | a `↷` on the label, not a second arrow: a failure here doesn't stop the run |\n\n## Rules that make the diagram true\n\nWhy to run the command rather than transcribe a graph by hand. Each of these was\nhit against a live workspace, not imagined:\n\n- **Nodes are keyed by `uuid`, never by `slug`.** Slugs repeat within a single\n  release — a shipped waterfall has **six** nodes slugged `variables`, and a play\n  has an `agent` node and a `variables` node both slugged `classify`. A slug-keyed\n  diagram silently collapses them into one node and reroutes every edge that\n  touched them. (Same trap downstream: `{{nodes.<slug>...}}` and\n  `runContext.<slug>` are ambiguous for a repeated slug, so give any node you\n  reference later a distinct slug.)\n- **`childrenUuids` order carries meaning.** Index 0 of a `branch` is the matched\n  path. Swapping the labels inverts what the workflow appears to do.\n- **Fallback edges are the mechanism, not decoration.** In waterfall graphs each\n  provider falls through to the next on failure; a diagram without those edges\n  shows a chain of unrelated enrichments.\n- **A `null` in `childrenUuids`, or a node unreachable from `start`, is a finding.**\n  It arrives in `warnings`. Say it out loud rather than drawing a tidy graph over a\n  broken one — an orphaned node never runs.\n- **`tool` and `agent` nodes are drawn from `toolUuid` / `agentUuid`** (top-level\n  node fields; these nodes have no `actionSlug`), so the box reads `tool e487d28e`.\n  Resolve the real name with `orchestration tool get` / `ai agent get` when it\n  matters to the reader.\n- **Mark the paid nodes.** Which action bills is not in the release — check the\n  provider playbook (`../../cargo-gtm/provider-playbooks/<slug>.md`) or\n  `connection integration list`, then pass those slugs to `--paid`. This is the\n  plan gate's \"cost shape\" made visible; the per-record estimate still goes in the\n  text ([`../../cargo-gtm/references/cost-discipline.md`](../../cargo-gtm/references/cost-discipline.md)).\n\n## Worked example\n\n```bash\ncargo-ai orchestration node diagram --workflow-uuid b338e04b-… --draft \\\n  --title \"Classify and score accounts\" --paid enrich --raw\n```\n\n```mermaid\n---\ntitle: Classify and score accounts\n---\nflowchart TD\n    n0([\"start\"])\n    n1{\"Missing revenue or headcount?<br/>branch\"}\n    n2[\"💳 Fill the gap (0.25 credits)<br/>companyEnrich.enrichByDomain\"]\n    n3(\"Coalesce CRM over enrichment<br/>variables\")\n    n4{{\"Apply the taxonomy<br/>agent\"}}\n    n5(\"classify<br/>variables\")\n    n6[/\"Score and band (deterministic)<br/>script\"/]\n    n7([\"end\"])\n    n0 --> n1\n    n1 -->|yes| n2\n    n1 -->|no| n3\n    n2 --> n3\n    n3 --> n4\n    n4 --> n5\n    n5 --> n6\n    n6 --> n7\n```\n\nRead out loud: enrichment only fires for records missing revenue or headcount (so\nthe credit line scales with the gap, not the segment), the model classifies, and\nthe score is deterministic afterwards. That sentence is what the user approves —\nthe diagram is what makes it checkable.\n\n## The ASCII format (CLI ≥ 1.0.56)\n\n`--format ascii` renders the same graph as a drawing that needs no Mermaid\nrenderer. **Pick the format by where the output goes**, not by preference:\n\n| | `--format ascii` | `--format mermaid` (default) |\n| --- | --- | --- |\n| Showing it in a terminal or a chat reply | **yes** | no — the reader sees `n4{\"branch\"}` |\n| Pasting into a PR body, a doc, a rendered page | no | **yes** |\n| Node shapes, `classDef` colouring, group subgraphs | no | yes |\n| Branch labels, fallback edges, `💳`, warnings | yes | yes |\n\nMermaid stays the default for compatibility. That default is wrong for most agent\nreplies, because most agent output is read in a terminal. On an older CLI that\nrejects `--format`, fall back to the fenced Mermaid block plus a one-line path\nsummary — `start → branch(missing firmographics) → enrich 💳 → merge → agent →\nscore → end`.\n\n```\n                  start\n                    │\n                Aviato 💳\n           Lookup LinkedIn URL\n                    │\n              LinkedIn URL?\n                    │\n                    ├──────────────┐\n                   yes             no\n                    │              │\n                    │            Agent\n                    │      Find LinkedIn URL\n                    │              │\n                    ├──────────────┘\n                    │\n              Lead Magic 💳\n         Enrich LinkedIn profile\n                    │\n               Apollo.io 💳\n          Find company headcount\n                    │\n                JavaScript\n            ICP fit assessment\n                    │\n                 Tier 1?\n                    │\n         ┌──────────┴─────────┐\n        yes                   no\n         │                    │\n       Slack             Salesforce\nSend to #best-leads     Update record\n```\n\n| Mark | Meaning |\n| --- | --- |\n| centred `│` spine | the main line of the flow |\n| `├───┐` … `├───┘` | a **detour**: a branch whose paths reconverge. The spine continues; the rail leaves and rejoins |\n| `┌───┴───┐` | a **fork**: a branch whose paths never reconverge. Nothing continues past it |\n| `┆` with `on failure` | a `fallbackChildUuid` edge: where the run goes if that step *errors*, as distinct from returning nothing |\n| `💳` | the step bills credits (`--paid`) |\n| `◀━` | the step was named in `--highlight` |\n| `↑ <name>` | a step already drawn above, not repeated |\n\nEach step is two lines: the system it runs on over what it does, both resolved\nfrom the platform's catalogs, so a step reads `Apollo.io` / `Enrich person`\nrather than `apolloio` / `enrichPerson`. A step keeps its own name where the\nauthor set one. Branch steps get one line, because the labelled rails leaving them\nalready say that they route.\n\nA `group` step draws its own graph in a captioned box, one level down, with\n`--paid` / `--highlight` carried inside; a broken graph in a loop body is\nreported against the loop.\n\n**Width.** Rails stack rightward and each must clear the one below it, so a graph\nbranching at nearly every step of a long chain gets wide. A 29-node provider\nwaterfall draws at 57 columns; past 120 the command adds a warning pointing at\n`--format mermaid`. It never truncates — a diagram that silently dropped an edge\nwould be worse than a wide one. Report that warning rather than pasting a drawing\nthat will wrap in the user's terminal.\n\nFile v1.13.0:references/node-selection.md\n\n# Build from dedicated actions + expressions\n\n**Build every step from dedicated actions + expressions, in this order:**\n\n1. **A dedicated action.** Search first with `cargo-ai orchestration action list <keywords>`\n   (free). It covers connector actions, native actions (`agent`, `modelUpsert`, `branch`,\n   `group`…) and workspace tools, and returns a ready-to-paste `action` object.\n2. **An expression** for the glue between actions. It's inline JavaScript in the field\n   that needs the value, so it covers reshaping, payloads, conditions and arrays.\n3. **HTTP**, only if step 1 found no action for that API. Its body is still an expression.\n4. **A `script` node**, only if the logic can't fit in an expression.\n\nHTTP + `script` is the last resort, not the default.\n\n## Expressions are inline JavaScript\n\n**A template expression is inline JavaScript.** Whatever you write inside `{{ }}` runs\nin a full JavaScript engine, in the field that needs the value. So a small\ntransformation (trim a string, pick a field, build a JSON body, compute a date,\ncheck a list, map over an array) goes **inline, in that field**. It never needs a\n`script` or `python` node of its own.\n\nA code node costs an extra node, an extra execution (every node execution bills), and\nan extra hop to debug, and its output hides behind `.result`. Add one only when the\nlogic truly doesn't fit in an expression.\n\n## Where the logic goes\n\n1. **Used in one place:** write the expression in that field. That covers an action\n   input, a mapping value, a branch condition, an HTTP `url` or `bodyJson`, or an `end`\n   variable.\n2. **Used by several nodes:** compute it once in a `variables` node, and read it as\n   `{{nodes.<slug>.<name>}}`. Put that node **above** any `branch`, because branches\n   don't merge back, and work placed after one gets copied onto every path.\n3. **Genuinely multi-step:** a `script` node. See \"When a code node is warranted\" below.\n\nSome examples of what fits inline:\n\n```\n{{nodes.start.email.trim().toLowerCase().split('@')[1]}}\n{{[\"gmail.com\", \"yahoo.com\"].includes(nodes.prep.domain) ? \"free_mail\" : \"\"}}\n{{nodes.contacts.map(c => c.email).filter(Boolean).join(\", \")}}\n{{new Date().toISOString().slice(0, 10)}}\n```\n\nAn HTTP body is a JSON template, so each value goes in with `JSON.stringify`:\n\n```\n\"bodyJson\": \"{\\\"domain\\\": {{JSON.stringify(nodes.prep.domain)}}, \\\"source\\\": \\\"visit\\\"}\"\n```\n\nA `script` node that only assembles a value for the next node is the pattern to avoid.\nThe next node's field can hold that expression directly.\n\n## Common cases: the dedicated action to use\n\n| Instead of… | Use |\n| --- | --- |\n| code to call an LLM and parse its JSON | the native `agent` node with `output.type:\"jsonSchema\"`, read as `{{nodes.<slug>.answer.<field>}}` |\n| a raw HTTP request to a provider | the integration's connector action. Find it with `cargo-ai orchestration action list <keywords>` |\n| an HTTP call to a Cargo model's `/records/ingest` webhook | the native `modelUpsert` / `modelInsert` action. See [`nodes.md`](nodes.md) → \"Storage\" |\n| code to decide a path | `branch` / `filter` / `switch` with a boolean expression |\n| code to loop over a list | a `group` node |\n| code to wait | a `delay` node |\n\n## When a code node is warranted\n\n- Logic that runs to many statements: messy parsing, dedup, a small state machine.\n  If it fits on a few lines, keep it inline. An expression can hold an arrow function\n  or an IIFE (an immediately called `(() => { … })()`).\n- Parsing an untyped response from an API that has no connector action.\n\nBefore deploying, check each `script`, `python`, and HTTP node: could it be an\nexpression in the field that uses it, or a native action? If so, replace it.\n\nIf you do need code, prefer the JS `script` node. Its `require()` allowlist is\n`axios`, `cheerio`, `crypto-js`, `date-fns`, `jsonschema`, `lodash`, `url`, `uuid`,\nand `zod`. Anything else throws, including `knex` (query over HTTP with `axios`\ninstead). Both code nodes are sandboxed and have no normal logging, so return your\noutput and inspect it via `runContext`.\n\n## Expression traps\n\n- **A missing path resolves to empty, silently.** The run still says `success`, so no\n  `try/catch` or `|| {}` guard is needed. When a value comes out blank, check the real\n  shape with `cargo-ai orchestration run get <run-uuid>` → `runContext.<slug>`.\n- **ISO date strings arrive as `Date` objects.** `String(nodes.start.seen_at)` gives\n  `\"Tue Sep 01 2026 …\"`, so a regex or `.slice(0, 10)` on it quietly misses. Normalize\n  first: `v instanceof Date ? v.toISOString() : String(v || \"\")`.\n- **Test before deploying.** It's free and runs nothing:\n  `cargo-ai expression eval evaluate --expression '{\"kind\":\"templateExpression\",\"expression\":\"{{…}}\",\"instructTo\":\"none\",\"fromRecipe\":false}' --variables '{\"nodes\":{…}}'`.\n\nArchive v1.12.1: 18 files, 67906 bytes\n\nFiles: references/examples/actions.md (14007b), references/examples/agents.md (6789b), references/examples/plays.md (9632b), references/examples/queries.md (4459b), references/examples/segments.md (9523b), references/examples/templates.md (7581b), references/examples/tools.md (13771b), references/filter-syntax.md (9458b), references/node-diagram.md (11492b), references/node-selection.md (2659b), references/nodes.md (40708b), references/polling.md (7071b), references/response-shapes.md (16080b), references/troubleshooting.md (17220b), skill-card.md (3107b), skill-metadata.json (2162b), SKILL.md (31479b), _meta.json (139b)\n\nFile v1.12.1:SKILL.md\n\n---\nname: cargo-orchestration\ndescription: \"Make Cargo actually run something, or show what it would run — execute one connector action, run a multi-step workflow, trigger a batch across a whole segment or model, message an AI agent, build or edit a node graph, draw a workflow, tool or play as a diagram, and query the runtime tables (runs, batches, spans, records) with SQL. Triggers: \\\"run this on all my contacts\\\", \\\"execute the action\\\", \\\"kick off a batch\\\", \\\"build a workflow\\\", \\\"schedule a play\\\", \\\"make it run every morning\\\", \\\"ask the agent\\\", \\\"show me the workflow\\\", \\\"what does this tool do\\\", \\\"visualize this play\\\", \\\"draw the graph\\\", \\\"explain this workflow\\\", \\\"how many runs failed today\\\", \\\"what is the output schema for this action\\\", \\\"add a step that\\\". Skip when: explaining why a run misbehaved — use cargo-diagnostics; downloading result files — use cargo-analytics; committing the workflow as code — use cargo-project.\"\nversion: \"1.12.1\"\ncompatibility: Requires @cargo-ai/cli (npm). Sign in or create an account with `cargo-ai login --email` (emailed code, no browser), `--oauth`, or an API token\nhomepage: https://github.com/getcargohq/cargo-skills\nmetadata:\n  author: getcargo\n  openclaw:\n    requires:\n      bins:\n        - cargo-ai\n    install:\n      - kind: node\n        package: \"@cargo-ai/cli@latest\"\n        bins:\n          - cargo-ai\n    homepage: https://github.com/getcargohq/cargo-skills\n---\n\n# Cargo CLI — Orchestration\n\nRuntime operations for the Cargo platform.\n\n**What do you want to run?**\n\n```\nNeed to run something?\n├── Don't know the action yet    → action list <keywords>\n├── One action, one record       → action execute\n├── One action, many records     → action execute-batch\n├── Multiple actions chained\n│   ├── One-off / ad-hoc         → run create --nodes (one record)\n│   │                              batch create --nodes (many records)\n│   └── Reusable workflow        → build a tool, then run create --workflow-uuid\n│                                  or batch create --workflow-uuid\n├── Conversational AI agent      → message create\n└── Testing ONE node of a\n    workflow you're building     → node execute (debug only — see below)\n```\n\n> **Fanning out across many records (`action execute-batch`, `batch create`)? Sample first.** Run 10–20 records, report the observed cost and hit-rate, then ask the user to approve the full enrollment — quoting the **record count** and the **credit estimate**. See [Create a batch → the sample gate](#the-sample-gate).\n\n> **Every node execution costs 0.01 credits — 1 credit per 100 — whatever the node is.**\n> `branch`, `filter`, `switch`, `variables` and the rest carry no provider price, but\n> they are not free: the charge is per *execution*, so a graph's cost has two terms,\n> `(provider cost × records) + (nodes × records ÷ 100)`. On step-heavy, action-light\n> graphs the second term dominates. It shows up in **no** per-node field — not\n> `executions[].creditsUsedCount`, not `spans.execution_credits_used_count` — only in\n> `billing usage get-metrics --unit orchestration.executions`. Quote both terms in the\n> approval message ([`../cargo-gtm/references/cost-discipline.md`](../cargo-gtm/references/cost-discipline.md) §1).\n\n> **Find the action before you hand-write the JSON.** `cargo-ai orchestration\n> action list <keywords>` searches the integration catalog, Cargo native actions,\n> workspace tools, and agents in one call — free, runs nothing — and each result\n> carries a ready-to-paste `action` object (with `connectorUuid` already filled\n> in), the action's **credit costs**, and its autocomplete slugs. Narrow with\n> `--kind connector|native|tool|agent`, `--integration-slug <slug>`, `--limit`\n> (default 20, max 50). `unknown command` means the CLI predates it — refresh.\n\n> **`action execute`, not `node execute`, is the default for running something.**\n> `node execute` is a **debug** surface for a node that already lives in a workflow:\n> it requires `--workflow-uuid`, `--release-uuid`, `--node`, `--computed-config`\n> **and** `--context` (all five, enforced client-side), and it bills like any live\n> call. If you just want an operation's output — enrich a domain, call a connector\n> action, invoke a tool or agent — use `action execute` / `action execute-batch`\n> with a small `--action` + `--data` payload. Only reach for `node execute` when\n> verifying one node's behavior before running the full graph.\n\n> **Terminology:** An orchestration **tool** is a saved on-demand workflow (listed via `tool list`). An **action** is a single operation you execute without building a workflow — it can embed a saved orchestration tool (`kind: \"tool\"`), call a third-party connector (`kind: \"connector\"`), invoke an AI agent (`kind: \"agent\"`), or run a built-in platform operation (`kind: \"native\"`).\n\n> **Composing a node graph? Prefer built-in actions + expressions.** Use the\n> actions Cargo already provides plus template expressions; avoid `python`,\n> `script` (JS), and raw HTTP nodes unless you truly have no alternative. Reshape\n> data → `variables`; call an LLM and get parsed JSON → native `agent` node; call an\n> API → the integration's dedicated **connector action**; route → `branch`/`filter`/`switch`.\n> See **`references/node-selection.md`**.\n\n> **Show the graph, don't describe it.** Before deploying a draft, and whenever\n> the user asks what a workflow or play does, draw it:\n> `cargo-ai orchestration node diagram --workflow-uuid <uuid> --format ascii --raw`\n> (free, runs nothing; `--format` needs CLI ≥ 1.0.56, the command itself ≥ 1.0.54).\n> Routing, fallback edges, and which steps bill are what the user is actually\n> approving, and prose flattens all three. **Pick the format by where the output\n> goes:** `ascii` renders a picture a person can read in a terminal or a chat\n> reply; `mermaid` (the default) is source code, correct only when you are\n> pasting into a PR, a doc, or a page that renders it. Sources, the ASCII legend,\n> cost marking, and the duplicate-slug footgun: **`references/node-diagram.md`**.\n\n**References:**\n\n> `references/examples/actions.md` — action execute and execute-batch examples\n> `references/examples/tools.md` — tool (on-demand workflow) examples\n> `references/examples/plays.md` — play (segment-driven automation) examples\n> `references/examples/agents.md` — AI agent chat examples\n> `references/examples/templates.md` — pre-built workflow templates\n> `references/examples/queries.md` — `orchestration query execute` (ClickHouse: runs/batches/spans/records) SQL examples. For `storage query` (workspace storage), see the `cargo-storage` skill.\n> `references/examples/segments.md` — segment fetch and filter examples\n> `references/nodes.md` — full node creation guide (kinds, native actions, expressions, validation, routing)\n> `references/node-diagram.md` — **draw a node graph as a Mermaid flowchart** (`node diagram`): every source (workflow / draft / release / run / raw nodes), marking paid nodes, highlighting a failing node, and why diagrams key on `uuid` rather than `slug`\n> `references/node-selection.md` — **how to pick the right node and avoid unnecessary `python` nodes** (decision table, native LLM `agent` node, template-expression limits, the silent-undefined footgun, inspecting node data via `runContext`, Pyodide sandbox limits, what survives a `delay`, group result access)\n> `references/filter-syntax.md` — complete filter condition reference\n> `references/polling.md` — async polling patterns, error handling, retry strategies\n> `references/response-shapes.md` — full JSON response structures\n> `references/troubleshooting.md` — common errors, plus a \"Debugging a workflow run\" section for runs that succeed but produce wrong output (wrong-branch routing, empty downstream values)\n\n> **Diagnosing after the fact?** For the ordered forensic runbooks built on these surfaces — trace one run, sweep a batch for errors grouped by root cause, profile a play's credit spend — load the [`cargo-diagnostics`](../cargo-diagnostics/SKILL.md) skill.\n\n## Bootstrap\n\nAlready signed in (`cargo-ai whoami` returns a workspace)? Skip to the next section.\n\n```bash\nnpm install -g @cargo-ai/cli            # no global install? prefix every command with `npx @cargo-ai/cli`\ncargo-ai login --email you@company.com  # emailed code, no browser; creates the account on first use\n                                        # alternatives: --oauth (browser) · --token <api-token> (CI)\ncargo-ai whoami                         # confirm the active workspace before any write\n```\n\nEvery command prints JSON to stdout; failures exit non-zero with `{\"errorMessage\": \"...\"}`. Anything that creates a run or a batch is async — pass `--wait-until-finished` or poll the matching `get`. When the full skill bundle is installed, [`../cargo/references/prerequisites.md`](../cargo/references/prerequisites.md) adds the CLI version pin, token scopes, and the admin-only surface.\n\n## Discover resources first\n\nMost commands require UUIDs. Always discover them before acting.\n\n```bash\ncargo-ai orchestration action list <query>  # actions across connectors, native, tools, agents (+ credits)\ncargo-ai orchestration play list            # all plays (name, workflowUuid, modelUuid, segmentUuid)\ncargo-ai orchestration tool list            # all tools (name, workflowUuid, description)\ncargo-ai orchestration workflow list        # all workflows (uuid only — no name)\ncargo-ai orchestration template list       # all workflow templates (slug, name, kind)\ncargo-ai ai agent list                     # all agents (uuid, name)\ncargo-ai ai template list                  # all AI agent templates (slug, name, languageModelSlug)\ncargo-ai storage model list                # all models (uuid, name, slug, columns)\ncargo-ai storage dataset list              # all datasets\ncargo-ai segmentation segment list         # all segments (uuid, name, modelUuid)\ncargo-ai connection connector list         # all connectors\n```\n\n**Plays vs tools:** Both are backed by a workflow. A **play** is a segment-driven automation — it reacts to data changes in a segment (records added, updated, removed). A **tool** is an on-demand workflow — triggered manually, via API, or on a cron schedule. Workflows don't have a `name` field; use `play list` or `tool list` to find names and extract the `workflowUuid`.\n\n**Retrieve in the UI:** plays live at `app.getcargo.io/workspaces/<WORKSPACE_UUID>/plays/<PLAY_UUID>` and tools at `app.getcargo.io/workspaces/<WORKSPACE_UUID>/tools/<TOOL_UUID>`. Get `<WORKSPACE_UUID>` from `cargo-ai whoami` under `workspace.uuid`.\n\n**Designing a new tool or play?** Check templates first — they are pre-built node graphs for common automation patterns (enrichment pipelines, CRM syncs, lead scoring) and are an excellent starting point. List templates with `cargo-ai orchestration template list` and inspect a specific one with `cargo-ai orchestration template get <slug>`. Templates are tagged by `kind` so you can find ones suited for tools (`\"kind\":\"tool\"`) or plays (`\"kind\":\"play\"`) right away. See `references/examples/templates.md` for the full guide.\n\n**Compatibility rules:**\n\n- **`run create`** — only works with **tool** workflows (or no `workflowUuid`). Play workflows return `playNotCompatible`.\n- **`batch create`** — allowed data kinds depend on the workflow type:\n  - **Play** workflows: `filter`, `recordIds`, `segment`, `change`. Trigger a play with `filter`; `segment` takes a standalone segment only, never the `segmentUuid` from `play list`.\n  - **Tool** workflows (or no `workflowUuid`): `file`, `records`\n\n## Quick reference\n\n```bash\n# Find an action (free — no run, no credits)\ncargo-ai orchestration action list enrich company\ncargo-ai orchestration action list send --kind connector --integration-slug slack\n\n# Single actions\ncargo-ai orchestration action execute --action '{\"kind\":\"tool\",\"toolUuid\":\"<uuid>\"}' --data '{\"domain\":\"acme.com\"}'\ncargo-ai orchestration action execute-batch --action '{\"kind\":\"connector\",\"integrationSlug\":\"clearbit\",\"actionSlug\":\"enrichCompany\"}' --records '[{...},{...}]'\ncargo-ai orchestration action get-output-schema --action '{\"kind\":\"connector\",\"integrationSlug\":\"clearbit\",\"actionSlug\":\"enrichCompany\"}' # → {\"schema\": <JSON Schema>} without executing\n\n# Workflows (chain multiple actions)\ncargo-ai orchestration run create --workflow-uuid <uuid> --data '{\"company\":\"Acme\",\"domain\":\"acme.com\"}'\ncargo-ai orchestration run create --data '{\"domain\":\"acme.com\"}' --nodes '[...]'\ncargo-ai orchestration batch create --workflow-uuid <uuid> --data '{\"kind\":\"filter\",\"modelUuid\":\"...\",\"filter\":{\"conjonction\":\"and\",\"groups\":[]}}'\n\n# AI agents\ncargo-ai ai message create --chat-uuid <uuid> --parts '[{\"type\":\"text\",\"text\":\"...\"}]'\n\n# Data\ncargo-ai orchestration query execute \"SELECT count() FROM runs WHERE status='error'\" # ClickHouse: spans, runs, batches, records\ncargo-ai segmentation segment fetch --model-uuid <uuid> --filter '{\"conjonction\":\"and\",\"groups\":[]}' --fetching-limit 100\n# For SQL against workspace storage (Companies, Contacts, …), see the cargo-storage skill: `storage query execute`\n```\n\n## Polling async operations\n\nAll operations are asynchronous. Either poll until terminal state, or pass `--wait-until-finished` to block.\n\n`action execute` returns a run. `action execute-batch` returns a batch. They poll the same way:\n\n| Result type     | Poll command         | Interval | Done when                                      |\n| --------------- | -------------------- | -------- | ---------------------------------------------- |\n| Run             | `run get <uuid>`     | 2s       | `status` is `success`, `error`, or `cancelled` |\n| Batch           | `batch get <uuid>`   | 5s       | `status` is `success`, `error`, or `cancelled` |\n| Agent message   | `message get <uuid>` | 2s       | `status` is `success` or `error`               |\n\nFor long-running batches (1000+ records), increase the interval to 10-15s after the first minute.\n\n## Execute actions\n\nRun a single action — no workflow or node graph needed.\n\n### Find it first — `action list`\n\n```bash\ncargo-ai orchestration action list enrich company          # all kinds\ncargo-ai orchestration action list --kind tool             # this workspace's tools\ncargo-ai orchestration action list send --kind connector --integration-slug slack\n```\n\nFree, executes nothing. All query terms must match (AND); a hit on the action\nslug or name ranks above the integration, which ranks above the description.\nReturns `{query, totalMatches, results[]}` where each result carries `name`,\n`description`, `score`, an `action` object to paste straight into `execute` /\n`execute-batch` / `get-output-schema`, the workspace `connectors` for that\nintegration, `credits` (the cost table, when the action bills), and\n`autocompletes` (config fields that need a picked id — a HubSpot object type, a\nSlack channel). Defaults to 20 results, max 50.\n\n```bash\n# One action, one record → returns a run\ncargo-ai orchestration action execute \\\n  --action '{\"kind\":\"connector\",\"integrationSlug\":\"clearbit\",\"actionSlug\":\"enrichCompany\"}' \\\n  --data '{\"domain\":\"acme.com\"}' \\\n  --wait-until-finished\n\n# One action, many records → returns a batch\ncargo-ai orchestration action execute-batch \\\n  --action '{\"kind\":\"tool\",\"toolUuid\":\"<tool-uuid>\"}' \\\n  --records '[{\"domain\":\"acme.com\"},{\"domain\":\"globex.com\"}]' \\\n  --wait-until-finished\n```\n\nAction kinds: `tool`, `connector`, `agent`, `native`. See `references/examples/actions.md` for all action kinds, parameters, retry config, response shapes, and end-to-end examples.\n\n> **A top-level action has no `config` — omit it.** Inputs belong in `--data` /\n> `--records`; `execute` and `execute-batch` take the action with no `config` key\n> at all, which is exactly what `action list` hands back, so its result pastes\n> straight in. (`\"config\": {}` is still accepted there, harmlessly.)\n>\n> **`get-output-schema` takes the same pair.** The action object from\n> `action list`, plus `--data` when the action's output depends on its inputs —\n> a HubSpot object type or a target sheet decides which fields come back\n> (`--data` needs **CLI ≥ 1.0.67**; the config-less `--action` works from 1.0.66).\n> Workflow **nodes**, an alert's `--actions`, a play's `healthAlertActions`, and\n> an agent's or MCP server's `--actions` are where `config` still lives; that is\n> a node's configuration, not an action's input.\n>\n> **Inputs put in `config` are now dropped, not rejected.** The guard that used to\n> answer `A top-level action does not use action.config…` is gone, so the action\n> runs with *no input* — you get a provider-side missing-field error or an empty\n> result that never mentions `config`. Check this first when a call comes back\n> empty for no visible reason.\n\n> **`execute-batch` bills per record.** Pass a 10–20 record slice of `--records` first, report the observed per-record cost and hit-rate, and get approval (with the full record count and credit estimate) before sending the rest — same gate as [Create a batch](#the-sample-gate).\n\n### Resolve an action's output schema (without executing)\n\n**Never guess what an action outputs.** Two free sources — no run, no credits:\n\n1. **Connector actions:** the integration catalog carries the output schema inline — `integration get <slug>` (and `integration list`) return `actions.<actionSlug>.output.schema` next to the input `config.jsonSchema`. Not every action declares one.\n2. **Any action kind** (`tool` / `connector` / `agent` / `native`) — resolve it with the same `--action` object as `action execute`:\n\n```bash\ncargo-ai orchestration action get-output-schema \\\n  --action '{\"kind\":\"connector\",\"integrati\n\nArchive v1.12.0: 18 files, 67778 bytes\n\nFiles: references/examples/actions.md (13959b), references/examples/agents.md (6789b), references/examples/plays.md (9632b), references/examples/queries.md (4459b), references/examples/segments.md (9523b), references/examples/templates.md (7581b), references/examples/tools.md (13771b), references/filter-syntax.md (9458b), references/node-diagram.md (11492b), references/node-selection.md (2659b), references/nodes.md (40662b), references/polling.md (7010b), references/response-shapes.md (16080b), references/troubleshooting.md (17220b), skill-card.md (3009b), skill-metadata.json (2162b), SKILL.md (31479b), _meta.json (139b)\n\nArchive v1.11.3: 18 files, 67647 bytes\n\nFiles: references/examples/actions.md (13959b), references/examples/agents.md (6789b), references/examples/plays.md (9632b), references/examples/queries.md (4459b), references/examples/segments.md (9523b), references/examples/templates.md (7581b), references/examples/tools.md (13771b), references/filter-syntax.md (9458b), references/node-diagram.md (11492b), references/node-selection.md (2659b), references/nodes.md (40662b), references/polling.md (7010b), references/response-shapes.md (16080b), references/troubleshooting.md (17220b), skill-card.md (3111b), skill-metadata.json (2162b), SKILL.md (30955b), _meta.json (139b)\n\nArchive v1.11.2: 18 files, 67679 bytes\n\nFiles: references/examples/actions.md (13959b), references/examples/agents.md (6789b), references/examples/plays.md (9632b), references/examples/queries.md (4459b), references/examples/segments.md (9523b), references/examples/templates.md (7581b), references/examples/tools.md (13771b), references/filter-syntax.md (9458b), references/node-diagram.md (11488b), references/node-selection.md (2659b), references/nodes.md (40662b), references/polling.md (7010b), references/response-shapes.md (16080b), references/troubleshooting.md (17220b), skill-card.md (3307b), skill-metadata.json (2162b), SKILL.md (30951b), _meta.json (139b)\n\nArchive v1.11.1: 18 files, 67456 bytes\n\nFiles: references/examples/actions.md (13959b), references/examples/agents.md (6789b), references/examples/plays.md (9632b), references/examples/queries.md (4459b), references/examples/segments.md (9523b), references/examples/templates.md (7581b), references/examples/tools.md (13771b), references/filter-syntax.md (9458b), references/node-diagram.md (11488b), references/node-selection.md (2522b), references/nodes.md (40474b), references/polling.md (7010b), references/response-shapes.md (16080b), references/troubleshooting.md (17220b), skill-card.md (3083b), skill-metadata.json (2162b), SKILL.md (30951b), _meta.json (139b)\n\nArchive v1.11.0: 18 files, 67676 bytes\n\nFiles: references/examples/actions.md (13958b), references/examples/agents.md (6789b), references/examples/plays.md (9632b), references/examples/queries.md (4459b), references/examples/segments.md (9523b), references/examples/templates.md (7581b), references/examples/tools.md (13771b), references/filter-syntax.md (9458b), references/node-diagram.md (11488b), references/node-selection.md (2522b), references/nodes.md (40474b), references/polling.md (7010b), references/response-shapes.md (16080b), references/troubleshooting.md (17220b), skill-card.md (3557b), skill-metadata.json (2162b), SKILL.md (30951b), _meta.json (139b)\n\nArchive v1.9.0: 18 files, 66458 bytes\n\nFiles: references/examples/actions.md (13283b), references/examples/agents.md (6789b), references/examples/plays.md (9632b), references/examples/queries.md (4459b), references/examples/segments.md (9523b), references/examples/templates.md (7581b), references/examples/tools.md (13771b), references/filter-syntax.md (9458b), references/node-diagram.md (11488b), references/node-selection.md (2522b), references/nodes.md (40474b), references/polling.md (7010b), references/response-shapes.md (16080b), references/troubleshooting.md (16203b), skill-card.md (3150b), skill-metadata.json (2161b), SKILL.md (29885b), _meta.json (138b)\n\nArchive v1.8.0: 18 files, 64132 bytes\n\nFiles: references/examples/actions.md (10213b), references/examples/agents.md (6789b), references/examples/plays.md (9632b), references/examples/queries.md (4459b), references/examples/segments.md (9523b), references/examples/templates.md (7581b), references/examples/tools.md (13771b), references/filter-syntax.md (9458b), references/node-diagram.md (11488b), references/node-selection.md (2522b), references/nodes.md (40474b), references/polling.md (7010b), references/response-shapes.md (16080b), references/troubleshooting.md (16203b), skill-card.md (3343b), skill-metadata.json (2161b), SKILL.md (27016b), _meta.json (138b)\n\nArchive v1.7.0: 18 files, 62459 bytes\n\nFiles: references/examples/actions.md (10213b), references/examples/agents.md (6789b), references/examples/plays.md (9632b), references/examples/queries.md (4459b), references/examples/segments.md (9523b), references/examples/templates.md (7581b), references/examples/tools.md (13771b), references/filter-syntax.md (9458b), references/node-diagram.md (7831b), references/node-selection.md (2522b), references/nodes.md (40474b), references/polling.md (7010b), references/response-shapes.md (16080b), references/troubleshooting.md (16203b), skill-card.md (2869b), skill-metadata.json (2171b), SKILL.md (26475b), _meta.json (138b)","readmeExcerpt":"Skill: cargo-orchestration Owner: cargo-ai Summary: Make Cargo actually run something, or show what it would run — execute one connector action, run a multi-step workflow, trigger a batch across a whole segment or model, message an AI agent, build or edit a node graph, draw a workflow, tool or play as a diagram, and query the runtime tables (runs, batches, spans, records) with SQL. Triggers: \"run this on all my conta","codeSnippets":[],"executableExamples":[{"language":"text","snippet":"Need to run something?\n├── Don't know the action yet    → action list <keywords>\n├── One action, one record       → action execute\n├── One action, many records     → action execute-batch\n├── Multiple actions chained\n│   ├── One-off / ad-hoc         → run create --nodes (one record)\n│   │                              batch create --nodes (many records)\n│   └── Reusable workflow        → build a tool, then run create --workflow-uuid\n│                                  or batch create --workflow-uuid\n├── Conversational AI agent      → message create\n└── Testing ONE node of a\n    workflow you're building     → node execute (debug only — see below)"},{"language":"bash","snippet":"npm install -g @cargo-ai/cli            # no global install? prefix every command with `npx @cargo-ai/cli`\ncargo-ai login --email you@company.com  # emailed code, no browser; creates the account on first use\n                                        # alternatives: --oauth (browser) · --token <api-token> (CI)\ncargo-ai whoami                         # confirm the active workspace before any write"},{"language":"bash","snippet":"cargo-ai orchestration action list <query>  # actions across connectors, native, tools, agents (+ credits)\ncargo-ai orchestration play list            # all plays (name, workflowUuid, modelUuid, segmentUuid)\ncargo-ai orchestration tool list            # all tools (name, workflowUuid, description)\ncargo-ai orchestration workflow list        # all workflows (uuid only — no name)\ncargo-ai orchestration template list       # all workflow templates (slug, name, kind)\ncargo-ai ai agent list                     # all agents (uuid, name)\ncargo-ai ai template list                  # all AI agent templates (slug, name, languageModelSlug)\ncargo-ai storage model list                # all models (uuid, name, slug, columns)\ncargo-ai storage dataset list              # all datasets\ncargo-ai segmentation segment list         # all segments (uuid, name, modelUuid)\ncargo-ai connection connector list         # all connectors"},{"language":"bash","snippet":"# Find an action (free — no run, no credits)\ncargo-ai orchestration action list enrich company\ncargo-ai orchestration action list send --kind connector --integration-slug slack\n\n# Single actions\ncargo-ai orchestration action execute --action '{\"kind\":\"tool\",\"toolUuid\":\"<uuid>\"}' --data '{\"domain\":\"acme.com\"}'\ncargo-ai orchestration action execute-batch --action '{\"kind\":\"connector\",\"integrationSlug\":\"clearbit\",\"actionSlug\":\"enrichCompany\"}' --records '[{...},{...}]'\ncargo-ai orchestration action get-output-schema --action '{\"kind\":\"connector\",\"integrationSlug\":\"clearbit\",\"actionSlug\":\"enrichCompany\"}' # → {\"schema\": <JSON Schema>} without executing\n\n# Workflows (chain multiple actions)\ncargo-ai orchestration run create --workflow-uuid <uuid> --data '{\"company\":\"Acme\",\"domain\":\"acme.com\"}'\ncargo-ai orchestration run create --data '{\"domain\":\"acme.com\"}' --nodes '[...]'\ncargo-ai orchestration batch create --workflow-uuid <uuid> --data '{\"kind\":\"filter\",\"modelUuid\":\"...\",\"filter\":{\"conjonction\":\"and\",\"groups\":[]}}'\n\n# AI agents\ncargo-ai ai message create --chat-uuid <uuid> --parts '[{\"type\":\"text\",\"text\":\"...\"}]'\n\n# Data\ncargo-ai orchestration query execute \"SELECT count() FROM runs WHERE status='error'\" # ClickHouse: spans, runs, batches, records\ncargo-ai segmentation segment fetch --model-uuid <uuid> --filter '{\"conjonction\":\"and\",\"groups\":[]}' --fetching-limit 100\n# For SQL against workspace storage (Companies, Contacts, …), see the cargo-storage skill: `storage query execute`"},{"language":"bash","snippet":"cargo-ai orchestration action list enrich company          # all kinds\ncargo-ai orchestration action list --kind tool             # this workspace's tools\ncargo-ai orchestration action list send --kind connector --integration-slug slack"},{"language":"bash","snippet":"# One action, one record → returns a run\ncargo-ai orchestration action execute \\\n  --action '{\"kind\":\"connector\",\"integrationSlug\":\"clearbit\",\"actionSlug\":\"enrichCompany\"}' \\\n  --data '{\"domain\":\"acme.com\"}' \\\n  --wait-until-finished\n\n# One action, many records → returns a batch\ncargo-ai orchestration action execute-batch \\\n  --action '{\"kind\":\"tool\",\"toolUuid\":\"<tool-uuid>\"}' \\\n  --records '[{\"domain\":\"acme.com\"},{\"domain\":\"globex.com\"}]' \\\n  --wait-until-finished"}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: cargo-orchestration\ndescription: \"Make Cargo actually run something, or show what it would run — execute one connector action, run a multi-step workflow, trigger a batch across a whole segment or model, message an AI agent, build or edit a node graph, draw a workflow, tool or play as a diagram, and query the runtime tables (runs, batches, spans, records) with SQL. Triggers: \\\"run this on all my contacts\\\", \\\"execute the action\\\", \\\"kick off a batch\\\", \\\"build a workflow\\\", \\\"schedule a play\\\", \\\"make it run every morning\\\", \\\"ask the agent\\\", \\\"show me the workflow\\\", \\\"what does this tool do\\\", \\\"visualize this play\\\", \\\"draw the graph\\\", \\\"explain this workflow\\\", \\\"how many runs failed today\\\", \\\"what is the output schema for this action\\\", \\\"add a step that\\\". Skip when: explaining why a run misbehaved — use cargo-diagnostics; downloading result files — use cargo-analytics; committing the workflow as code — use cargo-project.\"\nversion: \"1.13.0\"\ncompatibility: Requires @cargo-ai/cli (npm). Sign in or create an account with `cargo-ai login --email` (emailed code, no browser), `--oauth`, or an API token\nhomepage: https://github.com/getcargohq/cargo-skills\nmetadata:\n  author: getcargo\n  openclaw:\n    requires:\n      bins:\n        - cargo-ai\n    install:\n      - kind: node\n        package: \"@cargo-ai/cli@latest\"\n        bins:\n          - cargo-ai\n    homepage: https://github.com/getcargohq/cargo-skills\n---\n\n# Cargo CLI — Orchestration\n\nRuntime operations for the Cargo platform.\n\n**What do you want to run?**\n\n```\nNeed to run something?\n├── Don't know the action yet    → action list <keywords>\n├── One action, one record       → action execute\n├── One action, many records     → action execute-batch\n├── Multiple actions chained\n│   ├── One-off / ad-hoc         → run create --nodes (one record)\n│   │                              batch create --nodes (many records)\n│   └── Reusable workflow        → build a tool, then run create --workflow-uuid\n│                                  or batch create --workflow-uuid\n├── Conversational AI agent      → message create\n└── Testing ONE node of a\n    workflow you're building     → node execute (debug only — see below)\n```\n\n> **Fanning out across many records (`action execute-batch`, `batch create`)? Sample first.** Run 10–20 records, report the observed cost and hit-rate, then ask the user to approve the full enrollment — quoting the **record count** and the **credit estimate**. See [Create a batch → the sample gate](#the-sample-gate).\n\n> **Every node execution costs 0.01 credits — 1 credit per 100 — whatever the node is.**\n> `branch`, `filter`, `switch`, `variables` and the rest carry no provider price, but\n> they are not free: the charge is per *execution*, so a graph's cost has two terms,\n> `(provider cost × records) + (nodes × records ÷ 100)`. On step-heavy, action-light\n> graphs the second term dominates. It shows up in **no** per-node field — not\n> `executions[].creditsUsedCount`, not `spans.executi"},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn7by8t6yt9yghbxtxz6hv0bts87k6bq\",\n  \"slug\": \"cargo-orchestration\",\n  \"version\": \"1.13.0\",\n  \"publishedAt\": 1790278699916\n}"},{"path":"references/examples/actions.md","content":"# Action examples\n\n## What is an action?\n\nAn **action** is a single operation you can execute without building a workflow. Use `action execute` for one record, or `action execute-batch` for multiple records.\n\nActions come in four kinds:\n\n| Kind        | What it does                         | Required fields                                |\n| ----------- | ------------------------------------ | ---------------------------------------------- |\n| `tool`      | Run an orchestration tool            | `toolUuid` or `templateSlug` or `releaseUuid`  |\n| `connector` | Call a third-party service           | `integrationSlug` + `actionSlug`               |\n| `agent`     | Invoke an AI agent                   | `agentUuid` or `templateSlug` or `releaseUuid` |\n| `native`    | Run a built-in platform action       | `actionSlug`                                   |\n\n`config` is where a **node** keeps its configuration; a top-level action has none — its inputs go in `--data` (single) or `--records` (batch). Omit the key on `execute` / `execute-batch`: that is the shape `action list` returns, and `\"config\": {}` is merely tolerated there.\n\n`get-output-schema` takes the same pair — the action, plus `--data` when the output depends on the inputs (a HubSpot object type, a target sheet). Nodes, alert `--actions`, play `healthAlertActions`, and agent / MCP-server `--actions` are where `config` still belongs: it is a node's configuration, never an action's input.\n\n> **When to use actions vs workflows:** Actions are for running a **single operation** without building a workflow graph. If you need to **chain multiple operations** together (enrichment → scoring → CRM push), use `run create --nodes` or `batch create --nodes` instead. See `tools.md` for workflow examples.\n\n---\n\n## Find an action — `action list`\n\nFree: no run, no credits. Searches the integration catalog, Cargo native actions, this workspace's tools, and its agents in one call.\n\n```bash\ncargo-ai orchestration action list enrich company\ncargo-ai orchestration action list --kind tool\ncargo-ai orchestration action list send --kind connector --integration-slug slack\ncargo-ai orchestration action list verify email --limit 5\n```\n\n| Flag | Meaning |\n| --- | --- |\n| `[query...]` | Space-separated keywords. **All** terms must match (AND), against action slug, name, description, and integration. Omit to browse. |\n| `--kind` | One of `connector`, `native`, `tool`, `agent`. `tool` and `agent` need a signed-in workspace. |\n| `--integration-slug` | Restrict connector results to one integration. |\n| `--limit` | Default 20, max 50. |\n\nResponse:\n\n```json\n{\n  \"query\": \"enrich company\",\n  \"totalMatches\": 37,\n  \"results\": [\n    {\n      \"name\": \"Enrich company\",\n      \"description\": \"Return firmographics for a domain…\",\n      \"score\": 12,\n      \"action\": {\n        \"kind\": \"connector\",\n        \"integrationSlug\": \"aiArk\",\n        \"actionSlug\": \"enrichCompany\",\n        \"connectorUuid\": \"<uuid>\"\n      },\n      \"connectors\": [{ \"uuid\":"},{"path":"references/examples/agents.md","content":"# AI agent examples\n\n## Basic chat: ask a question and get a response\n\n```bash\n# 1. Find the right agent by name\ncargo-ai ai agent list\n# → Match by name, extract agent uuid\n\n# 2. Create a chat session\ncargo-ai ai chat create \\\n  --trigger '{\"type\":\"draft\"}' \\\n  --agent-uuid <agent-uuid> \\\n  --name \"Quick question\"\n# → Extract chat.uuid\n\n# 3. Send a message\ncargo-ai ai message create \\\n  --chat-uuid <chat-uuid> \\\n  --parts '[{\"type\":\"text\",\"text\":\"What is Acme Corp'\\''s employee count?\"}]'\n```\n\nMessage create response:\n\n```json\n{\n  \"userMessage\": { \"uuid\": \"user-msg-uuid\", \"status\": \"success\" },\n  \"assistantMessage\": {\n    \"uuid\": \"assistant-msg-uuid\",\n    \"status\": \"pending\",\n    \"parts\": []\n  }\n}\n```\n\n```bash\n# 4. Poll for the response (repeat every 2s)\ncargo-ai ai message get <assistant-msg-uuid>\n```\n\nPoll until `status` is `success` or `error`:\n\n```json\n{\n  \"message\": {\n    \"uuid\": \"assistant-msg-uuid\",\n    \"status\": \"success\",\n    \"parts\": [\n      { \"type\": \"text\", \"text\": \"Acme Corp has approximately 500 employees...\" }\n    ],\n    \"errorMessage\": null\n  }\n}\n```\n\nStatus values: `pending` → `generating` → `success` or `error`. On `error`, read `.message.errorMessage`.\n\n## Multi-turn conversation\n\n```bash\n# 1. Create a chat\ncargo-ai ai chat create \\\n  --trigger '{\"type\":\"draft\"}' \\\n  --agent-uuid <agent-uuid> \\\n  --name \"Lead research\"\n# → Extract chat.uuid\n\n# 2. First message\ncargo-ai ai message create \\\n  --chat-uuid <chat-uuid> \\\n  --parts '[{\"type\":\"text\",\"text\":\"Find the VP of Sales at Acme Corp\"}]'\n# → Poll assistantMessage.uuid until success\n\n# 3. Follow-up in the same chat (agent remembers context)\ncargo-ai ai message create \\\n  --chat-uuid <chat-uuid> \\\n  --parts '[{\"type\":\"text\",\"text\":\"Now find their email address\"}]'\n# → Poll the new assistantMessage.uuid\n\n# 4. Another follow-up\ncargo-ai ai message create \\\n  --chat-uuid <chat-uuid> \\\n  --parts '[{\"type\":\"text\",\"text\":\"Draft a cold outreach email to them\"}]'\n# → Poll again\n```\n\n## Reuse an existing chat session\n\n```bash\n# 1. List existing chats for an agent\ncargo-ai ai chat list --agent-uuid <agent-uuid> --limit 10\n# → Find a chat by name or pick the most recent one\n\n# 2. Send a message in the existing chat\ncargo-ai ai message create \\\n  --chat-uuid <existing-chat-uuid> \\\n  --parts '[{\"type\":\"text\",\"text\":\"Any updates on the Acme deal?\"}]'\n# → Poll for response\n```\n\n## Send a message with actions\n\nGive the agent access to specific actions for enrichment, CRM actions, etc.\n\n```bash\ncargo-ai ai message create \\\n  --chat-uuid <chat-uuid> \\\n  --parts '[{\"type\":\"text\",\"text\":\"Enrich this lead and add to Salesforce\"}]' \\\n  --actions '[{\"slug\":\"clearbit\",\"kind\":\"tool\",\"toolUuid\": \"<tool-uuid>\",\"config\":{}},{\"slug\":\"salesforce\",\"kind\":\"tool\",\"config\":{}}]'\n# → The agent can use these actions during its response\n```\n\n## Send a message with model resources\n\nGive the agent access to a data model to query.\n\n```bash\n# 1. Find the model UUID\ncargo-ai storage model list\n\n# 2. Send message with th"},{"path":"references/examples/plays.md","content":"# Play examples\n\n## What is a play?\n\nA **play** is a segment-driven automation. It is linked to a specific model and segment, and runs its workflow automatically when records in that segment change (are added, updated, or removed). Plays are the reactive side of Cargo — \"when this data changes, do that.\"\n\nKey properties of a play:\n\n- **`name`** — human-readable name (workflows themselves don't have names)\n- **`workflowUuid`** — the underlying workflow that executes\n- **`modelUuid`** — the data model the play operates on\n- **`segmentUuid`** — the segment that triggers runs\n- **`changeKinds`** — which segment changes trigger a run (`added`, `updated`, `removed`)\n- **`schedule`** — optional cron schedule for periodic re-evaluation\n- **`isEnabled`** — whether the play is active\n\n## List all plays\n\n```bash\ncargo-ai orchestration play list\n```\n\nResponse:\n\n```json\n{\n  \"plays\": [\n    {\n      \"uuid\": \"play-uuid\",\n      \"name\": \"Enrich new companies\",\n      \"workflowUuid\": \"workflow-uuid\",\n      \"modelUuid\": \"model-uuid\",\n      \"segmentUuid\": \"segment-uuid\",\n      \"changeKinds\": [\"added\", \"updated\"],\n      \"isEnabled\": true,\n      \"schedule\": null,\n      \"description\": \"Enriches companies when they enter the segment\"\n    }\n  ]\n}\n```\n\n## Find a play's workflow UUID\n\nPlays have names — workflows don't. Use the play to find the right workflow and model.\n\n```bash\n# 1. Find the play\ncargo-ai orchestration play list\n# → Extract play.workflowUuid and play.modelUuid\n\n# 2. Create a batch over the play's model (empty filter = all rows)\ncargo-ai orchestration batch create \\\n  --workflow-uuid <play.workflowUuid> \\\n  --data '{\"kind\":\"filter\",\"modelUuid\":\"<play.modelUuid>\",\"filter\":{\"conjonction\":\"and\",\"groups\":[]}}'\n\n# 3. Poll until done\ncargo-ai orchestration batch get <batch-uuid>\n\n# Or block until finished — returns the final batch result without a separate poll step\ncargo-ai orchestration batch create \\\n  --workflow-uuid <play.workflowUuid> \\\n  --data '{\"kind\":\"filter\",\"modelUuid\":\"<play.modelUuid>\",\"filter\":{\"conjonction\":\"and\",\"groups\":[]}}' \\\n  --wait-until-finished\n```\n\nAn empty filter (`{\"conjonction\":\"and\",\"groups\":[]}`) enrols every row in the model;\nadd conditions to narrow it — see `references/filter-syntax.md` for the full shape.\n\n> **Never pass `play.segmentUuid` to `{\"kind\":\"segment\"}`.** That UUID points at\n> the play's internally generated segment, whose record count is never\n> populated — the batch is rejected (`segmentLinkedToPlay`, or `noRecords` on\n> older backends) no matter how many rows the model holds. `{\"kind\":\"segment\"}`\n> is only for standalone segments from `segmentation segment list`.\n\n## Update a play's workflow\n\nTo change what a play does, update its draft release and deploy it. The draft release holds the unpublished node graph for the workflow.\n\n> **Looking for inspiration?** Before designing a node graph from scratch, check `cargo-ai orchestration template list` for pre-built patterns (lead scoring, enrichment pipelines, CRM syncs). "}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":null,"editorialQuality":{"score":100,"threshold":65,"status":"thin","wordCount":2102,"uniquenessScore":37,"reasons":["uniqueness-below-45"]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-09T17:31:49.426Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-10-09T17:31:49.426Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-10T07:41:55.802Z","emptyReason":null},"items":[{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-10-09T19:11:12.944Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}