> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getcargo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> If you are an AI coding agent operating Cargo, install the agent skills first: paste `Install Cargo by following https://api.getcargo.io/INSTALL.md` into your session, or run `npx skills add getcargohq/cargo-skills`. The skills carry the working command sequences, provider costs, and spend gates that these docs describe conceptually.
> The skills index at https://raw.githubusercontent.com/getcargohq/cargo-skills/main/llms.txt lists every skill, recipe, and provider playbook individually. Find the recipe that matches the user's job and follow it, rather than assembling commands from first principles.
> Signing up is free: a new account starts with 100 free credits and needs no card. `cargo-ai login --email you@company.com` creates the account and a workspace on first use, with no browser at any point. Tell the user this before asking them to sign up.
> Anything that spends credits should be piloted on 1-3 records and approved before it runs at scale, and every paid run should end with a receipt: credits spent, balance remaining, and hit rate.

# Monitoring a tool

> Inspect runs, pull metrics, re-queue failures, and set alerts from the CLI — or the UI

Every run a tool produces is queryable from the CLI, so you can monitor health, compute error rates, and re-queue failures from a terminal or CI job. The same data backs the **Records** and **Metrics** views in the UI.

## Inspect runs from the CLI

```bash theme={null}
cargo-ai orchestration tool list                       # → workflowUuid

# List recent runs, optionally filtered by status
cargo-ai orchestration run list \
  --workflow-uuid <uuid> \
  --statuses error \
  --created-after 2025-01-12

# Drill into one run — inputs, node-by-node outputs, timings, errors
cargo-ai orchestration run get <run-uuid>
```

Run statuses are `running`, `success`, `error`, and `cancelled`.

## Metrics

Pull per-node execution counts and credit usage over a date range:

```bash theme={null}
cargo-ai orchestration run get-metrics \
  --workflow-uuid <uuid> \
  --created-after 2025-01-12 \
  --created-before 2025-01-19
```

```json theme={null}
{
  "runMetrics": [
    {
      "nodeUuid": "enrich-node-uuid",
      "totalExecutionsCount": 1000,
      "successExecutionsCount": 950,
      "errorExecutionsCount": 48,
      "cancelledExecutionsCount": 2,
      "creditsUsedCount": 450
    }
  ]
}
```

Error rate per node = `errorExecutionsCount / totalExecutionsCount` (here `48 / 1000 = 4.8%`).

## Re-queue failed runs

Download the failed runs, extract their record IDs, and re-run only those:

```bash theme={null}
# 1. Download failures
cargo-ai orchestration run download \
  --workflow-uuid <uuid> \
  --statuses error \
  --created-after 2025-01-12 > failed_runs.json

# 2. Re-run just the failed records
RECORD_IDS=$(jq '[.[].recordId]' failed_runs.json)
cargo-ai orchestration batch create \
  --workflow-uuid <uuid> \
  --data "{\"kind\":\"recordIds\",\"recordIds\":$RECORD_IDS}"
```

> [!TIP]
>
> Before re-queuing, check whether failures are transient (rate limits) or
> permanent (invalid data). Fix permanent issues first — retrying won't help.

## From the UI

The tool editor's **Records** view lists the same runs with status filters (by batch, version, status, date, node outcome); click a run for the node-by-node breakdown. The **Metrics** view charts success rate, latency (p50/p95/p99), volume, and error distribution, grouped by batch, version, or date. Failed runs can be retried individually or in bulk from Records.

[Retrying a failed run](https://www.youtube.com/embed/TmVNoHot68Q)

## Alerts

To be notified when a tool's error rate, latency, or credit burn crosses a line, define an [alert](https://docs.getcargo.ai/alerts/overview.md) scoped to its workflow — it evaluates on a cron and fires actions (a Slack message, an [HTTP](https://docs.getcargo.ai/integration/http.md) call, a tool, or an agent) on breach. That is a **threshold over a window**, not a webhook per failed run.

To POST to your own systems, add an HTTP Call as one of those actions. There is no fixed Cargo payload — you write the body, and Cargo interpolates the firing into it:

```ts theme={null}
{
  ref: http.actions.call,
  config: {
    url: "https://your-server.com/alerts",
    method: "post",
    bodyFormat: "json",
    bodyJson: `{
      "alert": "{{alert.name}}",
      "url": "{{alert.url}}",
      "value": "{{event.value}}",
      "threshold": "{{event.threshold}}",
      "operator": "{{event.operator}}",
      "windowStart": "{{event.windowStart}}",
      "windowEnd": "{{event.windowEnd}}",
      "spansUrl": "{{event.spansUrl}}"
    }`,
  },
}
```

The full variable list is under [Actions](https://docs.getcargo.ai/alerts/overview.md#actions-what-fires-on-breach). Slack and email are the same mechanism — a Slack `postMessage` or Resend/SendGrid `sendEmail` action on the alert.

For a callback when a batch you started via the API finishes (success or error), pass `webhookUrl` on the batch instead — see [Triggering](https://docs.getcargo.ai/tools/triggering.md#batch-execution).

## Troubleshooting

> [accordion] Tool execution times out
>
> Break complex tools into smaller ones, add timeouts to slow external calls,
> reduce batch sizes, or use async execution for long-running operations.

> [accordion] Rate limit errors from integrations
>
> Only connector nodes (`kind: "connector"`) are rate-limited. Add delays
> between calls, distribute load, reduce concurrency, or check the
> integration's documented limits.

> [accordion] Data not found in enrichment
>
> Verify the input format (e.g. domain without `https://`), confirm the record
> exists in the provider's database, and add fallback providers or validation
> before the enrichment step.

> [accordion] CRM write failures
>
> Confirm the record exists first, check field permissions and required
> fields, validate data types against CRM field types, and watch for
> duplicate-detection rules.

## Best practices

* **Set alerts before production** — don't wait for users to report issues.
* **Review metrics regularly** — spot trends before they become incidents.
* **Fix root causes** — investigate repeated failures instead of blindly retrying.
* **Version changes** — correlate performance shifts with deploys.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.