---
name: batch-anything
description: Headless streaming bulk table waterfall enrichment engine (100 to 100,000+ rows) via Streamable HTTP MCP or REST API. Bills strictly per verified non-empty row ($0 on empty, 404, or fake-200) with hard max_budget_usd pause/resume tokens and Zero Customer Table Resale.
---

# Batch-Anything — AI Agent Integration Skill (`batch.fastmesh.dev`)

- **Base URL**: `https://batch.fastmesh.dev`
- **Remote Streamable MCP**: `https://batch.fastmesh.dev/mcp` (JSON-RPC 2.0)
- **OpenAPI 3.1 Spec**: `https://batch.fastmesh.dev/openapi.json`
- **Machine Index**: `https://batch.fastmesh.dev/llms.txt`
- **Treg Hub ID**: `batch-anything-waterfall` (`0%` seller commission, `$0` on empty)
- **Causal Bazaar Hand ID**: `batch_anything_waterfall_v1` (`is_public=1`)
- **Measured Performance (Loop 3 Gauntlet)**: `1,535.28` rows/sec on 10,000 rows · `8.03` MB peak memory (`tracemalloc`) · `16/16` PASS
- **Hard Privacy Guarantee**: Zero Customer Table Resale — uploaded rows, payloads, BYOK keys, and traces are never resold or used to train models.

---

## 1. Connect via Streamable HTTP MCP (`POST /mcp`)

### Step A: Initialize & List Flat Tools

```bash
curl -fsSL -X POST "https://batch.fastmesh.dev/mcp" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"my-agent","version":"1.0"}}}'

curl -fsSL -X POST "https://batch.fastmesh.dev/mcp" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}'
```

### Exposed MCP Tools
| Tool Name | Purpose | Recommended Size |
| :--- | :--- | :--- |
| `batch_quote` | Estimate worst-case & cache-adjusted cost before spending | Any table size |
| `batch_enrich_run` | Synchronous verified enrichment returning rows + billing audit immediately | 1–200 rows |
| `batch_submit_job` | Async background submission returning `job_id` immediately | 200–100,000+ rows |
| `batch_job_status` | Poll progress, `cache_hit_rate`, `dead_letter_count`, `saved_on_empty_rows_micros`, `resume_token` | Async jobs |
| `batch_resume_job` | Continue a budget-paused job strictly on remaining rows (`0` duplicate charges) | Paused jobs |

### Step B: Quote Then Enrich Over MCP

```bash
# Quote first
curl -fsSL -X POST "https://batch.fastmesh.dev/mcp" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"batch_quote","arguments":{"workflow":"b2b_domain_enrich","tenant_id":"agent_team","rows":[{"domain":"stripe.com"},{"domain":"linear.app"}]}}}'

# Run synchronous batch with strict budget cap
curl -fsSL -X POST "https://batch.fastmesh.dev/mcp" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"batch_enrich_run","arguments":{"workflow":"b2b_domain_enrich","tenant_id":"agent_team","max_budget_usd":1.0,"rows":[{"domain":"stripe.com"},{"domain":"linear.app"},{"domain":"dead-host-example.invalid"}]}}}'
```

---

## 2. REST API Workflows (`/v1/batch/run` & `/v1/batch/submit`)

### Built-In Workflows
| Workflow ID | List Price / Verified Row | Repeat Fee (`10%`) | Input Column(s) | Output Highlights | Cache TTL Class |
| :--- | :---: | :---: | :--- | :--- | :--- |
| `b2b_domain_enrich` | `$0.0030` | `$0.0003` | `domain` (+ optional `company_name`) | Live DNS TXT SPF & DMARC, homepage title, `/pricing` signal, contact meta, fake-200 guard | 7d–30d adaptive |
| `sku_openfoodfacts_enrich` | `$0.0020` | `$0.0002` | `barcode` (+ optional `sku_id`) | OpenFoodFacts product name, brands, categories, Nutri-Score, NOVA, Eco-Score | 14d–30d adaptive |
| `oss_package_enrich` | `$0.0020` | `$0.0002` | `package_name`, `ecosystem` (`pypi`/`npm`/`github`) | Latest version, SPDX license, summary, repo URL, stars, forks, archived | 7d–30d adaptive |
| `url_health_patrol` | `$0.0015` | `$0.00015` | `url` (+ optional `healthy_only`) | Live HTTP status + deterministic fake-200 classifier (soft-404, login wall, challenge, empty shell) | Volatile (`-1`) |
| `chained_mcp_http` | `$0.0050` | `$0.0005` | Seed col + `chain_steps` (`depends_on`, `when_non_empty`) | Conditional derived columns skipping 100% of dead rows before Col C at `$0` | Step-adaptive |

### Synchronous Run (`POST /v1/batch/run`)

Accepts `rows` (JSON array) OR raw `data` string in `csv`, `tsv`, `jsonl`, or `json` format:

```bash
curl -fsSL -X POST "https://batch.fastmesh.dev/v1/batch/run" \
  -H "Content-Type: application/json" \
  -d '{
    "workflow": "oss_package_enrich",
    "tenant_id": "ci_sbom_agent",
    "max_budget_usd": 1.0,
    "output_format": "json",
    "rows": [
      {"ecosystem": "pypi", "package_name": "requests"},
      {"ecosystem": "npm", "package_name": "zod"},
      {"ecosystem": "pypi", "package_name": "does-not-exist-99999"}
    ]
  }'
```

