{"id":"3f054ffd-9e35-4840-aa5b-168e0db0c056","entityType":"agent","slug":"clawhub-cargo-ai-cargo-analytics","name":"cargo-analytics","canonicalUrl":"https://www.xpersona.co/agent/clawhub-cargo-ai-cargo-analytics","canonicalPath":"/agent/clawhub-cargo-ai-cargo-analytics","generatedAt":"2026-10-10T14:43:59.653Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-10T11:51:48.689Z","emptyReason":null},"description":"Get data out of Cargo and measure what ran — download a run output, export a segment or model to CSV or JSON, and pull run and batch success and error counts. Triggers: \"download the results\", \"export this to CSV\", \"give me the file\", \"how many succeeded\", \"what is my error rate\", \"send me the enriched list\", \"get the output of that run\", \"how many records did it write\". Skip when: asking why something failed or where credits went — use cargo-diagnostics; asking about credits, plans, or invoices — use cargo-billing.","descriptionLabel":"Source description","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 1.5K downloads reported by the source. Last updated 10/10/2026.","installCommand":"clawhub skill install s178dcd9wkfn0a2fqrygmt3jzn87j9e1:cargo-analytics","sourceUrl":"https://clawhub.ai/cargo-ai/cargo-analytics","homepage":"https://clawhub.ai/cargo-ai/skills/cargo-analytics","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/cargo-ai/cargo-analytics","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/cargo-ai/skills/cargo-analytics","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":63,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"cargo-analytics 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-10T11:51:48.689Z","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-10T11:51:48.689Z","emptyReason":null},"stars":null,"forks":null,"downloads":1451,"packageName":null,"latestVersion":"1.6.0","tractionLabel":"1.5K downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-10T11:51:48.688Z","emptyReason":null},"lastUpdatedAt":"2026-10-10T11:51:48.689Z","lastCrawledAt":"2026-10-10T11:51:48.688Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-11T11:51:48.688Z","lastVerifiedAt":null,"highlights":[{"version":"1.6.0","createdAt":"2026-09-16T07:25:54.522Z","changelog":"cargo-analytics 1.6.0 - Version bump to 1.6.0. - Documentation updates in SKILL.md. - Removal of the redundant skill-card.md file for a slimmer package.","fileCount":8,"zipByteSize":12514},{"version":"1.5.0","createdAt":"2026-08-15T00:24:40.265Z","changelog":"cargo-analytics 1.5.0 - Updated the skill description and guidance to clarify scope and recommended usage patterns. - Added a \"Bootstrap\" section with step-by-step CLI install and login instructions. - Removed the redundant skill-card.md file from the repository. - Improved context around JSON response conventions, error handling, and prerequisites. - Refined command documentation for exporting data, downloading results, and measuring run metrics.","fileCount":8,"zipByteSize":12245},{"version":"1.4.3","createdAt":"2026-08-11T21:44:10.614Z","changelog":"- Added new skill metadata file (skill-metadata.json); removed outdated skill-card.md file. - Updated the Cargo CLI prerequisites in SKILL.md: clarified login options and flows (now includes simple email login with code). - Minor SKILL.md content adjustments to align with newer Cargo CLI usage and user onboarding. - No command or interface changes to analytics functionality.","fileCount":8,"zipByteSize":10497},{"version":"1.4.2","createdAt":"2026-07-10T01:43:01.935Z","changelog":"cargo-analytics 1.4.2 - Clarified the skill's purpose: analytics is for measuring and exporting data, not diagnosing causes; for explanations and root cause analysis, use the new \"cargo-diagnostics\" skill. - Updated the description and main documentation to reference the diagnostics skill for \"why\"-type questions and error root cause traces. - Adjusted the scope section with clear guidance and examples on when to use analytics vs diagnostics. - Removed the legacy skill-card.md file.","fileCount":7,"zipByteSize":9871},{"version":"1.4.1","createdAt":"2026-05-28T22:13:19.897Z","changelog":"cargo-analytics 1.4.1 - Updated install guidance to reference a shared prerequisites document, improving clarity. - Changed the CLI install metadata to always fetch the latest version of @cargo-ai/cli. - Minor documentation refinements for clarity and accuracy (no behavioral changes to skill functionality).","fileCount":7,"zipByteSize":9021},{"version":"1.4.0","createdAt":"2026-05-28T19:28:30.909Z","changelog":"cargo-analytics v1.4.0 - Clarified use cases: use this skill for run metrics, error rates, data export, or result downloads for Cargo workspaces; use cargo-billing for billing/credit usage. - Improved quick reference and command guidance for workflow metrics, monitoring, exports, and SQL analytics. - Added detailed usage notes for `run get-metrics`, `run count`, and `query execute` to distinguish their purposes. - Clarified options and filtering for downloading run and batch results using the Cargo CLI. - Expanded documentation on prerequisites, auth setup, and key commands for segment and storage data export.","fileCount":7,"zipByteSize":9304}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s178dcd9wkfn0a2fqrygmt3jzn87j9e1:cargo-analytics","setupComplexity":"low","setupSteps":["Install using `clawhub skill install s178dcd9wkfn0a2fqrygmt3jzn87j9e1:cargo-analytics` 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-analytics 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-analytics/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-cargo-ai-cargo-analytics/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-cargo-ai-cargo-analytics/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-cargo-ai-cargo-analytics/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-cargo-ai-cargo-analytics/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-cargo-ai-cargo-analytics/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-10T14:43:59.650Z"}},"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-analytics/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-cargo-ai-cargo-analytics/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-cargo-ai-cargo-analytics/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-cargo-ai-cargo-analytics/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-10T11:51:48.689Z","emptyReason":null},"readme":"Skill: cargo-analytics\n\nOwner: cargo-ai\n\nSummary: Get data out of Cargo and measure what ran — download a run output, export a segment or model to CSV or JSON, and pull run and batch success and error counts. Triggers: \"download the results\", \"export this to CSV\", \"give me the file\", \"how many succeeded\", \"what is my error rate\", \"send me the enriched list\", \"get the output of that run\", \"how many records did it write\". Skip when: asking why something failed or where credits went — use cargo-diagnostics; asking about credits, plans, or invoices — use cargo-billing.\n\nTags: latest:1.6.0\n\nVersion history:\n\nv1.6.0 | 2026-09-16T07:25:54.522Z | auto\n\ncargo-analytics 1.6.0\n\n- Version bump to 1.6.0.\n- Documentation updates in SKILL.md.\n- Removal of the redundant skill-card.md file for a slimmer package.\n\nv1.5.0 | 2026-08-15T00:24:40.265Z | auto\n\ncargo-analytics 1.5.0\n\n- Updated the skill description and guidance to clarify scope and recommended usage patterns.\n- Added a \"Bootstrap\" section with step-by-step CLI install and login instructions.\n- Removed the redundant skill-card.md file from the repository.\n- Improved context around JSON response conventions, error handling, and prerequisites.\n- Refined command documentation for exporting data, downloading results, and measuring run metrics.\n\nv1.4.3 | 2026-08-11T21:44:10.614Z | auto\n\n- Added new skill metadata file (skill-metadata.json); removed outdated skill-card.md file.\n- Updated the Cargo CLI prerequisites in SKILL.md: clarified login options and flows (now includes simple email login with code).\n- Minor SKILL.md content adjustments to align with newer Cargo CLI usage and user onboarding.\n- No command or interface changes to analytics functionality.\n\nv1.4.2 | 2026-07-10T01:43:01.935Z | auto\n\ncargo-analytics 1.4.2\n\n- Clarified the skill's purpose: analytics is for measuring and exporting data, not diagnosing causes; for explanations and root cause analysis, use the new \"cargo-diagnostics\" skill.\n- Updated the description and main documentation to reference the diagnostics skill for \"why\"-type questions and error root cause traces.\n- Adjusted the scope section with clear guidance and examples on when to use analytics vs diagnostics.\n- Removed the legacy skill-card.md file.\n\nv1.4.1 | 2026-05-28T22:13:19.897Z | auto\n\ncargo-analytics 1.4.1\n\n- Updated install guidance to reference a shared prerequisites document, improving clarity.\n- Changed the CLI install metadata to always fetch the latest version of @cargo-ai/cli.\n- Minor documentation refinements for clarity and accuracy (no behavioral changes to skill functionality).\n\nv1.4.0 | 2026-05-28T19:28:30.909Z | auto\n\ncargo-analytics v1.4.0\n\n- Clarified use cases: use this skill for run metrics, error rates, data export, or result downloads for Cargo workspaces; use cargo-billing for billing/credit usage.\n- Improved quick reference and command guidance for workflow metrics, monitoring, exports, and SQL analytics.\n- Added detailed usage notes for `run get-metrics`, `run count`, and `query execute` to distinguish their purposes.\n- Clarified options and filtering for downloading run and batch results using the Cargo CLI.\n- Expanded documentation on prerequisites, auth setup, and key commands for segment and storage data export.\n\nArchive index:\n\nArchive v1.6.0: 8 files, 12514 bytes\n\nFiles: references/examples/exports.md (3290b), references/examples/run-analytics.md (4041b), references/response-shapes.md (2501b), references/troubleshooting.md (2545b), skill-card.md (2636b), skill-metadata.json (920b), SKILL.md (15256b), _meta.json (134b)\n\nFile v1.6.0:SKILL.md\n\n---\nname: cargo-analytics\ndescription: \"Get data out of Cargo and measure what ran — download a run output, export a segment or model to CSV or JSON, and pull run and batch success and error counts. Triggers: \\\"download the results\\\", \\\"export this to CSV\\\", \\\"give me the file\\\", \\\"how many succeeded\\\", \\\"what is my error rate\\\", \\\"send me the enriched list\\\", \\\"get the output of that run\\\", \\\"how many records did it write\\\". Skip when: asking why something failed or where credits went — use cargo-diagnostics; asking about credits, plans, or invoices — use cargo-billing.\"\nversion: \"1.6.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 — Analytics\n\nMeasurement and export: monitoring run metrics, downloading run and batch results, and exporting segment data.\n\n> See `references/response-shapes.md` for full JSON response structures.\n> See `references/troubleshooting.md` for common errors and how to fix them.\n> See `references/examples/run-analytics.md` for run metrics and error monitoring.\n> See `references/examples/exports.md` for data export and download examples.\n> For billing, usage metrics, and subscription: use the `cargo-billing` 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## Scope — measure and export, not explain\n\nThis skill answers **\"what happened\"** and **\"give me the data\"**: metrics, counts, downloads, exports. The moment the question becomes **\"why\"** — why did this run fail, why is the output wrong or empty, which root cause explains these errors, why is this play so expensive — switch to the `cargo-diagnostics` skill; its runbooks sequence the raw surfaces into a diagnosis.\n\n| The question sounds like… | Load |\n| --- | --- |\n| \"What's the error rate?\" / \"How many runs failed this week?\" / \"Export the results / segment\" | **this skill** |\n| \"Why did this run fail?\" / \"Run succeeded but the output looks wrong\" | `cargo-diagnostics` → `references/run-trace.md` |\n| \"Why does this batch have errors? Which node keeps failing, and is it one cause or many?\" | `cargo-diagnostics` → `references/batch-error-sweep.md` |\n| \"Why is this play so expensive? Where do the credits go?\" | `cargo-diagnostics` → `references/play-optimize-credits.md` |\n\nThe two skills chain naturally: analytics **detects** (error rate spiked, batch reports failures), diagnostics **explains** (18 of 20 failures share one root cause), then analytics **retrieves** the clean results once the cause is fixed and the runs re-executed.\n\n## Discover resources first\n\nMost analytics commands require UUIDs. Discover them before querying.\n\n```bash\ncargo-ai orchestration play list            # all plays (name, workflowUuid)\ncargo-ai orchestration tool list            # all tools (name, workflowUuid)\ncargo-ai orchestration workflow list        # all workflows (uuid only — no name)\ncargo-ai ai agent list                     # all agents (uuid, name)\ncargo-ai connection connector list          # all connectors (uuid, name, integrationSlug)\ncargo-ai storage model list                # all models (uuid, name, slug)\n```\n\n## Quick reference\n\n```bash\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid>\ncargo-ai orchestration run download --workflow-uuid <uuid> --is-finished\ncargo-ai orchestration run count --workflow-uuid <uuid> --statuses error\ncargo-ai orchestration query execute \"SELECT status, count() FROM runs GROUP BY status\"\ncargo-ai segmentation segment download --model-uuid <uuid> --filter '{\"conjonction\":\"and\",\"groups\":[]}'\n```\n\n**Picking the right command:**\n\n- `run get-metrics` / `run count` — workflow-scoped, predefined aggregations. Best when you already have a `workflowUuid`.\n- `orchestration query execute` — ad-hoc SQL across the entire workspace (`runs`, `batches`, `spans`, `records`). Best for cross-workflow analytics, per-node breakdowns, and time-series.\n- `run download` / `run download-outputs` — per-record output retrieval.\n- `segment download` / `storage query execute` — storage data (Companies, Contacts, …).\n\n## Workflow run metrics\n\nAggregated metrics for workflow runs (success/error rates, credits per node).\n\n```bash\n# Metrics for a workflow\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid>\n\n# Scoped to a release, batch, or date range\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid> --release-uuid <uuid>\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid> --batch-uuid <uuid>\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid> \\\n  --created-after <start-date> --created-before <end-date>\n```\n\n## Run count\n\nCount runs matching specific criteria — useful for monitoring.\n\n```bash\ncargo-ai orchestration run count --workflow-uuid <uuid> --statuses error\ncargo-ai orchestration run count --workflow-uuid <uuid> --is-finished \\\n  --created-after <start-date> --created-before <end-date>\ncargo-ai orchestration run count --workflow-uuid <uuid> --batch-uuid <uuid>\n```\n\nSupports: `--statuses`, `--batch-uuid`, `--release-uuid`, `--is-finished`, `--created-after`, `--created-before`, `--record-id`, `--record-title`.\n\nFor cross-workflow analytics or shapes that `run count` doesn't expose (per-node failure breakdowns, p95 durations, error rate over time), use `orchestration query execute` — see the [Ad-hoc execution analytics](#ad-hoc-execution-analytics-orchestration-query) section.\n\n## Ad-hoc execution analytics (`orchestration query`)\n\nRun SQL against orchestration runtime tables — `runs`, `batches`, `spans`, `records` — for analytics that the canned metrics commands don't cover. Tables are referenced without a schema prefix; workspace scoping is automatic. See `cargo-orchestration/references/examples/queries.md` for schemas and limits.\n\n```bash\n# Error rate across the workspace in the last day\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# Failed runs per workflow this 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# Per-node failure counts (last 24h)\ncargo-ai orchestration query execute \\\n  \"SELECT node_slug, count() AS failures FROM spans WHERE execution_status='error' AND execution_started_at > now() - INTERVAL 1 DAY GROUP BY node_slug 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 FROM batches WHERE created_at >= toStartOfMonth(now()) GROUP BY workflow_uuid ORDER BY credits DESC\"\n```\n\nRead-only and capped: 30s execution time, 10 000 result rows, 10 000 000 rows scanned. Narrow with a `created_at`/`execution_started_at` predicate to stay under the row-scan cap.\n\n## Downloading run results\n\nTwo distinct commands — pick the right one for the job.\n\n### `run download` — one row per run, one column per node (gzipped CSV)\n\nReturns `{\"url\": \"...\"}` — a signed URL to a **gzipped CSV**. Each row is a run: `_uuid`, `_workspace_uuid`, `_workflow_uuid`, `_record_id`, `_record_title`, `_created_at`, `_finished_at`, `_status`, `_error_message`, followed by **one column per node slug**.\n\n**Each node column holds that execution's `title` — a truncated human-readable summary, not the node's output.** There is no `runContext` and no `executions[]` in this file. Treat it as a status board across many runs (which node errored, on which record), never as evidence of what a node produced — the same rule `cargo-diagnostics` applies to `title` everywhere else.\n\n```bash\n# Every run of a workflow\ncargo-ai orchestration run download --workflow-uuid <uuid>\n\n# Date range\ncargo-ai orchestration run download --workflow-uuid <uuid> \\\n  --created-after <start-date> --created-before <end-date>\n\n# Specific statuses (run statuses: idle, pending, running, success, error,\n# cancelling, cancelled, skipped — NOT \"finished\"/\"failed\")\ncargo-ai orchestration run download --workflow-uuid <uuid> --statuses success,error\n\n# Every run that reached a terminal state. `--is-finished` is `finished_at IS\n# NOT NULL`, which is wider than success+error: cancelled and skipped runs\n# stamp finishedAt too, so don't substitute one for the other.\ncargo-ai orchestration run download --workflow-uuid <uuid> --is-finished\n\n# From a specific batch\ncargo-ai orchestration run download --workflow-uuid <uuid> --batch-uuid <uuid>\n```\n\n### `run download-outputs` — per-run input + output (CSV/JSON via signed URL)\n\n**This is the canonical way to get action results out of the platform.** Maps to API `POST /v1/orchestration/runs/download-outputs`. Returns `{\"url\": \"...\"}` — a signed URL to a CSV (default) or JSON file. One row per run: the same `_`-prefixed run metadata, plus `input` (the first node's resolved config) and `output` (the chosen node's context, defaulting to the **last executed node** when `--output-node-slug` is omitted).\n\n```bash\n# --workflow-uuid is the only required flag\ncargo-ai orchestration run download-outputs \\\n  --workflow-uuid <uuid> \\\n  --format json \\\n  --limit 20\n\n# Pin the output node explicitly, and filter by batch\ncargo-ai orchestration run download-outputs \\\n  --workflow-uuid <uuid> \\\n  --output-node-slug <slug> \\\n  --batch-uuid <uuid>\n```\n\nTo find the `output-node-slug`: `cargo-ai orchestration release get <release-uuid>` → look at `nodes[].slug`. The terminal output node is typically named `output` or `end`. Without `--limit`, the file covers **every** matching run of the workflow, so pass one when you only need a sample.\n\n**Per record instead of per run:** `cargo-ai orchestration record download-outputs` takes the same `--workflow-uuid` / `--output-node-slug` and emits one row per **record**. It pages with `--limit` and `--offset` (CLI ≥ 1.0.90) — the way to export a set too large for a single file is to walk it in fixed slices (`--limit 1000 --offset 0`, then `--offset 1000`, …) rather than requesting everything at once. `run download-outputs` pages the same way, over runs.\n\n### Getting the full `runContext` for several runs\n\nYou can't, in one call. The full per-node context is a **per-run S3 object**, and `orchestration run get <run-uuid>` is the only command that hydrates it — one run at a time. The two exports above are projections: `download` gives you node *titles* across many runs, `download-outputs` gives you first-node input + one node's output across many runs. For everything in between, loop `run get` over the UUIDs from the discovery ladder in [`../cargo-diagnostics/references/run-trace.md`](../cargo-diagnostics/references/run-trace.md) § 0.\n\nOrchestration SQL is not an alternative here: `runs` and `spans` carry status, timing, and credits, but no node input/output columns.\n\n## Downloading batch results\n\n```bash\ncargo-ai orchestration batch download --uuid <batch-uuid> --output-node-slug <node-slug>\n```\n\nTo find the `output-node-slug`: run `cargo-ai orchestration release get <release-uuid>` (get the release UUID from the batch) and look at `nodes[].slug`.\n\n## Handling partial batch failures\n\nA batch with `status: \"success\"` can still contain individual run failures. Always inspect the batch for errors before treating results as complete.\n\n**Step 1 — Check the batch summary:**\n\n```bash\ncargo-ai orchestration batch get <batch-uuid>\n# → .runsCount          = total records submitted\n# → .executedRunsCount  = records that reached a terminal state (success or error)\n# → .failedRunsCount    = records that errored\n```\n\n**Step 2 — Count and download the failed runs:**\n\n```bash\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --batch-uuid <batch-uuid> \\\n  --statuses error\n\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --batch-uuid <batch-uuid> \\\n  --statuses error\n```\n\n**Step 3 — Diagnose.** Working out *why* they failed — grouping failures by root cause, picking exemplar runs, reading `runContext` — is the `cargo-diagnostics` skill's job: load `../cargo-diagnostics/references/batch-error-sweep.md` and feed it the batch UUID.\n\n**Step 4 — Re-run only the failed records:**\n\nAfter the diagnosis and fixing the underlying issue (connector credentials, bad input data, rate limits):\n\n```bash\n# Extract record IDs from the failed run download, then:\ncargo-ai orchestration batch create \\\n  --workflow-uuid <uuid> \\\n  --data '{\"kind\":\"recordIds\",\"recordIds\":[\"id1\",\"id2\",\"id3\"]}'\n```\n\n**Filtering by node output slug:**\n\nTo download only a specific node's output from a batch (e.g. just the enrichment node, not the full run):\n\n```bash\n# 1. Get the release UUID from the batch\ncargo-ai orchestration batch get <batch-uuid>\n# → .releaseUuid\n\n# 2. Find the node slug\ncargo-ai orchestration release get <release-uuid>\n# → nodes[].slug\n\n# 3. Download that node's output\ncargo-ai orchestration batch download \\\n  --uuid <batch-uuid> \\\n  --output-node-slug <node-slug>\n```\n\n## Segment data export\n\nFilter JSON uses `conjonction` (not `conjunction`) — this is intentional. See the `cargo-orchestration` skill's `references/filter-syntax.md` for the full filter syntax.\n\n```bash\n# Full export (all records)\ncargo-ai segmentation segment download \\\n  --model-uuid <uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}'\n\n# With sorting and limit\ncargo-ai segmentation segment download \\\n  --model-uuid <uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}' \\\n  --sort '[{\"columnSlug\":\"created_at\",\"kind\":\"desc\"}]' \\\n  --limit 1000\n```\n\n**IMPORTANT:** `segment download` requires `--model-uuid`, not `--segment-uuid`. Get the `modelUuid` from `segment list`.\n\nFor live paginated queries with enrichment, use `segmentation segment fetch` from the `cargo-orchestration` skill.\n\n## Help\n\nEvery command supports `--help`:\n\n```bash\ncargo-ai billing usage get-metrics --help\ncargo-ai orchestration run download --help\ncargo-ai segmentation segment download --help\n```\n\nFile v1.6.0:_meta.json\n\n{\n  \"ownerId\": \"kn7by8t6yt9yghbxtxz6hv0bts87k6bq\",\n  \"slug\": \"cargo-analytics\",\n  \"version\": \"1.6.0\",\n  \"publishedAt\": 1789543554522\n}\n\nFile v1.6.0:references/examples/exports.md\n\n# Data export examples\n\n## Download all finished runs\n\n```bash\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --is-finished\n```\n\n## Download runs by status\n\n```bash\n# Only successful runs\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --statuses success\n\n# Both success and error (for analysis)\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --statuses success,error\n\n# Only error runs (for debugging)\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --statuses error\n```\n\n## Download runs in a date range\n\n```bash\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --created-after 2025-01-01 \\\n  --created-before 2025-01-31\n```\n\n## Download runs from a specific batch\n\n```bash\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --batch-uuid <batch-uuid>\n```\n\n## Download batch output by node\n\n```bash\n# 1. Get the batch and its release UUID\ncargo-ai orchestration batch get <batch-uuid>\n# → Extract releaseUuid\n\n# 2. Find the output node slug\ncargo-ai orchestration release get <release-uuid>\n# → Read nodes[].slug — pick the output node's slug\n\n# 3. Download\ncargo-ai orchestration batch download \\\n  --uuid <batch-uuid> \\\n  --output-node-slug <node-slug>\n```\n\n## Export all segment data\n\n```bash\n# 1. List segments to find the modelUuid\ncargo-ai segmentation segment list\n# → Extract modelUuid (NOT segment uuid)\n\n# 2. Full export\ncargo-ai segmentation segment download \\\n  --model-uuid <model-uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}'\n```\n\n## Export segment data with sorting and limit\n\n```bash\ncargo-ai segmentation segment download \\\n  --model-uuid <model-uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}' \\\n  --sort '[{\"columnSlug\":\"created_at\",\"kind\":\"desc\"}]' \\\n  --limit 5000\n```\n\n## Export filtered segment data\n\n```bash\n# Export only churned accounts\ncargo-ai segmentation segment download \\\n  --model-uuid <model-uuid> \\\n  --filter '{\n    \"conjonction\": \"and\",\n    \"groups\": [{\n      \"conjonction\": \"and\",\n      \"conditions\": [\n        {\"kind\": \"string\", \"columnSlug\": \"status\", \"operator\": \"is\", \"values\": [\"churned\"]}\n      ]\n    }]\n  }'\n\n# Export US companies with 100+ employees\ncargo-ai segmentation segment download \\\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      ]\n    }]\n  }'\n\n# Export records created after a date\ncargo-ai segmentation segment download \\\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```\n\n## Export a segment with non-null email\n\n```bash\ncargo-ai segmentation segment download \\\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```\n\nFile v1.6.0:references/examples/run-analytics.md\n\n# Run analytics examples\n\n## Get metrics for a workflow\n\n```bash\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid>\n```\n\nResponse:\n\n```json\n{\n  \"runMetrics\": [\n    {\n      \"nodeUuid\": \"node-uuid-1\",\n      \"totalExecutionsCount\": 1000,\n      \"successExecutionsCount\": 950,\n      \"errorExecutionsCount\": 30,\n      \"cancelledExecutionsCount\": 5,\n      \"creditsUsedCount\": 450\n    }\n  ]\n}\n```\n\nError rate per node = `errorExecutionsCount / totalExecutionsCount`. High error rate on a specific node means that step is failing.\n\n## Metrics scoped to a specific release\n\n```bash\ncargo-ai orchestration run get-metrics \\\n  --workflow-uuid <uuid> \\\n  --release-uuid <release-uuid>\n```\n\n## Metrics scoped to a specific batch\n\n```bash\ncargo-ai orchestration run get-metrics \\\n  --workflow-uuid <uuid> \\\n  --batch-uuid <batch-uuid>\n```\n\n## Metrics for a date range\n\n```bash\ncargo-ai orchestration run get-metrics \\\n  --workflow-uuid <uuid> \\\n  --created-after 2025-01-01 \\\n  --created-before 2025-01-31\n```\n\n## Count errors\n\n```bash\n# Total error count\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses error\n```\n\nResponse:\n\n```json\n{ \"count\": 42 }\n```\n\n```bash\n# Errors in a specific period\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses error \\\n  --created-after 2025-01-15 \\\n  --created-before 2025-01-16\n\n# Errors in a specific batch\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses error \\\n  --batch-uuid <batch-uuid>\n```\n\n## Count finished runs\n\n```bash\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --is-finished\n\n# In a date range\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --is-finished \\\n  --created-after 2025-01-01 \\\n  --created-before 2025-01-31\n```\n\n## Count successful runs\n\n```bash\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses success\n```\n\n## Per-workflow cost analysis (full flow)\n\n```bash\n# 1. List workflows\ncargo-ai orchestration workflow list\n\n# 2. Get usage grouped by workflow\ncargo-ai billing usage get-metrics \\\n  --from 2025-01-01 --to 2025-01-31 \\\n  --group-by workflow_uuid\n\n# 3. Drill into a specific workflow\ncargo-ai billing usage get-metrics \\\n  --from 2025-01-01 --to 2025-01-31 \\\n  --workflow-uuid <uuid>\n\n# 4. Get run-level metrics\ncargo-ai orchestration run get-metrics \\\n  --workflow-uuid <uuid> \\\n  --created-after 2025-01-01 \\\n  --created-before 2025-01-31\n```\n\n## Error monitoring and debugging (full flow)\n\n```bash\n# 1. Count errors\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses error\n\n# 2. Spot-check: count errors in the last 24 hours\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses error \\\n  --created-after 2025-01-15 \\\n  --created-before 2025-01-16\n\n# 3. Download error runs for inspection\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --statuses error \\\n  --created-after 2025-01-15\n\n# 4. Check per-node error rates\ncargo-ai orchestration run get-metrics \\\n  --workflow-uuid <uuid>\n# → Compare errorExecutionsCount vs totalExecutionsCount per node\n# → High error rate on a specific node = that step is failing\n```\n\nThis flow ends at **detection** — you now know how many runs fail and which node is the hotspot. To explain *why* (group failures by root cause, trace exemplar runs through `runContext`), continue with the `cargo-diagnostics` skill: `../../../cargo-diagnostics/references/batch-error-sweep.md`, then `run-trace.md` on the exemplars it hands back.\n\n## List runs with filters\n\n```bash\n# All runs for a workflow (paginated)\ncargo-ai orchestration run list \\\n  --workflow-uuid <uuid> \\\n  --limit 20\n\n# Only error runs\ncargo-ai orchestration run list \\\n  --workflow-uuid <uuid> \\\n  --statuses error \\\n  --limit 10\n\n# Runs from a specific batch\ncargo-ai orchestration run list \\\n  --workflow-uuid <uuid> \\\n  --batch-uuid <batch-uuid>\n\n# Runs for a specific record\ncargo-ai orchestration run list \\\n  --workflow-uuid <uuid> \\\n  --record-id <record-id>\n```\n\nFile v1.6.0:references/response-shapes.md\n\n# Response shapes\n\nJSON response structures returned by Cargo CLI commands used in the `cargo-analytics` skill.\n\n> For billing response shapes (usage metrics, subscription, invoices), see the `cargo-billing` skill.\n\n## cargo-ai orchestration run get-metrics\n\n```json\n{\n  \"runMetrics\": [\n    {\n      \"nodeUuid\": \"node-uuid-1\",\n      \"totalExecutionsCount\": 1000,\n      \"idleExecutionsCount\": 0,\n      \"pendingExecutionsCount\": 5,\n      \"runningExecutionsCount\": 10,\n      \"successExecutionsCount\": 950,\n      \"errorExecutionsCount\": 30,\n      \"cancelledExecutionsCount\": 5,\n      \"skippedExecutionsCount\": 0,\n      \"creditsUsedCount\": 450\n    }\n  ]\n}\n```\n\n**Key fields:** `nodeUuid` (identifies the workflow node), `successExecutionsCount`, `errorExecutionsCount`, `creditsUsedCount`.\n\nTo compute an error rate: `errorExecutionsCount / totalExecutionsCount`.\n\n## cargo-ai orchestration run count\n\n```json\n{\n  \"count\": 42\n}\n```\n\n## cargo-ai orchestration run list\n\n```json\n{\n  \"runs\": [\n    {\n      \"uuid\": \"run-uuid\",\n      \"workflowUuid\": \"...\",\n      \"status\": \"success\",\n      \"batchUuid\": \"batch-uuid-or-null\",\n      \"releaseUuid\": \"...\",\n      \"recordId\": \"rec-123\",\n      \"recordTitle\": \"Acme Corp\",\n      \"createdAt\": \"2025-01-15T10:00:00Z\",\n      \"finishedAt\": \"2025-01-15T10:00:05Z\"\n    }\n  ]\n}\n```\n\n## cargo-ai segmentation segment download\n\nReturns raw data as a downloadable payload (typically CSV or JSON depending on the CLI output format). The response is streamed to stdout.\n\n## cargo-ai orchestration batch download\n\nReturns `{\"url\": \"...\"}` — a signed URL to a file, **not** the data on stdout. Each row is a batch record joined to its run's output for the chosen node (defaulting to the last executed node), so a record whose run errored comes back with its input fields and no output.\n\n## cargo-ai orchestration run download\n\nReturns `{\"url\": \"...\"}` — a signed URL to a **gzipped CSV**. One row per run: `_uuid`, `_workspace_uuid`, `_workflow_uuid`, `_record_id`, `_record_title`, `_created_at`, `_finished_at`, `_status`, `_error_message`, then one column per node slug holding that execution's `title` (a truncated summary, not the node's output). No `runContext`, no `executions[]`.\n\n## cargo-ai orchestration run download-outputs\n\nReturns `{\"url\": \"...\"}` — a signed URL to CSV (default) or JSON. One row per run: the `_`-prefixed run metadata above, plus `input` (first node's resolved config) and `output` (chosen node's context, defaulting to the last executed node).\n\nFile v1.6.0:references/troubleshooting.md\n\n# Troubleshooting\n\nCommon errors and recovery steps for `cargo-analytics` commands.\n\n## General\n\n| Symptom | Cause | Fix |\n|---------|-------|-----|\n| `{\"errorMessage\": \"...\"}` with non-zero exit | Any CLI error | Read the `errorMessage` — it usually says exactly what's wrong |\n| `command not found: cargo-ai` | CLI not installed or not in PATH | Run `npm install -g @cargo-ai/cli` or prefix with `npx @cargo-ai/cli` |\n| `Unauthorized` or `Forbidden` | Bad or expired credentials | Re-run `cargo-ai login --oauth` (browser sign-in) or `cargo-ai login --token <token>`; verify with `cargo-ai whoami` |\n\n## Run metrics and counts\n\n| Symptom | Cause | Fix |\n|---------|-------|-----|\n| `run get-metrics` returns empty array | No runs exist for that workflow/period | Verify the `--workflow-uuid`; try without date filters to check if any runs exist |\n| Error count seems too high | Counting across all time | Scope with `--created-after` and `--created-before` for a specific period |\n| `run count` returns 0 unexpectedly | Filter combination too narrow | Remove filters one at a time to isolate which one excludes all runs |\n\n## Downloads and exports\n\n| Symptom | Cause | Fix |\n|---------|-------|-----|\n| `run download` returns empty | No runs match the filters | Loosen filters — drop the date and status constraints and pass `--workflow-uuid` alone |\n| `run download` returns `500 Internal Server Error` | The workflow resolves to zero active nodes — all archived, or the UUID doesn't exist in this workspace. The export builds one column per node slug, so there is nothing to select | Confirm the UUID with `workflow list` / `play list`. Loosening filters won't help; the failure is about the workflow, not the runs |\n| `400 unrecognized_keys: <flag>` on a run command | The CLI offers a flag the API's request schema doesn't accept | Drop the flag and express the filter another way — `--statuses success,error` covers \"finished\". Then report it: `workspaceManagement report create` |\n| `batch download` fails with \"node not found\" | Wrong `--output-node-slug` | Re-run `release get <release-uuid>` and check `nodes[].slug` for the correct value |\n| `segment download` returns empty | Wrong model UUID or over-filtered | Verify `--model-uuid` (not `--segment-uuid`); try empty filter `{\"conjonction\":\"and\",\"groups\":[]}` first |\n| Parse error on filter JSON | Malformed JSON or wrong spelling | Check: it's `conjonction` (not `conjunction`); validate JSON syntax; see the `cargo-orchestration` skill's `references/filter-syntax.md` |\n\nFile v1.6.0:skill-card.md\n\n## Description:\n\nHelps agents measure Cargo workflow runs, download run and batch outputs, export segment or model data to CSV or JSON, and report success, error, and output counts.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[cargo-ai](https://clawhub.ai/user/cargo-ai)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nDevelopers, operators, and revenue teams use this skill to inspect Cargo run metrics, monitor workflow success and error counts, and retrieve generated outputs or segment exports.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The install metadata uses @cargo-ai/cli@latest, so the CLI version can change after review.\n\nMitigation: Pin the Cargo CLI to a reviewed release before deployment and update the pin only through normal change review.\n\nRisk: The skill includes batch rerun commands that can change workspace state.\n\nMitigation: Require explicit user confirmation before reruns or other workspace-changing commands, and verify the target workflow, batch, and record IDs first.\n\nRisk: Generated exports and signed URLs may contain sensitive workspace data.\n\nMitigation: Treat downloaded files and signed URLs as sensitive, restrict sharing, and store outputs only in approved locations.\n\nRisk: Analytics commands require Cargo authentication and may expose broader workspace data than intended.\n\nMitigation: Use a read-only or least-privilege Cargo token for analytics and confirm the active workspace with cargo-ai whoami before running commands.\n\n## Reference(s):\n\n- [Cargo Analytics on ClawHub](https://clawhub.ai/cargo-ai/skills/cargo-analytics)\n- [Cargo skills homepage](https://github.com/getcargohq/cargo-skills)\n- [Response shapes](references/response-shapes.md)\n- [Run analytics examples](references/examples/run-analytics.md)\n- [Data export examples](references/examples/exports.md)\n- [Troubleshooting](references/troubleshooting.md)\n\n## Skill Output:\n\n**Output Type(s):** [Text, Markdown, Shell commands, Configuration, Guidance]\n\n**Output Format:** [Markdown with inline bash commands and JSON examples]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [May direct the agent to produce or retrieve CSV and JSON exports through Cargo CLI commands.]\n\n## Skill Version(s):\n\n1.6.0 (source: frontmatter, skill-metadata.json, server release evidence)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.6.0:skill-metadata.json\n\n{\n  \"$comment\": \"Generated by .github/scripts/skills-metadata.mjs — do not hand-edit. Regenerate with: node .github/scripts/skills-metadata.mjs --write .\",\n  \"name\": \"cargo-analytics\",\n  \"version\": \"1.6.0\",\n  \"documents\": [\n    {\n      \"path\": \"SKILL.md\",\n      \"kind\": \"entrypoint\",\n      \"title\": \"Cargo CLI — Analytics\"\n    },\n    {\n      \"path\": \"references/examples/exports.md\",\n      \"kind\": \"example\",\n      \"title\": \"Data export examples\"\n    },\n    {\n      \"path\": \"references/examples/run-analytics.md\",\n      \"kind\": \"example\",\n      \"title\": \"Run analytics examples\"\n    },\n    {\n      \"path\": \"references/response-shapes.md\",\n      \"kind\": \"reference\",\n      \"title\": \"Response shapes\"\n    },\n    {\n      \"path\": \"references/troubleshooting.md\",\n      \"kind\": \"reference\",\n      \"title\": \"Troubleshooting\"\n    }\n  ],\n  \"contentHash\": \"73751bdd4882585158672d2f4634483cb93c082a7c5cb5d734ec6b1ed4c020e3\"\n}\n\nArchive v1.5.0: 8 files, 12245 bytes\n\nFiles: references/examples/exports.md (3290b), references/examples/run-analytics.md (4041b), references/response-shapes.md (2501b), references/troubleshooting.md (2545b), skill-card.md (2460b), skill-metadata.json (920b), SKILL.md (14787b), _meta.json (134b)\n\nFile v1.5.0:SKILL.md\n\n---\nname: cargo-analytics\ndescription: \"Get data out of Cargo and measure what ran — download a run output, export a segment or model to CSV or JSON, and pull run and batch success and error counts. Triggers: \\\"download the results\\\", \\\"export this to CSV\\\", \\\"give me the file\\\", \\\"how many succeeded\\\", \\\"what is my error rate\\\", \\\"send me the enriched list\\\", \\\"get the output of that run\\\", \\\"how many records did it write\\\". Skip when: asking why something failed or where credits went — use cargo-diagnostics; asking about credits, plans, or invoices — use cargo-billing.\"\nversion: \"1.5.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 — Analytics\n\nMeasurement and export: monitoring run metrics, downloading run and batch results, and exporting segment data.\n\n> See `references/response-shapes.md` for full JSON response structures.\n> See `references/troubleshooting.md` for common errors and how to fix them.\n> See `references/examples/run-analytics.md` for run metrics and error monitoring.\n> See `references/examples/exports.md` for data export and download examples.\n> For billing, usage metrics, and subscription: use the `cargo-billing` 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## Scope — measure and export, not explain\n\nThis skill answers **\"what happened\"** and **\"give me the data\"**: metrics, counts, downloads, exports. The moment the question becomes **\"why\"** — why did this run fail, why is the output wrong or empty, which root cause explains these errors, why is this play so expensive — switch to the `cargo-diagnostics` skill; its runbooks sequence the raw surfaces into a diagnosis.\n\n| The question sounds like… | Load |\n| --- | --- |\n| \"What's the error rate?\" / \"How many runs failed this week?\" / \"Export the results / segment\" | **this skill** |\n| \"Why did this run fail?\" / \"Run succeeded but the output looks wrong\" | `cargo-diagnostics` → `references/run-trace.md` |\n| \"Why does this batch have errors? Which node keeps failing, and is it one cause or many?\" | `cargo-diagnostics` → `references/batch-error-sweep.md` |\n| \"Why is this play so expensive? Where do the credits go?\" | `cargo-diagnostics` → `references/play-optimize-credits.md` |\n\nThe two skills chain naturally: analytics **detects** (error rate spiked, batch reports failures), diagnostics **explains** (18 of 20 failures share one root cause), then analytics **retrieves** the clean results once the cause is fixed and the runs re-executed.\n\n## Discover resources first\n\nMost analytics commands require UUIDs. Discover them before querying.\n\n```bash\ncargo-ai orchestration play list            # all plays (name, workflowUuid)\ncargo-ai orchestration tool list            # all tools (name, workflowUuid)\ncargo-ai orchestration workflow list        # all workflows (uuid only — no name)\ncargo-ai ai agent list                     # all agents (uuid, name)\ncargo-ai connection connector list          # all connectors (uuid, name, integrationSlug)\ncargo-ai storage model list                # all models (uuid, name, slug)\n```\n\n## Quick reference\n\n```bash\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid>\ncargo-ai orchestration run download --workflow-uuid <uuid> --is-finished\ncargo-ai orchestration run count --workflow-uuid <uuid> --statuses error\ncargo-ai orchestration query execute \"SELECT status, count() FROM runs GROUP BY status\"\ncargo-ai segmentation segment download --model-uuid <uuid> --filter '{\"conjonction\":\"and\",\"groups\":[]}'\n```\n\n**Picking the right command:**\n\n- `run get-metrics` / `run count` — workflow-scoped, predefined aggregations. Best when you already have a `workflowUuid`.\n- `orchestration query execute` — ad-hoc SQL across the entire workspace (`runs`, `batches`, `spans`, `records`). Best for cross-workflow analytics, per-node breakdowns, and time-series.\n- `run download` / `run download-outputs` — per-record output retrieval.\n- `segment download` / `storage query execute` — storage data (Companies, Contacts, …).\n\n## Workflow run metrics\n\nAggregated metrics for workflow runs (success/error rates, credits per node).\n\n```bash\n# Metrics for a workflow\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid>\n\n# Scoped to a release, batch, or date range\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid> --release-uuid <uuid>\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid> --batch-uuid <uuid>\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid> \\\n  --created-after <start-date> --created-before <end-date>\n```\n\n## Run count\n\nCount runs matching specific criteria — useful for monitoring.\n\n```bash\ncargo-ai orchestration run count --workflow-uuid <uuid> --statuses error\ncargo-ai orchestration run count --workflow-uuid <uuid> --is-finished \\\n  --created-after <start-date> --created-before <end-date>\ncargo-ai orchestration run count --workflow-uuid <uuid> --batch-uuid <uuid>\n```\n\nSupports: `--statuses`, `--batch-uuid`, `--release-uuid`, `--is-finished`, `--created-after`, `--created-before`, `--record-id`, `--record-title`.\n\nFor cross-workflow analytics or shapes that `run count` doesn't expose (per-node failure breakdowns, p95 durations, error rate over time), use `orchestration query execute` — see the [Ad-hoc execution analytics](#ad-hoc-execution-analytics-orchestration-query) section.\n\n## Ad-hoc execution analytics (`orchestration query`)\n\nRun SQL against orchestration runtime tables — `runs`, `batches`, `spans`, `records` — for analytics that the canned metrics commands don't cover. Tables are referenced without a schema prefix; workspace scoping is automatic. See `cargo-orchestration/references/examples/queries.md` for schemas and limits.\n\n```bash\n# Error rate across the workspace in the last day\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# Failed runs per workflow this 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# Per-node failure counts (last 24h)\ncargo-ai orchestration query execute \\\n  \"SELECT node_slug, count() AS failures FROM spans WHERE execution_status='error' AND execution_started_at > now() - INTERVAL 1 DAY GROUP BY node_slug 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 FROM batches WHERE created_at >= toStartOfMonth(now()) GROUP BY workflow_uuid ORDER BY credits DESC\"\n```\n\nRead-only and capped: 30s execution time, 10 000 result rows, 10 000 000 rows scanned. Narrow with a `created_at`/`execution_started_at` predicate to stay under the row-scan cap.\n\n## Downloading run results\n\nTwo distinct commands — pick the right one for the job.\n\n### `run download` — one row per run, one column per node (gzipped CSV)\n\nReturns `{\"url\": \"...\"}` — a signed URL to a **gzipped CSV**. Each row is a run: `_uuid`, `_workspace_uuid`, `_workflow_uuid`, `_record_id`, `_record_title`, `_created_at`, `_finished_at`, `_status`, `_error_message`, followed by **one column per node slug**.\n\n**Each node column holds that execution's `title` — a truncated human-readable summary, not the node's output.** There is no `runContext` and no `executions[]` in this file. Treat it as a status board across many runs (which node errored, on which record), never as evidence of what a node produced — the same rule `cargo-diagnostics` applies to `title` everywhere else.\n\n```bash\n# Every run of a workflow\ncargo-ai orchestration run download --workflow-uuid <uuid>\n\n# Date range\ncargo-ai orchestration run download --workflow-uuid <uuid> \\\n  --created-after <start-date> --created-before <end-date>\n\n# Specific statuses (run statuses: idle, pending, running, success, error,\n# cancelling, cancelled, skipped — NOT \"finished\"/\"failed\")\ncargo-ai orchestration run download --workflow-uuid <uuid> --statuses success,error\n\n# Every run that reached a terminal state. `--is-finished` is `finished_at IS\n# NOT NULL`, which is wider than success+error: cancelled and skipped runs\n# stamp finishedAt too, so don't substitute one for the other.\ncargo-ai orchestration run download --workflow-uuid <uuid> --is-finished\n\n# From a specific batch\ncargo-ai orchestration run download --workflow-uuid <uuid> --batch-uuid <uuid>\n```\n\n### `run download-outputs` — per-run input + output (CSV/JSON via signed URL)\n\n**This is the canonical way to get action results out of the platform.** Maps to API `POST /v1/orchestration/runs/download-outputs`. Returns `{\"url\": \"...\"}` — a signed URL to a CSV (default) or JSON file. One row per run: the same `_`-prefixed run metadata, plus `input` (the first node's resolved config) and `output` (the chosen node's context, defaulting to the **last executed node** when `--output-node-slug` is omitted).\n\n```bash\n# --workflow-uuid is the only required flag\ncargo-ai orchestration run download-outputs \\\n  --workflow-uuid <uuid> \\\n  --format json \\\n  --limit 20\n\n# Pin the output node explicitly, and filter by batch\ncargo-ai orchestration run download-outputs \\\n  --workflow-uuid <uuid> \\\n  --output-node-slug <slug> \\\n  --batch-uuid <uuid>\n```\n\nTo find the `output-node-slug`: `cargo-ai orchestration release get <release-uuid>` → look at `nodes[].slug`. The terminal output node is typically named `output` or `end`. Without `--limit`, the file covers **every** matching run of the workflow, so pass one when you only need a sample.\n\n### Getting the full `runContext` for several runs\n\nYou can't, in one call. The full per-node context is a **per-run S3 object**, and `orchestration run get <run-uuid>` is the only command that hydrates it — one run at a time. The two exports above are projections: `download` gives you node *titles* across many runs, `download-outputs` gives you first-node input + one node's output across many runs. For everything in between, loop `run get` over the UUIDs from the discovery ladder in [`../cargo-diagnostics/references/run-trace.md`](../cargo-diagnostics/references/run-trace.md) § 0.\n\nOrchestration SQL is not an alternative here: `runs` and `spans` carry status, timing, and credits, but no node input/output columns.\n\n## Downloading batch results\n\n```bash\ncargo-ai orchestration batch download --uuid <batch-uuid> --output-node-slug <node-slug>\n```\n\nTo find the `output-node-slug`: run `cargo-ai orchestration release get <release-uuid>` (get the release UUID from the batch) and look at `nodes[].slug`.\n\n## Handling partial batch failures\n\nA batch with `status: \"success\"` can still contain individual run failures. Always inspect the batch for errors before treating results as complete.\n\n**Step 1 — Check the batch summary:**\n\n```bash\ncargo-ai orchestration batch get <batch-uuid>\n# → .runsCount          = total records submitted\n# → .executedRunsCount  = records that reached a terminal state (success or error)\n# → .failedRunsCount    = records that errored\n```\n\n**Step 2 — Count and download the failed runs:**\n\n```bash\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --batch-uuid <batch-uuid> \\\n  --statuses error\n\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --batch-uuid <batch-uuid> \\\n  --statuses error\n```\n\n**Step 3 — Diagnose.** Working out *why* they failed — grouping failures by root cause, picking exemplar runs, reading `runContext` — is the `cargo-diagnostics` skill's job: load `../cargo-diagnostics/references/batch-error-sweep.md` and feed it the batch UUID.\n\n**Step 4 — Re-run only the failed records:**\n\nAfter the diagnosis and fixing the underlying issue (connector credentials, bad input data, rate limits):\n\n```bash\n# Extract record IDs from the failed run download, then:\ncargo-ai orchestration batch create \\\n  --workflow-uuid <uuid> \\\n  --data '{\"kind\":\"recordIds\",\"recordIds\":[\"id1\",\"id2\",\"id3\"]}'\n```\n\n**Filtering by node output slug:**\n\nTo download only a specific node's output from a batch (e.g. just the enrichment node, not the full run):\n\n```bash\n# 1. Get the release UUID from the batch\ncargo-ai orchestration batch get <batch-uuid>\n# → .releaseUuid\n\n# 2. Find the node slug\ncargo-ai orchestration release get <release-uuid>\n# → nodes[].slug\n\n# 3. Download that node's output\ncargo-ai orchestration batch download \\\n  --uuid <batch-uuid> \\\n  --output-node-slug <node-slug>\n```\n\n## Segment data export\n\nFilter JSON uses `conjonction` (not `conjunction`) — this is intentional. See the `cargo-orchestration` skill's `references/filter-syntax.md` for the full filter syntax.\n\n```bash\n# Full export (all records)\ncargo-ai segmentation segment download \\\n  --model-uuid <uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}'\n\n# With sorting and limit\ncargo-ai segmentation segment download \\\n  --model-uuid <uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}' \\\n  --sort '[{\"columnSlug\":\"created_at\",\"kind\":\"desc\"}]' \\\n  --limit 1000\n```\n\n**IMPORTANT:** `segment download` requires `--model-uuid`, not `--segment-uuid`. Get the `modelUuid` from `segment list`.\n\nFor live paginated queries with enrichment, use `segmentation segment fetch` from the `cargo-orchestration` skill.\n\n## Help\n\nEvery command supports `--help`:\n\n```bash\ncargo-ai billing usage get-metrics --help\ncargo-ai orchestration run download --help\ncargo-ai segmentation segment download --help\n```\n\nFile v1.5.0:_meta.json\n\n{\n  \"ownerId\": \"kn7by8t6yt9yghbxtxz6hv0bts87k6bq\",\n  \"slug\": \"cargo-analytics\",\n  \"version\": \"1.5.0\",\n  \"publishedAt\": 1786753480265\n}\n\nFile v1.5.0:references/examples/exports.md\n\n# Data export examples\n\n## Download all finished runs\n\n```bash\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --is-finished\n```\n\n## Download runs by status\n\n```bash\n# Only successful runs\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --statuses success\n\n# Both success and error (for analysis)\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --statuses success,error\n\n# Only error runs (for debugging)\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --statuses error\n```\n\n## Download runs in a date range\n\n```bash\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --created-after 2025-01-01 \\\n  --created-before 2025-01-31\n```\n\n## Download runs from a specific batch\n\n```bash\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --batch-uuid <batch-uuid>\n```\n\n## Download batch output by node\n\n```bash\n# 1. Get the batch and its release UUID\ncargo-ai orchestration batch get <batch-uuid>\n# → Extract releaseUuid\n\n# 2. Find the output node slug\ncargo-ai orchestration release get <release-uuid>\n# → Read nodes[].slug — pick the output node's slug\n\n# 3. Download\ncargo-ai orchestration batch download \\\n  --uuid <batch-uuid> \\\n  --output-node-slug <node-slug>\n```\n\n## Export all segment data\n\n```bash\n# 1. List segments to find the modelUuid\ncargo-ai segmentation segment list\n# → Extract modelUuid (NOT segment uuid)\n\n# 2. Full export\ncargo-ai segmentation segment download \\\n  --model-uuid <model-uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}'\n```\n\n## Export segment data with sorting and limit\n\n```bash\ncargo-ai segmentation segment download \\\n  --model-uuid <model-uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}' \\\n  --sort '[{\"columnSlug\":\"created_at\",\"kind\":\"desc\"}]' \\\n  --limit 5000\n```\n\n## Export filtered segment data\n\n```bash\n# Export only churned accounts\ncargo-ai segmentation segment download \\\n  --model-uuid <model-uuid> \\\n  --filter '{\n    \"conjonction\": \"and\",\n    \"groups\": [{\n      \"conjonction\": \"and\",\n      \"conditions\": [\n        {\"kind\": \"string\", \"columnSlug\": \"status\", \"operator\": \"is\", \"values\": [\"churned\"]}\n      ]\n    }]\n  }'\n\n# Export US companies with 100+ employees\ncargo-ai segmentation segment download \\\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      ]\n    }]\n  }'\n\n# Export records created after a date\ncargo-ai segmentation segment download \\\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```\n\n## Export a segment with non-null email\n\n```bash\ncargo-ai segmentation segment download \\\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```\n\nFile v1.5.0:references/examples/run-analytics.md\n\n# Run analytics examples\n\n## Get metrics for a workflow\n\n```bash\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid>\n```\n\nResponse:\n\n```json\n{\n  \"runMetrics\": [\n    {\n      \"nodeUuid\": \"node-uuid-1\",\n      \"totalExecutionsCount\": 1000,\n      \"successExecutionsCount\": 950,\n      \"errorExecutionsCount\": 30,\n      \"cancelledExecutionsCount\": 5,\n      \"creditsUsedCount\": 450\n    }\n  ]\n}\n```\n\nError rate per node = `errorExecutionsCount / totalExecutionsCount`. High error rate on a specific node means that step is failing.\n\n## Metrics scoped to a specific release\n\n```bash\ncargo-ai orchestration run get-metrics \\\n  --workflow-uuid <uuid> \\\n  --release-uuid <release-uuid>\n```\n\n## Metrics scoped to a specific batch\n\n```bash\ncargo-ai orchestration run get-metrics \\\n  --workflow-uuid <uuid> \\\n  --batch-uuid <batch-uuid>\n```\n\n## Metrics for a date range\n\n```bash\ncargo-ai orchestration run get-metrics \\\n  --workflow-uuid <uuid> \\\n  --created-after 2025-01-01 \\\n  --created-before 2025-01-31\n```\n\n## Count errors\n\n```bash\n# Total error count\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses error\n```\n\nResponse:\n\n```json\n{ \"count\": 42 }\n```\n\n```bash\n# Errors in a specific period\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses error \\\n  --created-after 2025-01-15 \\\n  --created-before 2025-01-16\n\n# Errors in a specific batch\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses error \\\n  --batch-uuid <batch-uuid>\n```\n\n## Count finished runs\n\n```bash\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --is-finished\n\n# In a date range\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --is-finished \\\n  --created-after 2025-01-01 \\\n  --created-before 2025-01-31\n```\n\n## Count successful runs\n\n```bash\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses success\n```\n\n## Per-workflow cost analysis (full flow)\n\n```bash\n# 1. List workflows\ncargo-ai orchestration workflow list\n\n# 2. Get usage grouped by workflow\ncargo-ai billing usage get-metrics \\\n  --from 2025-01-01 --to 2025-01-31 \\\n  --group-by workflow_uuid\n\n# 3. Drill into a specific workflow\ncargo-ai billing usage get-metrics \\\n  --from 2025-01-01 --to 2025-01-31 \\\n  --workflow-uuid <uuid>\n\n# 4. Get run-level metrics\ncargo-ai orchestration run get-metrics \\\n  --workflow-uuid <uuid> \\\n  --created-after 2025-01-01 \\\n  --created-before 2025-01-31\n```\n\n## Error monitoring and debugging (full flow)\n\n```bash\n# 1. Count errors\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses error\n\n# 2. Spot-check: count errors in the last 24 hours\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses error \\\n  --created-after 2025-01-15 \\\n  --created-before 2025-01-16\n\n# 3. Download error runs for inspection\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --statuses error \\\n  --created-after 2025-01-15\n\n# 4. Check per-node error rates\ncargo-ai orchestration run get-metrics \\\n  --workflow-uuid <uuid>\n# → Compare errorExecutionsCount vs totalExecutionsCount per node\n# → High error rate on a specific node = that step is failing\n```\n\nThis flow ends at **detection** — you now know how many runs fail and which node is the hotspot. To explain *why* (group failures by root cause, trace exemplar runs through `runContext`), continue with the `cargo-diagnostics` skill: `../../../cargo-diagnostics/references/batch-error-sweep.md`, then `run-trace.md` on the exemplars it hands back.\n\n## List runs with filters\n\n```bash\n# All runs for a workflow (paginated)\ncargo-ai orchestration run list \\\n  --workflow-uuid <uuid> \\\n  --limit 20\n\n# Only error runs\ncargo-ai orchestration run list \\\n  --workflow-uuid <uuid> \\\n  --statuses error \\\n  --limit 10\n\n# Runs from a specific batch\ncargo-ai orchestration run list \\\n  --workflow-uuid <uuid> \\\n  --batch-uuid <batch-uuid>\n\n# Runs for a specific record\ncargo-ai orchestration run list \\\n  --workflow-uuid <uuid> \\\n  --record-id <record-id>\n```\n\nFile v1.5.0:references/response-shapes.md\n\n# Response shapes\n\nJSON response structures returned by Cargo CLI commands used in the `cargo-analytics` skill.\n\n> For billing response shapes (usage metrics, subscription, invoices), see the `cargo-billing` skill.\n\n## cargo-ai orchestration run get-metrics\n\n```json\n{\n  \"runMetrics\": [\n    {\n      \"nodeUuid\": \"node-uuid-1\",\n      \"totalExecutionsCount\": 1000,\n      \"idleExecutionsCount\": 0,\n      \"pendingExecutionsCount\": 5,\n      \"runningExecutionsCount\": 10,\n      \"successExecutionsCount\": 950,\n      \"errorExecutionsCount\": 30,\n      \"cancelledExecutionsCount\": 5,\n      \"skippedExecutionsCount\": 0,\n      \"creditsUsedCount\": 450\n    }\n  ]\n}\n```\n\n**Key fields:** `nodeUuid` (identifies the workflow node), `successExecutionsCount`, `errorExecutionsCount`, `creditsUsedCount`.\n\nTo compute an error rate: `errorExecutionsCount / totalExecutionsCount`.\n\n## cargo-ai orchestration run count\n\n```json\n{\n  \"count\": 42\n}\n```\n\n## cargo-ai orchestration run list\n\n```json\n{\n  \"runs\": [\n    {\n      \"uuid\": \"run-uuid\",\n      \"workflowUuid\": \"...\",\n      \"status\": \"success\",\n      \"batchUuid\": \"batch-uuid-or-null\",\n      \"releaseUuid\": \"...\",\n      \"recordId\": \"rec-123\",\n      \"recordTitle\": \"Acme Corp\",\n      \"createdAt\": \"2025-01-15T10:00:00Z\",\n      \"finishedAt\": \"2025-01-15T10:00:05Z\"\n    }\n  ]\n}\n```\n\n## cargo-ai segmentation segment download\n\nReturns raw data as a downloadable payload (typically CSV or JSON depending on the CLI output format). The response is streamed to stdout.\n\n## cargo-ai orchestration batch download\n\nReturns `{\"url\": \"...\"}` — a signed URL to a file, **not** the data on stdout. Each row is a batch record joined to its run's output for the chosen node (defaulting to the last executed node), so a record whose run errored comes back with its input fields and no output.\n\n## cargo-ai orchestration run download\n\nReturns `{\"url\": \"...\"}` — a signed URL to a **gzipped CSV**. One row per run: `_uuid`, `_workspace_uuid`, `_workflow_uuid`, `_record_id`, `_record_title`, `_created_at`, `_finished_at`, `_status`, `_error_message`, then one column per node slug holding that execution's `title` (a truncated summary, not the node's output). No `runContext`, no `executions[]`.\n\n## cargo-ai orchestration run download-outputs\n\nReturns `{\"url\": \"...\"}` — a signed URL to CSV (default) or JSON. One row per run: the `_`-prefixed run metadata above, plus `input` (first node's resolved config) and `output` (chosen node's context, defaulting to the last executed node).\n\nFile v1.5.0:references/troubleshooting.md\n\n# Troubleshooting\n\nCommon errors and recovery steps for `cargo-analytics` commands.\n\n## General\n\n| Symptom | Cause | Fix |\n|---------|-------|-----|\n| `{\"errorMessage\": \"...\"}` with non-zero exit | Any CLI error | Read the `errorMessage` — it usually says exactly what's wrong |\n| `command not found: cargo-ai` | CLI not installed or not in PATH | Run `npm install -g @cargo-ai/cli` or prefix with `npx @cargo-ai/cli` |\n| `Unauthorized` or `Forbidden` | Bad or expired credentials | Re-run `cargo-ai login --oauth` (browser sign-in) or `cargo-ai login --token <token>`; verify with `cargo-ai whoami` |\n\n## Run metrics and counts\n\n| Symptom | Cause | Fix |\n|---------|-------|-----|\n| `run get-metrics` returns empty array | No runs exist for that workflow/period | Verify the `--workflow-uuid`; try without date filters to check if any runs exist |\n| Error count seems too high | Counting across all time | Scope with `--created-after` and `--created-before` for a specific period |\n| `run count` returns 0 unexpectedly | Filter combination too narrow | Remove filters one at a time to isolate which one excludes all runs |\n\n## Downloads and exports\n\n| Symptom | Cause | Fix |\n|---------|-------|-----|\n| `run download` returns empty | No runs match the filters | Loosen filters — drop the date and status constraints and pass `--workflow-uuid` alone |\n| `run download` returns `500 Internal Server Error` | The workflow resolves to zero active nodes — all archived, or the UUID doesn't exist in this workspace. The export builds one column per node slug, so there is nothing to select | Confirm the UUID with `workflow list` / `play list`. Loosening filters won't help; the failure is about the workflow, not the runs |\n| `400 unrecognized_keys: <flag>` on a run command | The CLI offers a flag the API's request schema doesn't accept | Drop the flag and express the filter another way — `--statuses success,error` covers \"finished\". Then report it: `workspaceManagement report create` |\n| `batch download` fails with \"node not found\" | Wrong `--output-node-slug` | Re-run `release get <release-uuid>` and check `nodes[].slug` for the correct value |\n| `segment download` returns empty | Wrong model UUID or over-filtered | Verify `--model-uuid` (not `--segment-uuid`); try empty filter `{\"conjonction\":\"and\",\"groups\":[]}` first |\n| Parse error on filter JSON | Malformed JSON or wrong spelling | Check: it's `conjonction` (not `conjunction`); validate JSON syntax; see the `cargo-orchestration` skill's `references/filter-syntax.md` |\n\nFile v1.5.0:skill-card.md\n\n## Description:\n\nCargo Analytics helps agents retrieve Cargo workflow run outputs, export segments or models to CSV or JSON, and report run or batch success and error counts.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[cargo-ai](https://clawhub.ai/user/cargo-ai)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nDevelopers, operators, and Cargo workspace users use this skill to monitor workflow runs, calculate error rates, download run or batch outputs, and export segment data while leaving diagnostics and billing questions to companion skills.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The skill can export broad Cargo workspace data, including segment data and run outputs.\n\nMitigation: Confirm the active workspace, workflow or model UUID, filters, row limits, and intended recipient before generating or sharing exports.\n\nRisk: Some commands return signed download URLs for CSV or JSON results.\n\nMitigation: Require explicit approval before sharing signed URLs, and treat downloaded files as workspace data subject to the user's access controls.\n\nRisk: The failed-record rerun workflow can create new processing batches.\n\nMitigation: Require explicit approval before reruns and verify the selected record IDs, workflow UUID, and scope.\n\n## Reference(s):\n\n- [Cargo Analytics ClawHub listing](https://clawhub.ai/cargo-ai/skills/cargo-analytics)\n- [Cargo Skills homepage](https://github.com/getcargohq/cargo-skills)\n- [Data export examples](references/examples/exports.md)\n- [Run analytics examples](references/examples/run-analytics.md)\n- [Response shapes](references/response-shapes.md)\n- [Troubleshooting](references/troubleshooting.md)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, shell commands, configuration, guidance]\n\n**Output Format:** [Markdown guidance with inline shell commands and JSON response examples]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [May direct the agent to produce or handle CSV, JSON, gzipped CSV, signed download URLs, and scoped analytics queries.]\n\n## Skill Version(s):\n\n1.5.0 (source: frontmatter, skill-metadata.json, server release evidence)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.5.0:skill-metadata.json\n\n{\n  \"$comment\": \"Generated by .github/scripts/skills-metadata.mjs — do not hand-edit. Regenerate with: node .github/scripts/skills-metadata.mjs --write .\",\n  \"name\": \"cargo-analytics\",\n  \"version\": \"1.5.0\",\n  \"documents\": [\n    {\n      \"path\": \"SKILL.md\",\n      \"kind\": \"entrypoint\",\n      \"title\": \"Cargo CLI — Analytics\"\n    },\n    {\n      \"path\": \"references/examples/exports.md\",\n      \"kind\": \"example\",\n      \"title\": \"Data export examples\"\n    },\n    {\n      \"path\": \"references/examples/run-analytics.md\",\n      \"kind\": \"example\",\n      \"title\": \"Run analytics examples\"\n    },\n    {\n      \"path\": \"references/response-shapes.md\",\n      \"kind\": \"reference\",\n      \"title\": \"Response shapes\"\n    },\n    {\n      \"path\": \"references/troubleshooting.md\",\n      \"kind\": \"reference\",\n      \"title\": \"Troubleshooting\"\n    }\n  ],\n  \"contentHash\": \"47b4bd3af2fbc699c1d92eaf2a7b5b98d83aa11f1591679563c2fb3ec8a0f0e9\"\n}\n\nArchive v1.4.3: 8 files, 10497 bytes\n\nFiles: references/examples/exports.md (3290b), references/examples/run-analytics.md (4041b), references/response-shapes.md (1643b), references/troubleshooting.md (1887b), skill-card.md (2419b), skill-metadata.json (920b), SKILL.md (12257b), _meta.json (134b)\n\nFile v1.4.3:SKILL.md\n\n---\nname: cargo-analytics\ndescription: Download workflow run results, export segment data, and monitor run metrics using the Cargo CLI. Use when the user wants run metrics, error rates, data export, or download results for their Cargo workspace. For billing and credit usage, use the cargo-billing skill instead. For explaining WHY a run failed or a batch has errors, use the cargo-diagnostics skill instead.\nversion: \"1.4.3\"\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 — Analytics\n\nMeasurement and export: monitoring run metrics, downloading run and batch results, and exporting segment data.\n\n> See `references/response-shapes.md` for full JSON response structures.\n> See `references/troubleshooting.md` for common errors and how to fix them.\n> See `references/examples/run-analytics.md` for run metrics and error monitoring.\n> See `references/examples/exports.md` for data export and download examples.\n> For billing, usage metrics, and subscription: use the `cargo-billing` skill.\n\n## Scope — measure and export, not explain\n\nThis skill answers **\"what happened\"** and **\"give me the data\"**: metrics, counts, downloads, exports. The moment the question becomes **\"why\"** — why did this run fail, why is the output wrong or empty, which root cause explains these errors, why is this play so expensive — switch to the `cargo-diagnostics` skill; its runbooks sequence the raw surfaces into a diagnosis.\n\n| The question sounds like… | Load |\n| --- | --- |\n| \"What's the error rate?\" / \"How many runs failed this week?\" / \"Export the results / segment\" | **this skill** |\n| \"Why did this run fail?\" / \"Run succeeded but the output looks wrong\" | `cargo-diagnostics` → `references/run-trace.md` |\n| \"Why does this batch have errors? Which node keeps failing, and is it one cause or many?\" | `cargo-diagnostics` → `references/batch-error-sweep.md` |\n| \"Why is this play so expensive? Where do the credits go?\" | `cargo-diagnostics` → `references/play-optimize-credits.md` |\n\nThe two skills chain naturally: analytics **detects** (error rate spiked, batch reports failures), diagnostics **explains** (18 of 20 failures share one root cause), then analytics **retrieves** the clean results once the cause is fixed and the runs re-executed.\n\n## Prerequisites\n\nSee [`../cargo/references/prerequisites.md`](../cargo/references/prerequisites.md) for install, login (`--oauth` / `--token`), JSON output conventions, and error shapes. Verify the session with `cargo-ai whoami` before running any of the commands below.\n\n## Discover resources first\n\nMost analytics commands require UUIDs. Discover them before querying.\n\n```bash\ncargo-ai orchestration play list            # all plays (name, workflowUuid)\ncargo-ai orchestration tool list            # all tools (name, workflowUuid)\ncargo-ai orchestration workflow list        # all workflows (uuid only — no name)\ncargo-ai ai agent list                     # all agents (uuid, name)\ncargo-ai connection connector list          # all connectors (uuid, name, integrationSlug)\ncargo-ai storage model list                # all models (uuid, name, slug)\n```\n\n## Quick reference\n\n```bash\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid>\ncargo-ai orchestration run download --workflow-uuid <uuid> --is-finished\ncargo-ai orchestration run count --workflow-uuid <uuid> --statuses error\ncargo-ai orchestration query execute \"SELECT status, count() FROM runs GROUP BY status\"\ncargo-ai segmentation segment download --model-uuid <uuid> --filter '{\"conjonction\":\"and\",\"groups\":[]}'\n```\n\n**Picking the right command:**\n\n- `run get-metrics` / `run count` — workflow-scoped, predefined aggregations. Best when you already have a `workflowUuid`.\n- `orchestration query execute` — ad-hoc SQL across the entire workspace (`runs`, `batches`, `spans`, `records`). Best for cross-workflow analytics, per-node breakdowns, and time-series.\n- `run download` / `run download-outputs` — per-record output retrieval.\n- `segment download` / `storage query execute` — storage data (Companies, Contacts, …).\n\n## Workflow run metrics\n\nAggregated metrics for workflow runs (success/error rates, credits per node).\n\n```bash\n# Metrics for a workflow\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid>\n\n# Scoped to a release, batch, or date range\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid> --release-uuid <uuid>\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid> --batch-uuid <uuid>\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid> \\\n  --created-after <start-date> --created-before <end-date>\n```\n\n## Run count\n\nCount runs matching specific criteria — useful for monitoring.\n\n```bash\ncargo-ai orchestration run count --workflow-uuid <uuid> --statuses error\ncargo-ai orchestration run count --workflow-uuid <uuid> --is-finished \\\n  --created-after <start-date> --created-before <end-date>\ncargo-ai orchestration run count --workflow-uuid <uuid> --batch-uuid <uuid>\n```\n\nSupports: `--statuses`, `--batch-uuid`, `--release-uuid`, `--is-finished`, `--created-after`, `--created-before`, `--record-id`, `--record-title`.\n\nFor cross-workflow analytics or shapes that `run count` doesn't expose (per-node failure breakdowns, p95 durations, error rate over time), use `orchestration query execute` — see the [Ad-hoc execution analytics](#ad-hoc-execution-analytics-orchestration-query) section.\n\n## Ad-hoc execution analytics (`orchestration query`)\n\nRun SQL against orchestration runtime tables — `runs`, `batches`, `spans`, `records` — for analytics that the canned metrics commands don't cover. Tables are referenced without a schema prefix; workspace scoping is automatic. See `cargo-orchestration/references/examples/queries.md` for schemas and limits.\n\n```bash\n# Error rate across the workspace in the last day\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# Failed runs per workflow this 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# Per-node failure counts (last 24h)\ncargo-ai orchestration query execute \\\n  \"SELECT node_slug, count() AS failures FROM spans WHERE execution_status='error' AND execution_started_at > now() - INTERVAL 1 DAY GROUP BY node_slug 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 FROM batches WHERE created_at >= toStartOfMonth(now()) GROUP BY workflow_uuid ORDER BY credits DESC\"\n```\n\nRead-only and capped: 30s execution time, 10 000 result rows, 10 000 000 rows scanned. Narrow with a `created_at`/`execution_started_at` predicate to stay under the row-scan cap.\n\n## Downloading run results\n\nTwo distinct commands — pick the right one for the job.\n\n### `run download` — full run records (metadata + per-node `runContext`)\n\nReturns each run as a JSON object with status, timing, executions, and `runContext.<nodeSlug>` containing per-node outputs. Best for debugging or when you need the full execution history.\n\n```bash\n# All finished runs\ncargo-ai orchestration run download --workflow-uuid <uuid> --is-finished\n\n# Date range\ncargo-ai orchestration run download --workflow-uuid <uuid> \\\n  --created-after <start-date> --created-before <end-date>\n\n# Specific statuses\ncargo-ai orchestration run download --workflow-uuid <uuid> --statuses success,error\n\n# From a specific batch\ncargo-ai orchestration run download --workflow-uuid <uuid> --batch-uuid <uuid>\n```\n\n### `run download-outputs` — output of a specific node (CSV/JSON via signed URL)\n\n**This is the canonical way to get action results out of the platform.** Maps to API `POST /v1/orchestration/runs/download-outputs`. Returns `{\"url\": \"...\"}` — a signed URL to a CSV (default) or JSON file containing only the output node's data with input/output context. Faster and cheaper than downloading whole run records when you only need the result.\n\n```bash\n# Required: --workflow-uuid + --output-node-slug\ncargo-ai orchestration run download-outputs \\\n  --workflow-uuid <uuid> \\\n  --output-node-slug <slug> \\\n  --format json \\\n  --is-finished\n\n# Filter by batch + status\ncargo-ai orchestration run download-outputs \\\n  --workflow-uuid <uuid> \\\n  --output-node-slug <slug> \\\n  --batch-uuid <uuid> \\\n  --statuses finished\n```\n\nTo find the `output-node-slug`: `cargo-ai orchestration release get <release-uuid>` → look at `nodes[].slug`. The terminal output node is typically named `output` or `end`.\n\n## Downloading batch results\n\n```bash\ncargo-ai orchestration batch download --uuid <batch-uuid> --output-node-slug <node-slug>\n```\n\nTo find the `output-node-slug`: run `cargo-ai orchestration release get <release-uuid>` (get the release UUID from the batch) and look at `nodes[].slug`.\n\n## Handling partial batch failures\n\nA batch with `status: \"success\"` can still contain individual run failures. Always inspect the batch for errors before treating results as complete.\n\n**Step 1 — Check the batch summary:**\n\n```bash\ncargo-ai orchestration batch get <batch-uuid>\n# → .runsCount          = total records submitted\n# → .executedRunsCount  = records that reached a terminal state (success or error)\n# → .failedRunsCount    = records that errored\n```\n\n**Step 2 — Count and download the failed runs:**\n\n```bash\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --batch-uuid <batch-uuid> \\\n  --statuses error\n\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --batch-uuid <batch-uuid> \\\n  --statuses error\n```\n\n**Step 3 — Diagnose.** Working out *why* they failed — grouping failures by root cause, picking exemplar runs, reading `runContext` — is the `cargo-diagnostics` skill's job: load `../cargo-diagnostics/references/batch-error-sweep.md` and feed it the batch UUID.\n\n**Step 4 — Re-run only the failed records:**\n\nAfter the diagnosis and fixing the underlying issue (connector credentials, bad input data, rate limits):\n\n```bash\n# Extract record IDs from the failed run download, then:\ncargo-ai orchestration batch create \\\n  --workflow-uuid <uuid> \\\n  --data '{\"kind\":\"recordIds\",\"recordIds\":[\"id1\",\"id2\",\"id3\"]}'\n```\n\n**Filtering by node output slug:**\n\nTo download only a specific node's output from a batch (e.g. just the enrichment node, not the full run):\n\n```bash\n# 1. Get the release UUID from the batch\ncargo-ai orchestration batch get <batch-uuid>\n# → .releaseUuid\n\n# 2. Find the node slug\ncargo-ai orchestration release get <release-uuid>\n# → nodes[].slug\n\n# 3. Download that node's output\ncargo-ai orchestration batch download \\\n  --uuid <batch-uuid> \\\n  --output-node-slug <node-slug>\n```\n\n## Segment data export\n\nFilter JSON uses `conjonction` (not `conjunction`) — this is intentional. See the `cargo-orchestration` skill's `references/filter-syntax.md` for the full filter syntax.\n\n```bash\n# Full export (all records)\ncargo-ai segmentation segment download \\\n  --model-uuid <uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}'\n\n# With sorting and limit\ncargo-ai segmentation segment download \\\n  --model-uuid <uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}' \\\n  --sort '[{\"columnSlug\":\"created_at\",\"kind\":\"desc\"}]' \\\n  --limit 1000\n```\n\n**IMPORTANT:** `segment download` requires `--model-uuid`, not `--segment-uuid`. Get the `modelUuid` from `segment list`.\n\nFor live paginated queries with enrichment, use `segmentation segment fetch` from the `cargo-orchestration` skill.\n\n## Help\n\nEvery command supports `--help`:\n\n```bash\ncargo-ai billing usage get-metrics --help\ncargo-ai orchestration run download --help\ncargo-ai segmentation segment download --help\n```\n\nFile v1.4.3:_meta.json\n\n{\n  \"ownerId\": \"kn7by8t6yt9yghbxtxz6hv0bts87k6bq\",\n  \"slug\": \"cargo-analytics\",\n  \"version\": \"1.4.3\",\n  \"publishedAt\": 1786484650614\n}\n\nFile v1.4.3:references/examples/exports.md\n\n# Data export examples\n\n## Download all finished runs\n\n```bash\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --is-finished\n```\n\n## Download runs by status\n\n```bash\n# Only successful runs\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --statuses success\n\n# Both success and error (for analysis)\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --statuses success,error\n\n# Only error runs (for debugging)\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --statuses error\n```\n\n## Download runs in a date range\n\n```bash\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --created-after 2025-01-01 \\\n  --created-before 2025-01-31\n```\n\n## Download runs from a specific batch\n\n```bash\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --batch-uuid <batch-uuid>\n```\n\n## Download batch output by node\n\n```bash\n# 1. Get the batch and its release UUID\ncargo-ai orchestration batch get <batch-uuid>\n# → Extract releaseUuid\n\n# 2. Find the output node slug\ncargo-ai orchestration release get <release-uuid>\n# → Read nodes[].slug — pick the output node's slug\n\n# 3. Download\ncargo-ai orchestration batch download \\\n  --uuid <batch-uuid> \\\n  --output-node-slug <node-slug>\n```\n\n## Export all segment data\n\n```bash\n# 1. List segments to find the modelUuid\ncargo-ai segmentation segment list\n# → Extract modelUuid (NOT segment uuid)\n\n# 2. Full export\ncargo-ai segmentation segment download \\\n  --model-uuid <model-uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}'\n```\n\n## Export segment data with sorting and limit\n\n```bash\ncargo-ai segmentation segment download \\\n  --model-uuid <model-uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}' \\\n  --sort '[{\"columnSlug\":\"created_at\",\"kind\":\"desc\"}]' \\\n  --limit 5000\n```\n\n## Export filtered segment data\n\n```bash\n# Export only churned accounts\ncargo-ai segmentation segment download \\\n  --model-uuid <model-uuid> \\\n  --filter '{\n    \"conjonction\": \"and\",\n    \"groups\": [{\n      \"conjonction\": \"and\",\n      \"conditions\": [\n        {\"kind\": \"string\", \"columnSlug\": \"status\", \"operator\": \"is\", \"values\": [\"churned\"]}\n      ]\n    }]\n  }'\n\n# Export US companies with 100+ employees\ncargo-ai segmentation segment download \\\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      ]\n    }]\n  }'\n\n# Export records created after a date\ncargo-ai segmentation segment download \\\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```\n\n## Export a segment with non-null email\n\n```bash\ncargo-ai segmentation segment download \\\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```\n\nFile v1.4.3:references/examples/run-analytics.md\n\n# Run analytics examples\n\n## Get metrics for a workflow\n\n```bash\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid>\n```\n\nResponse:\n\n```json\n{\n  \"runMetrics\": [\n    {\n      \"nodeUuid\": \"node-uuid-1\",\n      \"totalExecutionsCount\": 1000,\n      \"successExecutionsCount\": 950,\n      \"errorExecutionsCount\": 30,\n      \"cancelledExecutionsCount\": 5,\n      \"creditsUsedCount\": 450\n    }\n  ]\n}\n```\n\nError rate per node = `errorExecutionsCount / totalExecutionsCount`. High error rate on a specific node means that step is failing.\n\n## Metrics scoped to a specific release\n\n```bash\ncargo-ai orchestration run get-metrics \\\n  --workflow-uuid <uuid> \\\n  --release-uuid <release-uuid>\n```\n\n## Metrics scoped to a specific batch\n\n```bash\ncargo-ai orchestration run get-metrics \\\n  --workflow-uuid <uuid> \\\n  --batch-uuid <batch-uuid>\n```\n\n## Metrics for a date range\n\n```bash\ncargo-ai orchestration run get-metrics \\\n  --workflow-uuid <uuid> \\\n  --created-after 2025-01-01 \\\n  --created-before 2025-01-31\n```\n\n## Count errors\n\n```bash\n# Total error count\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses error\n```\n\nResponse:\n\n```json\n{ \"count\": 42 }\n```\n\n```bash\n# Errors in a specific period\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses error \\\n  --created-after 2025-01-15 \\\n  --created-before 2025-01-16\n\n# Errors in a specific batch\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses error \\\n  --batch-uuid <batch-uuid>\n```\n\n## Count finished runs\n\n```bash\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --is-finished\n\n# In a date range\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --is-finished \\\n  --created-after 2025-01-01 \\\n  --created-before 2025-01-31\n```\n\n## Count successful runs\n\n```bash\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses success\n```\n\n## Per-workflow cost analysis (full flow)\n\n```bash\n# 1. List workflows\ncargo-ai orchestration workflow list\n\n# 2. Get usage grouped by workflow\ncargo-ai billing usage get-metrics \\\n  --from 2025-01-01 --to 2025-01-31 \\\n  --group-by workflow_uuid\n\n# 3. Drill into a specific workflow\ncargo-ai billing usage get-metrics \\\n  --from 2025-01-01 --to 2025-01-31 \\\n  --workflow-uuid <uuid>\n\n# 4. Get run-level metrics\ncargo-ai orchestration run get-metrics \\\n  --workflow-uuid <uuid> \\\n  --created-after 2025-01-01 \\\n  --created-before 2025-01-31\n```\n\n## Error monitoring and debugging (full flow)\n\n```bash\n# 1. Count errors\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses error\n\n# 2. Spot-check: count errors in the last 24 hours\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses error \\\n  --created-after 2025-01-15 \\\n  --created-before 2025-01-16\n\n# 3. Download error runs for inspection\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --statuses error \\\n  --created-after 2025-01-15\n\n# 4. Check per-node error rates\ncargo-ai orchestration run get-metrics \\\n  --workflow-uuid <uuid>\n# → Compare errorExecutionsCount vs totalExecutionsCount per node\n# → High error rate on a specific node = that step is failing\n```\n\nThis flow ends at **detection** — you now know how many runs fail and which node is the hotspot. To explain *why* (group failures by root cause, trace exemplar runs through `runContext`), continue with the `cargo-diagnostics` skill: `../../../cargo-diagnostics/references/batch-error-sweep.md`, then `run-trace.md` on the exemplars it hands back.\n\n## List runs with filters\n\n```bash\n# All runs for a workflow (paginated)\ncargo-ai orchestration run list \\\n  --workflow-uuid <uuid> \\\n  --limit 20\n\n# Only error runs\ncargo-ai orchestration run list \\\n  --workflow-uuid <uuid> \\\n  --statuses error \\\n  --limit 10\n\n# Runs from a specific batch\ncargo-ai orchestration run list \\\n  --workflow-uuid <uuid> \\\n  --batch-uuid <batch-uuid>\n\n# Runs for a specific record\ncargo-ai orchestration run list \\\n  --workflow-uuid <uuid> \\\n  --record-id <record-id>\n```\n\nFile v1.4.3:references/response-shapes.md\n\n# Response shapes\n\nJSON response structures returned by Cargo CLI commands used in the `cargo-analytics` skill.\n\n> For billing response shapes (usage metrics, subscription, invoices), see the `cargo-billing` skill.\n\n## cargo-ai orchestration run get-metrics\n\n```json\n{\n  \"runMetrics\": [\n    {\n      \"nodeUuid\": \"node-uuid-1\",\n      \"totalExecutionsCount\": 1000,\n      \"idleExecutionsCount\": 0,\n      \"pendingExecutionsCount\": 5,\n      \"runningExecutionsCount\": 10,\n      \"successExecutionsCount\": 950,\n      \"errorExecutionsCount\": 30,\n      \"cancelledExecutionsCount\": 5,\n      \"skippedExecutionsCount\": 0,\n      \"creditsUsedCount\": 450\n    }\n  ]\n}\n```\n\n**Key fields:** `nodeUuid` (identifies the workflow node), `successExecutionsCount`, `errorExecutionsCount`, `creditsUsedCount`.\n\nTo compute an error rate: `errorExecutionsCount / totalExecutionsCount`.\n\n## cargo-ai orchestration run count\n\n```json\n{\n  \"count\": 42\n}\n```\n\n## cargo-ai orchestration run list\n\n```json\n{\n  \"runs\": [\n    {\n      \"uuid\": \"run-uuid\",\n      \"workflowUuid\": \"...\",\n      \"status\": \"success\",\n      \"batchUuid\": \"batch-uuid-or-null\",\n      \"releaseUuid\": \"...\",\n      \"recordId\": \"rec-123\",\n      \"recordTitle\": \"Acme Corp\",\n      \"createdAt\": \"2025-01-15T10:00:00Z\",\n      \"finishedAt\": \"2025-01-15T10:00:05Z\"\n    }\n  ]\n}\n```\n\n## cargo-ai segmentation segment download\n\nReturns raw data as a downloadable payload (typically CSV or JSON depending on the CLI output format). The response is streamed to stdout.\n\n## cargo-ai orchestration batch download\n\nReturns the output data for the specified node as a downloadable payload. The response is streamed to stdout.\n\nFile v1.4.3:references/troubleshooting.md\n\n# Troubleshooting\n\nCommon errors and recovery steps for `cargo-analytics` commands.\n\n## General\n\n| Symptom | Cause | Fix |\n|---------|-------|-----|\n| `{\"errorMessage\": \"...\"}` with non-zero exit | Any CLI error | Read the `errorMessage` — it usually says exactly what's wrong |\n| `command not found: cargo-ai` | CLI not installed or not in PATH | Run `npm install -g @cargo-ai/cli` or prefix with `npx @cargo-ai/cli` |\n| `Unauthorized` or `Forbidden` | Bad or expired credentials | Re-run `cargo-ai login --oauth` (browser sign-in) or `cargo-ai login --token <token>`; verify with `cargo-ai whoami` |\n\n## Run metrics and counts\n\n| Symptom | Cause | Fix |\n|---------|-------|-----|\n| `run get-metrics` returns empty array | No runs exist for that workflow/period | Verify the `--workflow-uuid`; try without date filters to check if any runs exist |\n| Error count seems too high | Counting across all time | Scope with `--created-after` and `--created-before` for a specific period |\n| `run count` returns 0 unexpectedly | Filter combination too narrow | Remove filters one at a time to isolate which one excludes all runs |\n\n## Downloads and exports\n\n| Symptom | Cause | Fix |\n|---------|-------|-----|\n| `run download` returns empty | No runs match the filters | Loosen filters; try `--is-finished` without date or status constraints |\n| `batch download` fails with \"node not found\" | Wrong `--output-node-slug` | Re-run `release get <release-uuid>` and check `nodes[].slug` for the correct value |\n| `segment download` returns empty | Wrong model UUID or over-filtered | Verify `--model-uuid` (not `--segment-uuid`); try empty filter `{\"conjonction\":\"and\",\"groups\":[]}` first |\n| Parse error on filter JSON | Malformed JSON or wrong spelling | Check: it's `conjonction` (not `conjunction`); validate JSON syntax; see the `cargo-orchestration` skill's `references/filter-syntax.md` |\n\nFile v1.4.3:skill-card.md\n\n## Description:\n\nDownload workflow run results, export segment data, and monitor run metrics using the Cargo CLI.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[cargo-ai](https://clawhub.ai/user/cargo-ai)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nDevelopers and operators use this skill to inspect Cargo workspace run metrics, count failures, download run or batch outputs, and export segment data. It supports measurement and retrieval workflows, not root-cause diagnosis or billing analysis.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Authenticated Cargo CLI access can query and export workspace run and segment data.\n\nMitigation: Install and use the skill only in workspaces where the agent is allowed to access that data, and verify the active account with cargo-ai whoami before running commands.\n\nRisk: The failed-record rerun workflow can create new batches, consume credits, and trigger workflow side effects.\n\nMitigation: Require explicit user approval before any cargo-ai orchestration batch create command.\n\nRisk: Large exports or broad analytics queries can retrieve more data than intended.\n\nMitigation: Prefer scoped workflow UUIDs, batch UUIDs, status filters, date ranges, and limits before downloading or exporting results.\n\n## Reference(s):\n\n- [Cargo Analytics on ClawHub](https://clawhub.ai/cargo-ai/skills/cargo-analytics)\n- [Cargo Skills repository](https://github.com/getcargohq/cargo-skills)\n- [Run analytics examples](references/examples/run-analytics.md)\n- [Data export examples](references/examples/exports.md)\n- [Response shapes](references/response-shapes.md)\n- [Troubleshooting](references/troubleshooting.md)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, shell commands, configuration, guidance]\n\n**Output Format:** [Markdown with inline shell commands and JSON examples]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [May produce Cargo CLI commands for analytics queries, exports, downloads, and reruns of failed records.]\n\n## Skill Version(s):\n\n1.4.3 (source: frontmatter, skill-metadata.json, release evidence)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.4.3:skill-metadata.json\n\n{\n  \"$comment\": \"Generated by .github/scripts/skills-metadata.mjs — do not hand-edit. Regenerate with: node .github/scripts/skills-metadata.mjs --write .\",\n  \"name\": \"cargo-analytics\",\n  \"version\": \"1.4.3\",\n  \"documents\": [\n    {\n      \"path\": \"SKILL.md\",\n      \"kind\": \"entrypoint\",\n      \"title\": \"Cargo CLI — Analytics\"\n    },\n    {\n      \"path\": \"references/examples/exports.md\",\n      \"kind\": \"example\",\n      \"title\": \"Data export examples\"\n    },\n    {\n      \"path\": \"references/examples/run-analytics.md\",\n      \"kind\": \"example\",\n      \"title\": \"Run analytics examples\"\n    },\n    {\n      \"path\": \"references/response-shapes.md\",\n      \"kind\": \"reference\",\n      \"title\": \"Response shapes\"\n    },\n    {\n      \"path\": \"references/troubleshooting.md\",\n      \"kind\": \"reference\",\n      \"title\": \"Troubleshooting\"\n    }\n  ],\n  \"contentHash\": \"0fee7f50c2c485aef88d0eb2cced6c27d9af5e6acfccd5386fb424fd1b945fc6\"\n}\n\nArchive v1.4.2: 7 files, 9871 bytes\n\nFiles: references/examples/exports.md (3290b), references/examples/run-analytics.md (4041b), references/response-shapes.md (1643b), references/troubleshooting.md (1887b), skill-card.md (2286b), SKILL.md (12209b), _meta.json (134b)\n\nFile v1.4.2:SKILL.md\n\n---\nname: cargo-analytics\ndescription: Download workflow run results, export segment data, and monitor run metrics using the Cargo CLI. Use when the user wants run metrics, error rates, data export, or download results for their Cargo workspace. For billing and credit usage, use the cargo-billing skill instead. For explaining WHY a run failed or a batch has errors, use the cargo-diagnostics skill instead.\nversion: \"1.4.2\"\ncompatibility: Requires @cargo-ai/cli (npm) and a Cargo account (browser sign-in via --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 — Analytics\n\nMeasurement and export: monitoring run metrics, downloading run and batch results, and exporting segment data.\n\n> See `references/response-shapes.md` for full JSON response structures.\n> See `references/troubleshooting.md` for common errors and how to fix them.\n> See `references/examples/run-analytics.md` for run metrics and error monitoring.\n> See `references/examples/exports.md` for data export and download examples.\n> For billing, usage metrics, and subscription: use the `cargo-billing` skill.\n\n## Scope — measure and export, not explain\n\nThis skill answers **\"what happened\"** and **\"give me the data\"**: metrics, counts, downloads, exports. The moment the question becomes **\"why\"** — why did this run fail, why is the output wrong or empty, which root cause explains these errors, why is this play so expensive — switch to the `cargo-diagnostics` skill; its runbooks sequence the raw surfaces into a diagnosis.\n\n| The question sounds like… | Load |\n| --- | --- |\n| \"What's the error rate?\" / \"How many runs failed this week?\" / \"Export the results / segment\" | **this skill** |\n| \"Why did this run fail?\" / \"Run succeeded but the output looks wrong\" | `cargo-diagnostics` → `references/run-trace.md` |\n| \"Why does this batch have errors? Which node keeps failing, and is it one cause or many?\" | `cargo-diagnostics` → `references/batch-error-sweep.md` |\n| \"Why is this play so expensive? Where do the credits go?\" | `cargo-diagnostics` → `references/play-optimize-credits.md` |\n\nThe two skills chain naturally: analytics **detects** (error rate spiked, batch reports failures), diagnostics **explains** (18 of 20 failures share one root cause), then analytics **retrieves** the clean results once the cause is fixed and the runs re-executed.\n\n## Prerequisites\n\nSee [`../cargo/references/prerequisites.md`](../cargo/references/prerequisites.md) for install, login (`--oauth` / `--token`), JSON output conventions, and error shapes. Verify the session with `cargo-ai whoami` before running any of the commands below.\n\n## Discover resources first\n\nMost analytics commands require UUIDs. Discover them before querying.\n\n```bash\ncargo-ai orchestration play list            # all plays (name, workflowUuid)\ncargo-ai orchestration tool list            # all tools (name, workflowUuid)\ncargo-ai orchestration workflow list        # all workflows (uuid only — no name)\ncargo-ai ai agent list                     # all agents (uuid, name)\ncargo-ai connection connector list          # all connectors (uuid, name, integrationSlug)\ncargo-ai storage model list                # all models (uuid, name, slug)\n```\n\n## Quick reference\n\n```bash\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid>\ncargo-ai orchestration run download --workflow-uuid <uuid> --is-finished\ncargo-ai orchestration run count --workflow-uuid <uuid> --statuses error\ncargo-ai orchestration query execute \"SELECT status, count() FROM runs GROUP BY status\"\ncargo-ai segmentation segment download --model-uuid <uuid> --filter '{\"conjonction\":\"and\",\"groups\":[]}'\n```\n\n**Picking the right command:**\n\n- `run get-metrics` / `run count` — workflow-scoped, predefined aggregations. Best when you already have a `workflowUuid`.\n- `orchestration query execute` — ad-hoc SQL across the entire workspace (`runs`, `batches`, `spans`, `records`). Best for cross-workflow analytics, per-node breakdowns, and time-series.\n- `run download` / `run download-outputs` — per-record output retrieval.\n- `segment download` / `storage query execute` — storage data (Companies, Contacts, …).\n\n## Workflow run metrics\n\nAggregated metrics for workflow runs (success/error rates, credits per node).\n\n```bash\n# Metrics for a workflow\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid>\n\n# Scoped to a release, batch, or date range\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid> --release-uuid <uuid>\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid> --batch-uuid <uuid>\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid> \\\n  --created-after <start-date> --created-before <end-date>\n```\n\n## Run count\n\nCount runs matching specific criteria — useful for monitoring.\n\n```bash\ncargo-ai orchestration run count --workflow-uuid <uuid> --statuses error\ncargo-ai orchestration run count --workflow-uuid <uuid> --is-finished \\\n  --created-after <start-date> --created-before <end-date>\ncargo-ai orchestration run count --workflow-uuid <uuid> --batch-uuid <uuid>\n```\n\nSupports: `--statuses`, `--batch-uuid`, `--release-uuid`, `--is-finished`, `--created-after`, `--created-before`, `--record-id`, `--record-title`.\n\nFor cross-workflow analytics or shapes that `run count` doesn't expose (per-node failure breakdowns, p95 durations, error rate over time), use `orchestration query execute` — see the [Ad-hoc execution analytics](#ad-hoc-execution-analytics-orchestration-query) section.\n\n## Ad-hoc execution analytics (`orchestration query`)\n\nRun SQL against orchestration runtime tables — `runs`, `batches`, `spans`, `records` — for analytics that the canned metrics commands don't cover. Tables are referenced without a schema prefix; workspace scoping is automatic. See `cargo-orchestration/references/examples/queries.md` for schemas and limits.\n\n```bash\n# Error rate across the workspace in the last day\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# Failed runs per workflow this 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# Per-node failure counts (last 24h)\ncargo-ai orchestration query execute \\\n  \"SELECT node_slug, count() AS failures FROM spans WHERE execution_status='error' AND execution_started_at > now() - INTERVAL 1 DAY GROUP BY node_slug 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 FROM batches WHERE created_at >= toStartOfMonth(now()) GROUP BY workflow_uuid ORDER BY credits DESC\"\n```\n\nRead-only and capped: 30s execution time, 10 000 result rows, 10 000 000 rows scanned. Narrow with a `created_at`/`execution_started_at` predicate to stay under the row-scan cap.\n\n## Downloading run results\n\nTwo distinct commands — pick the right one for the job.\n\n### `run download` — full run records (metadata + per-node `runContext`)\n\nReturns each run as a JSON object with status, timing, executions, and `runContext.<nodeSlug>` containing per-node outputs. Best for debugging or when you need the full execution history.\n\n```bash\n# All finished runs\ncargo-ai orchestration run download --workflow-uuid <uuid> --is-finished\n\n# Date range\ncargo-ai orchestration run download --workflow-uuid <uuid> \\\n  --created-after <start-date> --created-before <end-date>\n\n# Specific statuses\ncargo-ai orchestration run download --workflow-uuid <uuid> --statuses success,error\n\n# From a specific batch\ncargo-ai orchestration run download --workflow-uuid <uuid> --batch-uuid <uuid>\n```\n\n### `run download-outputs` — output of a specific node (CSV/JSON via signed URL)\n\n**This is the canonical way to get action results out of the platform.** Maps to API `POST /v1/orchestration/runs/download-outputs`. Returns `{\"url\": \"...\"}` — a signed URL to a CSV (default) or JSON file containing only the output node's data with input/output context. Faster and cheaper than downloading whole run records when you only need the result.\n\n```bash\n# Required: --workflow-uuid + --output-node-slug\ncargo-ai orchestration run download-outputs \\\n  --workflow-uuid <uuid> \\\n  --output-node-slug <slug> \\\n  --format json \\\n  --is-finished\n\n# Filter by batch + status\ncargo-ai orchestration run download-outputs \\\n  --workflow-uuid <uuid> \\\n  --output-node-slug <slug> \\\n  --batch-uuid <uuid> \\\n  --statuses finished\n```\n\nTo find the `output-node-slug`: `cargo-ai orchestration release get <release-uuid>` → look at `nodes[].slug`. The terminal output node is typically named `output` or `end`.\n\n## Downloading batch results\n\n```bash\ncargo-ai orchestration batch download --uuid <batch-uuid> --output-node-slug <node-slug>\n```\n\nTo find the `output-node-slug`: run `cargo-ai orchestration release get <release-uuid>` (get the release UUID from the batch) and look at `nodes[].slug`.\n\n## Handling partial batch failures\n\nA batch with `status: \"success\"` can still contain individual run failures. Always inspect the batch for errors before treating results as complete.\n\n**Step 1 — Check the batch summary:**\n\n```bash\ncargo-ai orchestration batch get <batch-uuid>\n# → .runsCount          = total records submitted\n# → .executedRunsCount  = records that reached a terminal state (success or error)\n# → .failedRunsCount    = records that errored\n```\n\n**Step 2 — Count and download the failed runs:**\n\n```bash\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --batch-uuid <batch-uuid> \\\n  --statuses error\n\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --batch-uuid <batch-uuid> \\\n  --statuses error\n```\n\n**Step 3 — Diagnose.** Working out *why* they failed — grouping failures by root cause, picking exemplar runs, reading `runContext` — is the `cargo-diagnostics` skill's job: load `../cargo-diagnostics/references/batch-error-sweep.md` and feed it the batch UUID.\n\n**Step 4 — Re-run only the failed records:**\n\nAfter the diagnosis and fixing the underlying issue (connector credentials, bad input data, rate limits):\n\n```bash\n# Extract record IDs from the failed run download, then:\ncargo-ai orchestration batch create \\\n  --workflow-uuid <uuid> \\\n  --data '{\"kind\":\"recordIds\",\"recordIds\":[\"id1\",\"id2\",\"id3\"]}'\n```\n\n**Filtering by node output slug:**\n\nTo download only a specific node's output from a batch (e.g. just the enrichment node, not the full run):\n\n```bash\n# 1. Get the release UUID from the batch\ncargo-ai orchestration batch get <batch-uuid>\n# → .releaseUuid\n\n# 2. Find the node slug\ncargo-ai orchestration release get <release-uuid>\n# → nodes[].slug\n\n# 3. Download that node's output\ncargo-ai orchestration batch download \\\n  --uuid <batch-uuid> \\\n  --output-node-slug <node-slug>\n```\n\n## Segment data export\n\nFilter JSON uses `conjonction` (not `conjunction`) — this is intentional. See the `cargo-orchestration` skill's `references/filter-syntax.md` for the full filter syntax.\n\n```bash\n# Full export (all records)\ncargo-ai segmentation segment download \\\n  --model-uuid <uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}'\n\n# With sorting and limit\ncargo-ai segmentation segment download \\\n  --model-uuid <uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}' \\\n  --sort '[{\"columnSlug\":\"created_at\",\"kind\":\"desc\"}]' \\\n  --limit 1000\n```\n\n**IMPORTANT:** `segment download` requires `--model-uuid`, not `--segment-uuid`. Get the `modelUuid` from `segment list`.\n\nFor live paginated queries with enrichment, use `segmentation segment fetch` from the `cargo-orchestration` skill.\n\n## Help\n\nEvery command supports `--help`:\n\n```bash\ncargo-ai billing usage get-metrics --help\ncargo-ai orchestration run download --help\ncargo-ai segmentation segment download --help\n```\n\nFile v1.4.2:_meta.json\n\n{\n  \"ownerId\": \"kn7by8t6yt9yghbxtxz6hv0bts87k6bq\",\n  \"slug\": \"cargo-analytics\",\n  \"version\": \"1.4.2\",\n  \"publishedAt\": 1783647781935\n}\n\nFile v1.4.2:references/examples/exports.md\n\n# Data export examples\n\n## Download all finished runs\n\n```bash\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --is-finished\n```\n\n## Download runs by status\n\n```bash\n# Only successful runs\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --statuses success\n\n# Both success and error (for analysis)\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --statuses success,error\n\n# Only error runs (for debugging)\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --statuses error\n```\n\n## Download runs in a date range\n\n```bash\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --created-after 2025-01-01 \\\n  --created-before 2025-01-31\n```\n\n## Download runs from a specific batch\n\n```bash\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --batch-uuid <batch-uuid>\n```\n\n## Download batch output by node\n\n```bash\n# 1. Get the batch and its release UUID\ncargo-ai orchestration batch get <batch-uuid>\n# → Extract releaseUuid\n\n# 2. Find the output node slug\ncargo-ai orchestration release get <release-uuid>\n# → Read nodes[].slug — pick the output node's slug\n\n# 3. Download\ncargo-ai orchestration batch download \\\n  --uuid <batch-uuid> \\\n  --output-node-slug <node-slug>\n```\n\n## Export all segment data\n\n```bash\n# 1. List segments to find the modelUuid\ncargo-ai segmentation segment list\n# → Extract modelUuid (NOT segment uuid)\n\n# 2. Full export\ncargo-ai segmentation segment download \\\n  --model-uuid <model-uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}'\n```\n\n## Export segment data with sorting and limit\n\n```bash\ncargo-ai segmentation segment download \\\n  --model-uuid <model-uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}' \\\n  --sort '[{\"columnSlug\":\"created_at\",\"kind\":\"desc\"}]' \\\n  --limit 5000\n```\n\n## Export filtered segment data\n\n```bash\n# Export only churned accounts\ncargo-ai segmentation segment download \\\n  --model-uuid <model-uuid> \\\n  --filter '{\n    \"conjonction\": \"and\",\n    \"groups\": [{\n      \"conjonction\": \"and\",\n      \"conditions\": [\n        {\"kind\": \"string\", \"columnSlug\": \"status\", \"operator\": \"is\", \"values\": [\"churned\"]}\n      ]\n    }]\n  }'\n\n# Export US companies with 100+ employees\ncargo-ai segmentation segment download \\\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      ]\n    }]\n  }'\n\n# Export records created after a date\ncargo-ai segmentation segment download \\\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```\n\n## Export a segment with non-null email\n\n```bash\ncargo-ai segmentation segment download \\\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```\n\nFile v1.4.2:references/examples/run-analytics.md\n\n# Run analytics examples\n\n## Get metrics for a workflow\n\n```bash\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid>\n```\n\nResponse:\n\n```json\n{\n  \"runMetrics\": [\n    {\n      \"nodeUuid\": \"node-uuid-1\",\n      \"totalExecutionsCount\": 1000,\n      \"successExecutionsCount\": 950,\n      \"errorExecutionsCount\": 30,\n      \"cancelledExecutionsCount\": 5,\n      \"creditsUsedCount\": 450\n    }\n  ]\n}\n```\n\nError rate per node = `errorExecutionsCount / totalExecutionsCount`. High error rate on a specific node means that step is failing.\n\n## Metrics scoped to a specific release\n\n```bash\ncargo-ai orchestration run get-metrics \\\n  --workflow-uuid <uuid> \\\n  --release-uuid <release-uuid>\n```\n\n## Metrics scoped to a specific batch\n\n```bash\ncargo-ai orchestration run get-metrics \\\n  --workflow-uuid <uuid> \\\n  --batch-uuid <batch-uuid>\n```\n\n## Metrics for a date range\n\n```bash\ncargo-ai orchestration run get-metrics \\\n  --workflow-uuid <uuid> \\\n  --created-after 2025-01-01 \\\n  --created-before 2025-01-31\n```\n\n## Count errors\n\n```bash\n# Total error count\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses error\n```\n\nResponse:\n\n```json\n{ \"count\": 42 }\n```\n\n```bash\n# Errors in a specific period\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses error \\\n  --created-after 2025-01-15 \\\n  --created-before 2025-01-16\n\n# Errors in a specific batch\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses error \\\n  --batch-uuid <batch-uuid>\n```\n\n## Count finished runs\n\n```bash\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --is-finished\n\n# In a date range\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --is-finished \\\n  --created-after 2025-01-01 \\\n  --created-before 2025-01-31\n```\n\n## Count successful runs\n\n```bash\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses success\n```\n\n## Per-workflow cost analysis (full flow)\n\n```bash\n# 1. List workflows\ncargo-ai orchestration workflow list\n\n# 2. Get usage grouped by workflow\ncargo-ai billing usage get-metrics \\\n  --from 2025-01-01 --to 2025-01-31 \\\n  --group-by workflow_uuid\n\n# 3. Drill into a specific workflow\ncargo-ai billing usage get-metrics \\\n  --from 2025-01-01 --to 2025-01-31 \\\n  --workflow-uuid <uuid>\n\n# 4. Get run-level metrics\ncargo-ai orchestration run get-metrics \\\n  --workflow-uuid <uuid> \\\n  --created-after 2025-01-01 \\\n  --created-before 2025-01-31\n```\n\n## Error monitoring and debugging (full flow)\n\n```bash\n# 1. Count errors\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses error\n\n# 2. Spot-check: count errors in the last 24 hours\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses error \\\n  --created-after 2025-01-15 \\\n  --created-before 2025-01-16\n\n# 3. Download error runs for inspection\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --statuses error \\\n  --created-after 2025-01-15\n\n# 4. Check per-node error rates\ncargo-ai orchestration run get-metrics \\\n  --workflow-uuid <uuid>\n# → Compare errorExecutionsCount vs totalExecutionsCount per node\n# → High error rate on a specific node = that step is failing\n```\n\nThis flow ends at **detection** — you now know how many runs fail and which node is the hotspot. To explain *why* (group failures by root cause, trace exemplar runs through `runContext`), continue with the `cargo-diagnostics` skill: `../../../cargo-diagnostics/references/batch-error-sweep.md`, then `run-trace.md` on the exemplars it hands back.\n\n## List runs with filters\n\n```bash\n# All runs for a workflow (paginated)\ncargo-ai orchestration run list \\\n  --workflow-uuid <uuid> \\\n  --limit 20\n\n# Only error runs\ncargo-ai orchestration run list \\\n  --workflow-uuid <uuid> \\\n  --statuses error \\\n  --limit 10\n\n# Runs from a specific batch\ncargo-ai orchestration run list \\\n  --workflow-uuid <uuid> \\\n  --batch-uuid <batch-uuid>\n\n# Runs for a specific record\ncargo-ai orchestration run list \\\n  --workflow-uuid <uuid> \\\n  --record-id <record-id>\n```\n\nFile v1.4.2:references/response-shapes.md\n\n# Response shapes\n\nJSON response structures returned by Cargo CLI commands used in the `cargo-analytics` skill.\n\n> For billing response shapes (usage metrics, subscription, invoices), see the `cargo-billing` skill.\n\n## cargo-ai orchestration run get-metrics\n\n```json\n{\n  \"runMetrics\": [\n    {\n      \"nodeUuid\": \"node-uuid-1\",\n      \"totalExecutionsCount\": 1000,\n      \"idleExecutionsCount\": 0,\n      \"pendingExecutionsCount\": 5,\n      \"runningExecutionsCount\": 10,\n      \"successExecutionsCount\": 950,\n      \"errorExecutionsCount\": 30,\n      \"cancelledExecutionsCount\": 5,\n      \"skippedExecutionsCount\": 0,\n      \"creditsUsedCount\": 450\n    }\n  ]\n}\n```\n\n**Key fields:** `nodeUuid` (identifies the workflow node), `successExecutionsCount`, `errorExecutionsCount`, `creditsUsedCount`.\n\nTo compute an error rate: `errorExecutionsCount / totalExecutionsCount`.\n\n## cargo-ai orchestration run count\n\n```json\n{\n  \"count\": 42\n}\n```\n\n## cargo-ai orchestration run list\n\n```json\n{\n  \"runs\": [\n    {\n      \"uuid\": \"run-uuid\",\n      \"workflowUuid\": \"...\",\n      \"status\": \"success\",\n      \"batchUuid\": \"batch-uuid-or-null\",\n      \"releaseUuid\": \"...\",\n      \"recordId\": \"rec-123\",\n      \"recordTitle\": \"Acme Corp\",\n      \"createdAt\": \"2025-01-15T10:00:00Z\",\n      \"finishedAt\": \"2025-01-15T10:00:05Z\"\n    }\n  ]\n}\n```\n\n## cargo-ai segmentation segment download\n\nReturns raw data as a downloadable payload (typically CSV or JSON depending on the CLI output format). The response is streamed to stdout.\n\n## cargo-ai orchestration batch download\n\nReturns the output data for the specified node as a downloadable payload. The response is streamed to stdout.\n\nFile v1.4.2:references/troubleshooting.md\n\n# Troubleshooting\n\nCommon errors and recovery steps for `cargo-analytics` commands.\n\n## General\n\n| Symptom | Cause | Fix |\n|---------|-------|-----|\n| `{\"errorMessage\": \"...\"}` with non-zero exit | Any CLI error | Read the `errorMessage` — it usually says exactly what's wrong |\n| `command not found: cargo-ai` | CLI not installed or not in PATH | Run `npm install -g @cargo-ai/cli` or prefix with `npx @cargo-ai/cli` |\n| `Unauthorized` or `Forbidden` | Bad or expired credentials | Re-run `cargo-ai login --oauth` (browser sign-in) or `cargo-ai login --token <token>`; verify with `cargo-ai whoami` |\n\n## Run metrics and counts\n\n| Symptom | Cause | Fix |\n|---------|-------|-----|\n| `run get-metrics` returns empty array | No runs exist for that workflow/period | Verify the `--workflow-uuid`; try without date filters to check if any runs exist |\n| Error count seems too high | Counting across all time | Scope with `--created-after` and `--created-before` for a specific period |\n| `run count` returns 0 unexpectedly | Filter combination too narrow | Remove filters one at a time to isolate which one excludes all runs |\n\n## Downloads and exports\n\n| Symptom | Cause | Fix |\n|---------|-------|-----|\n| `run download` returns empty | No runs match the filters | Loosen filters; try `--is-finished` without date or status constraints |\n| `batch download` fails with \"node not found\" | Wrong `--output-node-slug` | Re-run `release get <release-uuid>` and check `nodes[].slug` for the correct value |\n| `segment download` returns empty | Wrong model UUID or over-filtered | Verify `--model-uuid` (not `--segment-uuid`); try empty filter `{\"conjonction\":\"and\",\"groups\":[]}` first |\n| Parse error on filter JSON | Malformed JSON or wrong spelling | Check: it's `conjonction` (not `conjunction`); validate JSON syntax; see the `cargo-orchestration` skill's `references/filter-syntax.md` |\n\nFile v1.4.2:skill-card.md\n\n## Description: <br>\nDownload workflow run results, export segment data, and monitor run metrics using the Cargo CLI. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[cargo-ai](https://clawhub.ai/user/cargo-ai) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nDevelopers, operators, and Cargo workspace users use this skill to measure workflow run health, count errors, download run or batch results, and export segment data. It is for analytics and retrieval workflows, not root cause diagnosis. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: Cargo analytics commands can retrieve downloaded runs, segment exports, signed URLs, and records that may contain sensitive business data. <br>\nMitigation: Use Cargo permissions, filters, date ranges, and row limits to keep exports authorized and minimal. <br>\nRisk: Broad analytics queries or downloads can expose more workspace data than intended. <br>\nMitigation: Prefer scoped workflow, batch, status, and date filters before downloading or exporting results. <br>\n\n\n## Reference(s): <br>\n- [Cargo Skills Repository](https://github.com/getcargohq/cargo-skills) <br>\n- [Cargo Analytics on ClawHub](https://clawhub.ai/cargo-ai/skills/cargo-analytics) <br>\n- [Response shapes](references/response-shapes.md) <br>\n- [Troubleshooting](references/troubleshooting.md) <br>\n- [Run analytics examples](references/examples/run-analytics.md) <br>\n- [Data export examples](references/examples/exports.md) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [Shell commands, Analysis, Files, Guidance] <br>\n**Output Format:** [Markdown with inline bash commands and JSON response examples] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [May reference Cargo CLI outputs, downloaded run or batch data, signed URLs, and exported CSV or JSON payloads.] <br>\n\n## Skill Version(s): <br>\n1.4.2 (source: frontmatter and release evidence) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nArchive v1.4.1: 7 files, 9021 bytes\n\nFiles: references/examples/exports.md (3290b), references/examples/run-analytics.md (3691b), references/response-shapes.md (1643b), references/troubleshooting.md (1887b), skill-card.md (2304b), SKILL.md (10626b), _meta.json (134b)\n\nFile v1.4.1:SKILL.md\n\n---\nname: cargo-analytics\ndescription: Download workflow run results, export segment data, and monitor run metrics using the Cargo CLI. Use when the user wants run metrics, error rates, data export, or download results for their Cargo workspace. For billing and credit usage, use the cargo-billing skill instead.\nversion: \"1.4.1\"\ncompatibility: Requires @cargo-ai/cli (npm) and a Cargo account (browser sign-in via --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 — Analytics\n\nMeasurement and export: monitoring run metrics, downloading run and batch results, and exporting segment data.\n\n> See `references/response-shapes.md` for full JSON response structures.\n> See `references/troubleshooting.md` for common errors and how to fix them.\n> See `references/examples/run-analytics.md` for run metrics and error monitoring.\n> See `references/examples/exports.md` for data export and download examples.\n> For billing, usage metrics, and subscription: use the `cargo-billing` skill.\n\n## Prerequisites\n\nSee [`../cargo/references/prerequisites.md`](../cargo/references/prerequisites.md) for install, login (`--oauth` / `--token`), JSON output conventions, and error shapes. Verify the session with `cargo-ai whoami` before running any of the commands below.\n\n## Discover resources first\n\nMost analytics commands require UUIDs. Discover them before querying.\n\n```bash\ncargo-ai orchestration play list            # all plays (name, workflowUuid)\ncargo-ai orchestration tool list            # all tools (name, workflowUuid)\ncargo-ai orchestration workflow list        # all workflows (uuid only — no name)\ncargo-ai ai agent list                     # all agents (uuid, name)\ncargo-ai connection connector list          # all connectors (uuid, name, integrationSlug)\ncargo-ai storage model list                # all models (uuid, name, slug)\n```\n\n## Quick reference\n\n```bash\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid>\ncargo-ai orchestration run download --workflow-uuid <uuid> --is-finished\ncargo-ai orchestration run count --workflow-uuid <uuid> --statuses error\ncargo-ai orchestration query execute \"SELECT status, count() FROM runs GROUP BY status\"\ncargo-ai segmentation segment download --model-uuid <uuid> --filter '{\"conjonction\":\"and\",\"groups\":[]}'\n```\n\n**Picking the right command:**\n\n- `run get-metrics` / `run count` — workflow-scoped, predefined aggregations. Best when you already have a `workflowUuid`.\n- `orchestration query execute` — ad-hoc SQL across the entire workspace (`runs`, `batches`, `spans`, `records`). Best for cross-workflow analytics, per-node breakdowns, and time-series.\n- `run download` / `run download-outputs` — per-record output retrieval.\n- `segment download` / `storage query execute` — storage data (Companies, Contacts, …).\n\n## Workflow run metrics\n\nAggregated metrics for workflow runs (success/error rates, credits per node).\n\n```bash\n# Metrics for a workflow\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid>\n\n# Scoped to a release, batch, or date range\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid> --release-uuid <uuid>\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid> --batch-uuid <uuid>\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid> \\\n  --created-after <start-date> --created-before <end-date>\n```\n\n## Run count\n\nCount runs matching specific criteria — useful for monitoring.\n\n```bash\ncargo-ai orchestration run count --workflow-uuid <uuid> --statuses error\ncargo-ai orchestration run count --workflow-uuid <uuid> --is-finished \\\n  --created-after <start-date> --created-before <end-date>\ncargo-ai orchestration run count --workflow-uuid <uuid> --batch-uuid <uuid>\n```\n\nSupports: `--statuses`, `--batch-uuid`, `--release-uuid`, `--is-finished`, `--created-after`, `--created-before`, `--record-id`, `--record-title`.\n\nFor cross-workflow analytics or shapes that `run count` doesn't expose (per-node failure breakdowns, p95 durations, error rate over time), use `orchestration query execute` — see the [Ad-hoc execution analytics](#ad-hoc-execution-analytics-orchestration-query) section.\n\n## Ad-hoc execution analytics (`orchestration query`)\n\nRun SQL against orchestration runtime tables — `runs`, `batches`, `spans`, `records` — for analytics that the canned metrics commands don't cover. Tables are referenced without a schema prefix; workspace scoping is automatic. See `cargo-orchestration/references/examples/queries.md` for schemas and limits.\n\n```bash\n# Error rate across the workspace in the last day\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# Failed runs per workflow this 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# Per-node failure counts (last 24h)\ncargo-ai orchestration query execute \\\n  \"SELECT node_slug, count() AS failures FROM spans WHERE execution_status='error' AND execution_started_at > now() - INTERVAL 1 DAY GROUP BY node_slug 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 FROM batches WHERE created_at >= toStartOfMonth(now()) GROUP BY workflow_uuid ORDER BY credits DESC\"\n```\n\nRead-only and capped: 30s execution time, 10 000 result rows, 10 000 000 rows scanned. Narrow with a `created_at`/`execution_started_at` predicate to stay under the row-scan cap.\n\n## Downloading run results\n\nTwo distinct commands — pick the right one for the job.\n\n### `run download` — full run records (metadata + per-node `runContext`)\n\nReturns each run as a JSON object with status, timing, executions, and `runContext.<nodeSlug>` containing per-node outputs. Best for debugging or when you need the full execution history.\n\n```bash\n# All finished runs\ncargo-ai orchestration run download --workflow-uuid <uuid> --is-finished\n\n# Date range\ncargo-ai orchestration run download --workflow-uuid <uuid> \\\n  --created-after <start-date> --created-before <end-date>\n\n# Specific statuses\ncargo-ai orchestration run download --workflow-uuid <uuid> --statuses success,error\n\n# From a specific batch\ncargo-ai orchestration run download --workflow-uuid <uuid> --batch-uuid <uuid>\n```\n\n### `run download-outputs` — output of a specific node (CSV/JSON via signed URL)\n\n**This is the canonical way to get action results out of the platform.** Maps to API `POST /v1/orchestration/runs/download-outputs`. Returns `{\"url\": \"...\"}` — a signed URL to a CSV (default) or JSON file containing only the output node's data with input/output context. Faster and cheaper than downloading whole run records when you only need the result.\n\n```bash\n# Required: --workflow-uuid + --output-node-slug\ncargo-ai orchestration run download-outputs \\\n  --workflow-uuid <uuid> \\\n  --output-node-slug <slug> \\\n  --format json \\\n  --is-finished\n\n# Filter by batch + status\ncargo-ai orchestration run download-outputs \\\n  --workflow-uuid <uuid> \\\n  --output-node-slug <slug> \\\n  --batch-uuid <uuid> \\\n  --statuses finished\n```\n\nTo find the `output-node-slug`: `cargo-ai orchestration release get <release-uuid>` → look at `nodes[].slug`. The terminal output node is typically named `output` or `end`.\n\n## Downloading batch results\n\n```bash\ncargo-ai orchestration batch download --uuid <batch-uuid> --output-node-slug <node-slug>\n```\n\nTo find the `output-node-slug`: run `cargo-ai orchestration release get <release-uuid>` (get the release UUID from the batch) and look at `nodes[].slug`.\n\n## Handling partial batch failures\n\nA batch with `status: \"success\"` can still contain individual run failures. Always inspect the batch for errors before treating results as complete.\n\n**Step 1 — Check the batch summary:**\n\n```bash\ncargo-ai orchestration batch get <batch-uuid>\n# → .runsCount          = total records submitted\n# → .executedRunsCount  = records that reached a terminal state (success or error)\n# → .failedRunsCount    = records that errored\n```\n\n**Step 2 — Count errors for the batch:**\n\n```bash\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --batch-uuid <batch-uuid> \\\n  --statuses error\n```\n\n**Step 3 — Download failed runs to inspect root causes:**\n\n```bash\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --batch-uuid <batch-uuid> \\\n  --statuses error\n```\n\n**Step 4 — Re-run only the failed records:**\n\nAfter fixing the underlying issue (connector credentials, bad input data, rate limits):\n\n```bash\n# Extract record IDs from the failed run download, then:\ncargo-ai orchestration batch create \\\n  --workflow-uuid <uuid> \\\n  --data '{\"kind\":\"recordIds\",\"recordIds\":[\"id1\",\"id2\",\"id3\"]}'\n```\n\n**Filtering by node output slug:**\n\nTo download only a specific node's output from a batch (e.g. just the enrichment node, not the full run):\n\n```bash\n# 1. Get the release UUID from the batch\ncargo-ai orchestration batch get <batch-uuid>\n# → .releaseUuid\n\n# 2. Find the node slug\ncargo-ai orchestration release get <release-uuid>\n# → nodes[].slug\n\n# 3. Download that node's output\ncargo-ai orchestration batch download \\\n  --uuid <batch-uuid> \\\n  --output-node-slug <node-slug>\n```\n\n## Segment data export\n\nFilter JSON uses `conjonction` (not `conjunction`) — this is intentional. See the `cargo-orchestration` skill's `references/filter-syntax.md` for the full filter syntax.\n\n```bash\n# Full export (all records)\ncargo-ai segmentation segment download \\\n  --model-uuid <uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}'\n\n# With sorting and limit\ncargo-ai segmentation segment download \\\n  --model-uuid <uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}' \\\n  --sort '[{\"columnSlug\":\"created_at\",\"kind\":\"desc\"}]' \\\n  --limit 1000\n```\n\n**IMPORTANT:** `segment download` requires `--model-uuid`, not `--segment-uuid`. Get the `modelUuid` from `segment list`.\n\nFor live paginated queries with enrichment, use `segmentation segment fetch` from the `cargo-orchestration` skill.\n\n## Help\n\nEvery command supports `--help`:\n\n```bash\ncargo-ai billing usage get-metrics --help\ncargo-ai orchestration run download --help\ncargo-ai segmentation segment download --help\n```\n\nFile v1.4.1:_meta.json\n\n{\n  \"ownerId\": \"kn7by8t6yt9yghbxtxz6hv0bts87k6bq\",\n  \"slug\": \"cargo-analytics\",\n  \"version\": \"1.4.1\",\n  \"publishedAt\": 1780006399897\n}\n\nFile v1.4.1:references/examples/exports.md\n\n# Data export examples\n\n## Download all finished runs\n\n```bash\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --is-finished\n```\n\n## Download runs by status\n\n```bash\n# Only successful runs\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --statuses success\n\n# Both success and error (for analysis)\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --statuses success,error\n\n# Only error runs (for debugging)\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --statuses error\n```\n\n## Download runs in a date range\n\n```bash\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --created-after 2025-01-01 \\\n  --created-before 2025-01-31\n```\n\n## Download runs from a specific batch\n\n```bash\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --batch-uuid <batch-uuid>\n```\n\n## Download batch output by node\n\n```bash\n# 1. Get the batch and its release UUID\ncargo-ai orchestration batch get <batch-uuid>\n# → Extract releaseUuid\n\n# 2. Find the output node slug\ncargo-ai orchestration release get <release-uuid>\n# → Read nodes[].slug — pick the output node's slug\n\n# 3. Download\ncargo-ai orchestration batch download \\\n  --uuid <batch-uuid> \\\n  --output-node-slug <node-slug>\n```\n\n## Export all segment data\n\n```bash\n# 1. List segments to find the modelUuid\ncargo-ai segmentation segment list\n# → Extract modelUuid (NOT segment uuid)\n\n# 2. Full export\ncargo-ai segmentation segment download \\\n  --model-uuid <model-uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}'\n```\n\n## Export segment data with sorting and limit\n\n```bash\ncargo-ai segmentation segment download \\\n  --model-uuid <model-uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}' \\\n  --sort '[{\"columnSlug\":\"created_at\",\"kind\":\"desc\"}]' \\\n  --limit 5000\n```\n\n## Export filtered segment data\n\n```bash\n# Export only churned accounts\ncargo-ai segmentation segment download \\\n  --model-uuid <model-uuid> \\\n  --filter '{\n    \"conjonction\": \"and\",\n    \"groups\": [{\n      \"conjonction\": \"and\",\n      \"conditions\": [\n        {\"kind\": \"string\", \"columnSlug\": \"status\", \"operator\": \"is\", \"values\": [\"churned\"]}\n      ]\n    }]\n  }'\n\n# Export US companies with 100+ employees\ncargo-ai segmentation segment download \\\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      ]\n    }]\n  }'\n\n# Export records created after a date\ncargo-ai segmentation segment download \\\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```\n\n## Export a segment with non-null email\n\n```bash\ncargo-ai segmentation segment download \\\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```\n\nFile v1.4.1:references/examples/run-analytics.md\n\n# Run analytics examples\n\n## Get metrics for a workflow\n\n```bash\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid>\n```\n\nResponse:\n\n```json\n{\n  \"runMetrics\": [\n    {\n      \"nodeUuid\": \"node-uuid-1\",\n      \"totalExecutionsCount\": 1000,\n      \"successExecutionsCount\": 950,\n      \"errorExecutionsCount\": 30,\n      \"cancelledExecutionsCount\": 5,\n      \"creditsUsedCount\": 450\n    }\n  ]\n}\n```\n\nError rate per node = `errorExecutionsCount / totalExecutionsCount`. High error rate on a specific node means that step is failing.\n\n## Metrics scoped to a specific release\n\n```bash\ncargo-ai orchestration run get-metrics \\\n  --workflow-uuid <uuid> \\\n  --release-uuid <release-uuid>\n```\n\n## Metrics scoped to a specific batch\n\n```bash\ncargo-ai orchestration run get-metrics \\\n  --workflow-uuid <uuid> \\\n  --batch-uuid <batch-uuid>\n```\n\n## Metrics for a date range\n\n```bash\ncargo-ai orchestration run get-metrics \\\n  --workflow-uuid <uuid> \\\n  --created-after 2025-01-01 \\\n  --created-before 2025-01-31\n```\n\n## Count errors\n\n```bash\n# Total error count\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses error\n```\n\nResponse:\n\n```json\n{ \"count\": 42 }\n```\n\n```bash\n# Errors in a specific period\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses error \\\n  --created-after 2025-01-15 \\\n  --created-before 2025-01-16\n\n# Errors in a specific batch\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses error \\\n  --batch-uuid <batch-uuid>\n```\n\n## Count finished runs\n\n```bash\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --is-finished\n\n# In a date range\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --is-finished \\\n  --created-after 2025-01-01 \\\n  --created-before 2025-01-31\n```\n\n## Count successful runs\n\n```bash\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses success\n```\n\n## Per-workflow cost analysis (full flow)\n\n```bash\n# 1. List workflows\ncargo-ai orchestration workflow list\n\n# 2. Get usage grouped by workflow\ncargo-ai billing usage get-metrics \\\n  --from 2025-01-01 --to 2025-01-31 \\\n  --group-by workflow_uuid\n\n# 3. Drill into a specific workflow\ncargo-ai billing usage get-metrics \\\n  --from 2025-01-01 --to 2025-01-31 \\\n  --workflow-uuid <uuid>\n\n# 4. Get run-level metrics\ncargo-ai orchestration run get-metrics \\\n  --workflow-uuid <uuid> \\\n  --created-after 2025-01-01 \\\n  --created-before 2025-01-31\n```\n\n## Error monitoring and debugging (full flow)\n\n```bash\n# 1. Count errors\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses error\n\n# 2. Spot-check: count errors in the last 24 hours\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses error \\\n  --created-after 2025-01-15 \\\n  --created-before 2025-01-16\n\n# 3. Download error runs for inspection\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --statuses error \\\n  --created-after 2025-01-15\n\n# 4. Check per-node error rates\ncargo-ai orchestration run get-metrics \\\n  --workflow-uuid <uuid>\n# → Compare errorExecutionsCount vs totalExecutionsCount per node\n# → High error rate on a specific node = that step is failing\n```\n\n## List runs with filters\n\n```bash\n# All runs for a workflow (paginated)\ncargo-ai orchestration run list \\\n  --workflow-uuid <uuid> \\\n  --limit 20\n\n# Only error runs\ncargo-ai orchestration run list \\\n  --workflow-uuid <uuid> \\\n  --statuses error \\\n  --limit 10\n\n# Runs from a specific batch\ncargo-ai orchestration run list \\\n  --workflow-uuid <uuid> \\\n  --batch-uuid <batch-uuid>\n\n# Runs for a specific record\ncargo-ai orchestration run list \\\n  --workflow-uuid <uuid> \\\n  --record-id <record-id>\n```\n\nFile v1.4.1:references/response-shapes.md\n\n# Response shapes\n\nJSON response structures returned by Cargo CLI commands used in the `cargo-analytics` skill.\n\n> For billing response shapes (usage metrics, subscription, invoices), see the `cargo-billing` skill.\n\n## cargo-ai orchestration run get-metrics\n\n```json\n{\n  \"runMetrics\": [\n    {\n      \"nodeUuid\": \"node-uuid-1\",\n      \"totalExecutionsCount\": 1000,\n      \"idleExecutionsCount\": 0,\n      \"pendingExecutionsCount\": 5,\n      \"runningExecutionsCount\": 10,\n      \"successExecutionsCount\": 950,\n      \"errorExecutionsCount\": 30,\n      \"cancelledExecutionsCount\": 5,\n      \"skippedExecutionsCount\": 0,\n      \"creditsUsedCount\": 450\n    }\n  ]\n}\n```\n\n**Key fields:** `nodeUuid` (identifies the workflow node), `successExecutionsCount`, `errorExecutionsCount`, `creditsUsedCount`.\n\nTo compute an error rate: `errorExecutionsCount / totalExecutionsCount`.\n\n## cargo-ai orchestration run count\n\n```json\n{\n  \"count\": 42\n}\n```\n\n## cargo-ai orchestration run list\n\n```json\n{\n  \"runs\": [\n    {\n      \"uuid\": \"run-uuid\",\n      \"workflowUuid\": \"...\",\n      \"status\": \"success\",\n      \"batchUuid\": \"batch-uuid-or-null\",\n      \"releaseUuid\": \"...\",\n      \"recordId\": \"rec-123\",\n      \"recordTitle\": \"Acme Corp\",\n      \"createdAt\": \"2025-01-15T10:00:00Z\",\n      \"finishedAt\": \"2025-01-15T10:00:05Z\"\n    }\n  ]\n}\n```\n\n## cargo-ai segmentation segment download\n\nReturns raw data as a downloadable payload (typically CSV or JSON depending on the CLI output format). The response is streamed to stdout.\n\n## cargo-ai orchestration batch download\n\nReturns the output data for the specified node as a downloadable payload. The response is streamed to stdout.\n\nFile v1.4.1:references/troubleshooting.md\n\n# Troubleshooting\n\nCommon errors and recovery steps for `cargo-analytics` commands.\n\n## General\n\n| Symptom | Cause | Fix |\n|---------|-------|-----|\n| `{\"errorMessage\": \"...\"}` with non-zero exit | Any CLI error | Read the `errorMessage` — it usually says exactly what's wrong |\n| `command not found: cargo-ai` | CLI not installed or not in PATH | Run `npm install -g @cargo-ai/cli` or prefix with `npx @cargo-ai/cli` |\n| `Unauthorized` or `Forbidden` | Bad or expired credentials | Re-run `cargo-ai login --oauth` (browser sign-in) or `cargo-ai login --token <token>`; verify with `cargo-ai whoami` |\n\n## Run metrics and counts\n\n| Symptom | Cause | Fix |\n|---------|-------|-----|\n| `run get-metrics` returns empty array | No runs exist for that workflow/period | Verify the `--workflow-uuid`; try without date filters to check if any runs exist |\n| Error count seems too high | Counting across all time | Scope with `--created-after` and `--created-before` for a specific period |\n| `run count` returns 0 unexpectedly | Filter combination too narrow | Remove filters one at a time to isolate which one excludes all runs |\n\n## Downloads and exports\n\n| Symptom | Cause | Fix |\n|---------|-------|-----|\n| `run download` returns empty | No runs match the filters | Loosen filters; try `--is-finished` without date or status constraints |\n| `batch download` fails with \"node not found\" | Wrong `--output-node-slug` | Re-run `release get <release-uuid>` and check `nodes[].slug` for the correct value |\n| `segment download` returns empty | Wrong model UUID or over-filtered | Verify `--model-uuid` (not `--segment-uuid`); try empty filter `{\"conjonction\":\"and\",\"groups\":[]}` first |\n| Parse error on filter JSON | Malformed JSON or wrong spelling | Check: it's `conjonction` (not `conjunction`); validate JSON syntax; see the `cargo-orchestration` skill's `references/filter-syntax.md` |\n\nFile v1.4.1:skill-card.md\n\n## Description: <br>\nDownload workflow run results, export segment data, and monitor run metrics using the Cargo CLI. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[cargo-ai](https://clawhub.ai/user/cargo-ai) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nDevelopers, operators, and Cargo workspace users use this skill to inspect workflow run metrics, monitor errors, download run or batch results, and export segment data from Cargo. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: Cargo analytics and export commands can expose sensitive workspace data, credentials, downloaded files, and signed URLs. <br>\nMitigation: Install only for authorized Cargo users, verify the active Cargo session before use, and scope exports with workflow, date, status, model, and batch filters. <br>\nRisk: The documented failed-record re-run flow can execute workflows and create real workspace side effects. <br>\nMitigation: Require explicit user approval before creating a new batch for failed records, and confirm that the underlying issue has been fixed before re-running records. <br>\n\n\n## Reference(s): <br>\n- [Cargo skills repository](https://github.com/getcargohq/cargo-skills) <br>\n- [Response shapes](references/response-shapes.md) <br>\n- [Troubleshooting](references/troubleshooting.md) <br>\n- [Run analytics examples](references/examples/run-analytics.md) <br>\n- [Data export examples](references/examples/exports.md) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [guidance, shell commands, configuration, markdown] <br>\n**Output Format:** [Markdown guidance with Cargo CLI command examples and JSON response shapes] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [May guide creation of CSV or JSON exports and signed download URLs; exported workspace data should be treated as sensitive.] <br>\n\n## Skill Version(s): <br>\n1.4.1 (source: frontmatter and server release metadata) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nArchive v1.4.0: 7 files, 9304 bytes\n\nFiles: references/examples/exports.md (3290b), references/examples/run-analytics.md (3691b), references/response-shapes.md (1643b), references/troubleshooting.md (1887b), skill-card.md (2713b), SKILL.md (10926b), _meta.json (134b)\n\nFile v1.4.0:SKILL.md\n\n---\nname: cargo-analytics\ndescription: Download workflow run results, export segment data, and monitor run metrics using the Cargo CLI. Use when the user wants run metrics, error rates, data export, or download results for their Cargo workspace. For billing and credit usage, use the cargo-billing skill instead.\nversion: \"1.4.0\"\ncompatibility: Requires @cargo-ai/cli (npm) and a Cargo account (browser sign-in via --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\"\n        bins:\n          - cargo-ai\n    homepage: https://github.com/getcargohq/cargo-skills\n---\n\n# Cargo CLI — Analytics\n\nMeasurement and export: monitoring run metrics, downloading run and batch results, and exporting segment data.\n\n> See `references/response-shapes.md` for full JSON response structures.\n> See `references/troubleshooting.md` for common errors and how to fix them.\n> See `references/examples/run-analytics.md` for run metrics and error monitoring.\n> See `references/examples/exports.md` for data export and download examples.\n> For billing, usage metrics, and subscription: use the `cargo-billing` skill.\n\n## Prerequisites\n\n```bash\nnpm install -g @cargo-ai/cli\ncargo-ai login --oauth                                  # browser sign-in (recommended)\n# or: cargo-ai login --token <your-api-token>           # workspace-scoped API token (non-interactive)\n# Pin a default workspace at login (with --oauth)\ncargo-ai login --oauth --workspace-uuid <uuid>\n```\n\nVerify with `cargo-ai whoami`. All commands output JSON to stdout. Without a global install, prefix every command with `npx @cargo-ai/cli` instead of `cargo-ai`.\n\nFailed commands exit non-zero and return `{\"errorMessage\": \"...\"}`.\n\n## Discover resources first\n\nMost analytics commands require UUIDs. Discover them before querying.\n\n```bash\ncargo-ai orchestration play list            # all plays (name, workflowUuid)\ncargo-ai orchestration tool list            # all tools (name, workflowUuid)\ncargo-ai orchestration workflow list        # all workflows (uuid only — no name)\ncargo-ai ai agent list                     # all agents (uuid, name)\ncargo-ai connection connector list          # all connectors (uuid, name, integrationSlug)\ncargo-ai storage model list                # all models (uuid, name, slug)\n```\n\n## Quick reference\n\n```bash\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid>\ncargo-ai orchestration run download --workflow-uuid <uuid> --is-finished\ncargo-ai orchestration run count --workflow-uuid <uuid> --statuses error\ncargo-ai orchestration query execute \"SELECT status, count() FROM runs GROUP BY status\"\ncargo-ai segmentation segment download --model-uuid <uuid> --filter '{\"conjonction\":\"and\",\"groups\":[]}'\n```\n\n*","readmeExcerpt":"Skill: cargo-analytics Owner: cargo-ai Summary: Get data out of Cargo and measure what ran — download a run output, export a segment or model to CSV or JSON, and pull run and batch success and error counts. Triggers: \"download the results\", \"export this to CSV\", \"give me the file\", \"how many succeeded\", \"what is my error rate\", \"send me the enriched list\", \"get the output of that run\", \"how many records did it write\"","codeSnippets":[],"executableExamples":[{"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 play list            # all plays (name, workflowUuid)\ncargo-ai orchestration tool list            # all tools (name, workflowUuid)\ncargo-ai orchestration workflow list        # all workflows (uuid only — no name)\ncargo-ai ai agent list                     # all agents (uuid, name)\ncargo-ai connection connector list          # all connectors (uuid, name, integrationSlug)\ncargo-ai storage model list                # all models (uuid, name, slug)"},{"language":"bash","snippet":"cargo-ai orchestration run get-metrics --workflow-uuid <uuid>\ncargo-ai orchestration run download --workflow-uuid <uuid> --is-finished\ncargo-ai orchestration run count --workflow-uuid <uuid> --statuses error\ncargo-ai orchestration query execute \"SELECT status, count() FROM runs GROUP BY status\"\ncargo-ai segmentation segment download --model-uuid <uuid> --filter '{\"conjonction\":\"and\",\"groups\":[]}'"},{"language":"bash","snippet":"# Metrics for a workflow\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid>\n\n# Scoped to a release, batch, or date range\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid> --release-uuid <uuid>\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid> --batch-uuid <uuid>\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid> \\\n  --created-after <start-date> --created-before <end-date>"},{"language":"bash","snippet":"cargo-ai orchestration run count --workflow-uuid <uuid> --statuses error\ncargo-ai orchestration run count --workflow-uuid <uuid> --is-finished \\\n  --created-after <start-date> --created-before <end-date>\ncargo-ai orchestration run count --workflow-uuid <uuid> --batch-uuid <uuid>"},{"language":"bash","snippet":"# Error rate across the workspace in the last day\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# Failed runs per workflow this 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# Per-node failure counts (last 24h)\ncargo-ai orchestration query execute \\\n  \"SELECT node_slug, count() AS failures FROM spans WHERE execution_status='error' AND execution_started_at > now() - INTERVAL 1 DAY GROUP BY node_slug 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 FROM batches WHERE created_at >= toStartOfMonth(now()) GROUP BY workflow_uuid ORDER BY credits DESC\""}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: cargo-analytics\ndescription: \"Get data out of Cargo and measure what ran — download a run output, export a segment or model to CSV or JSON, and pull run and batch success and error counts. Triggers: \\\"download the results\\\", \\\"export this to CSV\\\", \\\"give me the file\\\", \\\"how many succeeded\\\", \\\"what is my error rate\\\", \\\"send me the enriched list\\\", \\\"get the output of that run\\\", \\\"how many records did it write\\\". Skip when: asking why something failed or where credits went — use cargo-diagnostics; asking about credits, plans, or invoices — use cargo-billing.\"\nversion: \"1.6.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 — Analytics\n\nMeasurement and export: monitoring run metrics, downloading run and batch results, and exporting segment data.\n\n> See `references/response-shapes.md` for full JSON response structures.\n> See `references/troubleshooting.md` for common errors and how to fix them.\n> See `references/examples/run-analytics.md` for run metrics and error monitoring.\n> See `references/examples/exports.md` for data export and download examples.\n> For billing, usage metrics, and subscription: use the `cargo-billing` 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## Scope — measure and export, not explain\n\nThis skill answers **\"what happened\"** and **\"give me the data\"**: metrics, counts, downloads, exports. The moment the question becomes **\"why\"** — why did this run fail, why is the output wrong or empty, which root cause explains these errors, why is this play so expensive — switch to the `cargo-diagnostics` skill; its runbooks sequence the raw surfaces into a diagnosis.\n\n| The question sounds like… | Load |\n| --- | --- |\n| \"What's the error rate?\" / \"How many r"},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn7by8t6yt9yghbxtxz6hv0bts87k6bq\",\n  \"slug\": \"cargo-analytics\",\n  \"version\": \"1.6.0\",\n  \"publishedAt\": 1789543554522\n}"},{"path":"references/examples/exports.md","content":"# Data export examples\n\n## Download all finished runs\n\n```bash\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --is-finished\n```\n\n## Download runs by status\n\n```bash\n# Only successful runs\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --statuses success\n\n# Both success and error (for analysis)\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --statuses success,error\n\n# Only error runs (for debugging)\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --statuses error\n```\n\n## Download runs in a date range\n\n```bash\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --created-after 2025-01-01 \\\n  --created-before 2025-01-31\n```\n\n## Download runs from a specific batch\n\n```bash\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --batch-uuid <batch-uuid>\n```\n\n## Download batch output by node\n\n```bash\n# 1. Get the batch and its release UUID\ncargo-ai orchestration batch get <batch-uuid>\n# → Extract releaseUuid\n\n# 2. Find the output node slug\ncargo-ai orchestration release get <release-uuid>\n# → Read nodes[].slug — pick the output node's slug\n\n# 3. Download\ncargo-ai orchestration batch download \\\n  --uuid <batch-uuid> \\\n  --output-node-slug <node-slug>\n```\n\n## Export all segment data\n\n```bash\n# 1. List segments to find the modelUuid\ncargo-ai segmentation segment list\n# → Extract modelUuid (NOT segment uuid)\n\n# 2. Full export\ncargo-ai segmentation segment download \\\n  --model-uuid <model-uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}'\n```\n\n## Export segment data with sorting and limit\n\n```bash\ncargo-ai segmentation segment download \\\n  --model-uuid <model-uuid> \\\n  --filter '{\"conjonction\":\"and\",\"groups\":[]}' \\\n  --sort '[{\"columnSlug\":\"created_at\",\"kind\":\"desc\"}]' \\\n  --limit 5000\n```\n\n## Export filtered segment data\n\n```bash\n# Export only churned accounts\ncargo-ai segmentation segment download \\\n  --model-uuid <model-uuid> \\\n  --filter '{\n    \"conjonction\": \"and\",\n    \"groups\": [{\n      \"conjonction\": \"and\",\n      \"conditions\": [\n        {\"kind\": \"string\", \"columnSlug\": \"status\", \"operator\": \"is\", \"values\": [\"churned\"]}\n      ]\n    }]\n  }'\n\n# Export US companies with 100+ employees\ncargo-ai segmentation segment download \\\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      ]\n    }]\n  }'\n\n# Export records created after a date\ncargo-ai segmentation segment download \\\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```\n\n## Export a segment with non-null email\n\n```"},{"path":"references/examples/run-analytics.md","content":"# Run analytics examples\n\n## Get metrics for a workflow\n\n```bash\ncargo-ai orchestration run get-metrics --workflow-uuid <uuid>\n```\n\nResponse:\n\n```json\n{\n  \"runMetrics\": [\n    {\n      \"nodeUuid\": \"node-uuid-1\",\n      \"totalExecutionsCount\": 1000,\n      \"successExecutionsCount\": 950,\n      \"errorExecutionsCount\": 30,\n      \"cancelledExecutionsCount\": 5,\n      \"creditsUsedCount\": 450\n    }\n  ]\n}\n```\n\nError rate per node = `errorExecutionsCount / totalExecutionsCount`. High error rate on a specific node means that step is failing.\n\n## Metrics scoped to a specific release\n\n```bash\ncargo-ai orchestration run get-metrics \\\n  --workflow-uuid <uuid> \\\n  --release-uuid <release-uuid>\n```\n\n## Metrics scoped to a specific batch\n\n```bash\ncargo-ai orchestration run get-metrics \\\n  --workflow-uuid <uuid> \\\n  --batch-uuid <batch-uuid>\n```\n\n## Metrics for a date range\n\n```bash\ncargo-ai orchestration run get-metrics \\\n  --workflow-uuid <uuid> \\\n  --created-after 2025-01-01 \\\n  --created-before 2025-01-31\n```\n\n## Count errors\n\n```bash\n# Total error count\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses error\n```\n\nResponse:\n\n```json\n{ \"count\": 42 }\n```\n\n```bash\n# Errors in a specific period\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses error \\\n  --created-after 2025-01-15 \\\n  --created-before 2025-01-16\n\n# Errors in a specific batch\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses error \\\n  --batch-uuid <batch-uuid>\n```\n\n## Count finished runs\n\n```bash\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --is-finished\n\n# In a date range\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --is-finished \\\n  --created-after 2025-01-01 \\\n  --created-before 2025-01-31\n```\n\n## Count successful runs\n\n```bash\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses success\n```\n\n## Per-workflow cost analysis (full flow)\n\n```bash\n# 1. List workflows\ncargo-ai orchestration workflow list\n\n# 2. Get usage grouped by workflow\ncargo-ai billing usage get-metrics \\\n  --from 2025-01-01 --to 2025-01-31 \\\n  --group-by workflow_uuid\n\n# 3. Drill into a specific workflow\ncargo-ai billing usage get-metrics \\\n  --from 2025-01-01 --to 2025-01-31 \\\n  --workflow-uuid <uuid>\n\n# 4. Get run-level metrics\ncargo-ai orchestration run get-metrics \\\n  --workflow-uuid <uuid> \\\n  --created-after 2025-01-01 \\\n  --created-before 2025-01-31\n```\n\n## Error monitoring and debugging (full flow)\n\n```bash\n# 1. Count errors\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses error\n\n# 2. Spot-check: count errors in the last 24 hours\ncargo-ai orchestration run count \\\n  --workflow-uuid <uuid> \\\n  --statuses error \\\n  --created-after 2025-01-15 \\\n  --created-before 2025-01-16\n\n# 3. Download error runs for inspection\ncargo-ai orchestration run download \\\n  --workflow-uuid <uuid> \\\n  --statuses error \\\n  --created-after 2025-01-15\n\n# 4. Check per-node error rates\ncargo-ai orch"},{"path":"references/response-shapes.md","content":"# Response shapes\n\nJSON response structures returned by Cargo CLI commands used in the `cargo-analytics` skill.\n\n> For billing response shapes (usage metrics, subscription, invoices), see the `cargo-billing` skill.\n\n## cargo-ai orchestration run get-metrics\n\n```json\n{\n  \"runMetrics\": [\n    {\n      \"nodeUuid\": \"node-uuid-1\",\n      \"totalExecutionsCount\": 1000,\n      \"idleExecutionsCount\": 0,\n      \"pendingExecutionsCount\": 5,\n      \"runningExecutionsCount\": 10,\n      \"successExecutionsCount\": 950,\n      \"errorExecutionsCount\": 30,\n      \"cancelledExecutionsCount\": 5,\n      \"skippedExecutionsCount\": 0,\n      \"creditsUsedCount\": 450\n    }\n  ]\n}\n```\n\n**Key fields:** `nodeUuid` (identifies the workflow node), `successExecutionsCount`, `errorExecutionsCount`, `creditsUsedCount`.\n\nTo compute an error rate: `errorExecutionsCount / totalExecutionsCount`.\n\n## cargo-ai orchestration run count\n\n```json\n{\n  \"count\": 42\n}\n```\n\n## cargo-ai orchestration run list\n\n```json\n{\n  \"runs\": [\n    {\n      \"uuid\": \"run-uuid\",\n      \"workflowUuid\": \"...\",\n      \"status\": \"success\",\n      \"batchUuid\": \"batch-uuid-or-null\",\n      \"releaseUuid\": \"...\",\n      \"recordId\": \"rec-123\",\n      \"recordTitle\": \"Acme Corp\",\n      \"createdAt\": \"2025-01-15T10:00:00Z\",\n      \"finishedAt\": \"2025-01-15T10:00:05Z\"\n    }\n  ]\n}\n```\n\n## cargo-ai segmentation segment download\n\nReturns raw data as a downloadable payload (typically CSV or JSON depending on the CLI output format). The response is streamed to stdout.\n\n## cargo-ai orchestration batch download\n\nReturns `{\"url\": \"...\"}` — a signed URL to a file, **not** the data on stdout. Each row is a batch record joined to its run's output for the chosen node (defaulting to the last executed node), so a record whose run errored comes back with its input fields and no output.\n\n## cargo-ai orchestration run download\n\nReturns `{\"url\": \"...\"}` — a signed URL to a **gzipped CSV**. One row per run: `_uuid`, `_workspace_uuid`, `_workflow_uuid`, `_record_id`, `_record_title`, `_created_at`, `_finished_at`, `_status`, `_error_message`, then one column per node slug holding that execution's `title` (a truncated summary, not the node's output). No `runContext`, no `executions[]`.\n\n## cargo-ai orchestration run download-outputs\n\nReturns `{\"url\": \"...\"}` — a signed URL to CSV (default) or JSON. One row per run: the `_`-prefixed run metadata above, plus `input` (first node's resolved config) and `output` (chosen node's context, defaulting to the last executed node)."}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":null,"editorialQuality":{"score":100,"threshold":65,"status":"thin","wordCount":1786,"uniquenessScore":35,"reasons":["uniqueness-below-45"]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-10T11:51:48.689Z","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-10T11:51:48.689Z","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-10T14:43:59.653Z","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"}]}}}