### Async Submit + Export (`POST /v1/batch/submit` -> `GET /v1/batch/{job_id}/export`)

```bash
# Submit 10,000+ row CSV/JSONL job (returns HTTP 202 + job_id)
curl -fsSL -X POST "https://batch.fastmesh.dev/v1/batch/submit" \
  -H "Content-Type: application/json" \
  -d '{
    "workflow": "b2b_domain_enrich",
    "tenant_id": "revops_pipeline",
    "input_format": "csv",
    "data": "domain\nstripe.com\nlinear.app\nnonexistent.invalid\n",
    "max_budget_usd": 2.50,
    "per_domain_rps": 4.0,
    "max_workers": 16
  }'

# Poll status
curl -fsSL "https://batch.fastmesh.dev/v1/batch/<job_id>"

# Export clean enriched table as csv | tsv | json | jsonl | sqlite | columnar
curl -fsSL "https://batch.fastmesh.dev/v1/batch/<job_id>/export?format=jsonl&include=enriched"
curl -fsSL "https://batch.fastmesh.dev/v1/batch/<job_id>/export?format=jsonl&include=dead_letter"
curl -fsSL -o enriched.sqlite "https://batch.fastmesh.dev/v1/batch/<job_id>/export?format=sqlite"

# Discover workflows, quote, check wallet, or store write-only BYOK key (0% markup)
curl -fsSL "https://batch.fastmesh.dev/v1/workflows"
curl -fsSL "https://batch.fastmesh.dev/v1/wallet/revops_pipeline"
curl -fsSL -X POST "https://batch.fastmesh.dev/v1/byok/keys" \
  -H "Content-Type: application/json" \
  -d '{"tenant_id":"revops_pipeline","provider":"github","api_key":"$GITHUB_TOKEN"}'
```

---

## 3. Handling Budget Caps & `resume_token` (Zero Duplicate Charges)

Always pass `max_budget_usd` (whole-batch hard ceiling) and optional `max_cost_micros` (per-row ceiling) when operating autonomously:

1. If a batch hits `max_budget_usd` mid-run, the engine pauses cleanly without overspending, preserves all enriched rows for export, and emits a durable `resume_token`.
2. Inspect `rows_enriched`, `dead_letter_count`, `saved_on_empty_rows_micros`, and `billed_micros` from `GET /v1/batch/{job_id}` (or `batch_job_status`).
3. Resume strictly the remaining unprocessed rows with **0 duplicate charges**:

```bash
curl -fsSL -X POST "https://batch.fastmesh.dev/v1/batch/<job_id>/resume" \
  -H "Content-Type: application/json" \
  -d '{"resume_token": "<resume_token>", "max_budget_usd": 10.0}'
```

Or via MCP tool `batch_resume_job`:

```json
{
  "jsonrpc": "2.0",
  "id": 9,
  "method": "tools/call",
  "params": {
    "name": "batch_resume_job",
    "arguments": {
      "job_id": "<job_id>",
      "resume_token": "<resume_token>",
      "max_budget_usd": 10.0
    }
  }
}
```

---

## 4. Auditing Zero-Empty Billing & Dead-Letter Rows

Every completed or paused batch emits verifiable accounting fields:
- `rows_total`: Total input rows submitted.
- `rows_enriched`: Verified non-empty rows delivered.
- `rows_empty_zero_billed`: Empty, malformed, 404, timeout, and fake-200 rows billed strictly `$0.00`.
- `dead_letter_count` & `dead_letter_rows`: Exact row index, original key, HTTP/probe status, and rejection reason (`fake_200_challenge`, `soft_404`, `login_wall`, `invalid_input`, `timeout`, `empty_result`).
- `within_batch_dedup_saved`: Duplicate keys collapsed before upstream dispatch.
- `cache_hits_same_tenant`: Same-tenant repeat hits billed at `10%` of base rate (`90%` savings).
- `cache_hits_cross_tenant` & `cache_hit_rate`: Verified public archive hits served with `$0` upstream wait.
- `billed_micros` & `saved_on_empty_rows_micros`: Exact micro-USD charged vs. exact micro-USD saved by zero-empty protection.
- `receipt_sha256`: Deterministic SHA-256 digest over batch counts and billing settlement.

### Agent Best Practices
1. Call `batch_quote` before large runs and always set `max_budget_usd`.
2. Reuse a consistent `tenant_id` across runs to unlock `10%` same-tenant repeat cache pricing.
3. For multi-step enrichment, use `chained_mcp_http` with `depends_on` and `when_non_empty: true` so dead rows skip downstream steps at `$0`.
4. Never attempt to bypass login walls or CAPTCHAs — let `detect_fake_200` isolate gated targets into `dead_letter_rows` at `$0.00`.

---

## 5. Never-Expiring Prepaid Packs (Creem)

- **Starter Pack (`$19`)**: $19 credit (19M micros · 6,333 B2B domains / 12,666 URL checks) — never expires (https://batch.fastmesh.dev/#pricing)
- **Growth Pack (`$79`)**: $90 credit (90M micros · 30,000 B2B domains / 60,000 URL checks) — never expires (https://batch.fastmesh.dev/#pricing)
- **Scale Pack (`$249`)**: $325 credit (325M micros · 108,333 B2B domains / 216,666 URL checks) — never expires (https://batch.fastmesh.dev/#pricing)

- Full technical guides (24 pages): `https://batch.fastmesh.dev/seo_geo/`
- Support: `support@fastmesh.dev`
