---
name: tesi-agent-api
description: Commission complete tested software projects, clean-room download checks, CSV/data cleanup, specification audits, and research tasks on TESI's isolated prepaid computer via MCP or HTTP 402, with free pre-spend credit quoting, deterministic acceptance checks, and crash-safe receipt recovery.
---

# TESI Agent API Skill (`https://toolsenabled.ai/agents/`)

TESI gives external software agents two programmatic modes on each bearer key's isolated Linux computer (`1 vCPU, 2 GB RAM, 4 GB disk`):
- **`Ask` (`POST /api/v1/agents/chat` / `tesi_ask`)**: Read-only analysis, verification, or second-opinion answers.
- **`Work` (`POST /api/v1/agents/work` / `tesi_work`)**: End-to-end execution of a scoped deliverable with runnable tests or validation checks returned in `reply`.

Prepaid USD credit packs start at **$10 USD** (`1000` cents) and meter token usage at [published TESI rates](https://toolsenabled.ai/pricing/) with zero monthly commitment. Discovery, request validation, and starting-credit quotes are free and require no key.

## 1. Fit Check — When to Use TESI (and When Not To)

**Use TESI when:**
- You can state a concrete deliverable and machine-checkable acceptance criteria (for example: a stdlib Python/SQLite service with loopback HTTP tests, a deduplicated CSV with exact row counts, or a cited Markdown specification review).
- You want execution isolated on a dedicated remote computer rather than inside the caller's host environment.
- You want deterministic pre-spend admission quotes and crash-safe receipt recovery by `requestId`.

**Do NOT use TESI when:**
- You need sub-100ms token-streaming autocomplete or raw single-model chat completions without TESI's computer runtime.
- The task requires direct access to private credentials, databases, or internal VPC services that cannot be represented as a sanitized fixture or public input.
- You expect unattended credit-card charging without a human purchaser approving Stripe Checkout (`checkoutUrl`).
- The task is an open-ended background daemon with no completion condition.

## 2. Connect in 60 Seconds via Official MCP Server (Recommended)

Download and verify the zero-dependency Python 3.10+ stdio MCP server:

```bash
curl -fsS https://toolsenabled.ai/agents/tesi-agent-mcp.py.txt -o tesi-agent-mcp.py
expected=$(curl -fsS https://toolsenabled.ai/api/v1/agents/quickstart | python3 -I -c 'import json,sys; print(json.load(sys.stdin)["mcpServer"]["sha256"])')
python3 -I -c 'import hashlib,pathlib,sys; sys.exit(0 if hashlib.sha256(pathlib.Path("tesi-agent-mcp.py").read_bytes()).hexdigest()==sys.argv[1] else 1)' "$expected"
python3 -I tesi-agent-mcp.py --self-check
```

Register in Claude Code, Codex CLI, Cursor, or any MCP host (machine-readable manifest at `https://toolsenabled.ai/agents/mcp-server.json` and `https://toolsenabled.ai/.well-known/mcp/server.json`):

```bash
claude mcp add --transport stdio tesi -- python3 -I "$PWD/tesi-agent-mcp.py" --key-file "$PWD/tesi-purchase/key.json"
codex mcp add tesi -- python3 -I "$PWD/tesi-agent-mcp.py" --key-file "$PWD/tesi-purchase/key.json"
```

Or add to `mcpServers` JSON (`python3 -I tesi-agent-mcp.py --print-config`):

```json
{
  "mcpServers": {
    "tesi": {
      "command": "python3",
      "args": ["-I", "/absolute/path/to/tesi-agent-mcp.py", "--key-file", "./tesi-purchase/key.json"]
    }
  }
}
```

### MCP Workflow
1. **Quote before spending (free, no key):** Call `tesi_discover` and `tesi_quote(message=...)` (or `tesi_quote(sourceDir="./src", message=...)` to pack and measure a local codebase safely without sending source text) or `tesi_shortlist_work(budgetCredits="10.00")`.
2. **Fund & claim opaquely:** Call `tesi_prepare_purchase(amountCents=1000)` and present `checkoutUrl` to the human purchaser (or preview/redeem an issued `giftCode` via `tesi_claim_key` or `TESI_GIFT_CODE=... python3 -I tesi-buy.py redeem-code ./tesi-purchase`). After payment, call `tesi_claim_key(confirmSaved=True)` — it writes `0600` `./tesi-purchase/key.json` and never echoes the raw `tesi_ak_...` token into chat.
3. **Commission & extract cleanly:** Call `tesi_ask` or `tesi_work(message=..., acceptanceChecks=[...], sourceDir="./src", extractFilesTo="./delivered", effort="medium")`. The MCP server refuses secrets/symlinks, journals `requestId` (`mw_` + 32 hex) before sending, sets `TESI-Topup-Mode: manual` and `TESI-Checked-Request`, verifies `replySha256`, extracts fenced files into `./delivered` with `TESI-DELIVERY-MANIFEST.json`, and recovers automatically via `tesi_receipt` if interrupted.
4. **Verify & audit per-job cost:** Run your local acceptance tests (or offline checkers `check-sku.py`, `check-reconciliation.py`, or `print-quote-check.py`) inside `./delivered`, inspect itemized `agc_...` settled debits via `tesi_usage`, and read built-in MCP resources (`tesi://guide/decision-rubric`, `tesi://status/local-custody`, `tesi://catalog/quickstart`, `tesi://guide/skill`) or prompts (`commission-tested-project`, `patch-local-codebase`, `verify-public-download`, `reconcile-csv-ledgers`) anytime.

## 3. Direct CLI / HTTP 402 Fallback (No MCP Required)

- **Compact JSON discovery:** `GET https://toolsenabled.ai/api/v1/agents/quickstart`
- **Buyer CLI (`0700` purchase state):** `https://toolsenabled.ai/agents/tesi-buy.py.txt` (`quote`, `draft`, `checkout`, `claim`, `confirm`)
- **Receipt & execution CLI:** `https://toolsenabled.ai/agents/tesi-receipt.py.txt` (`--verify-public`, `--prepare-work`, `--check-credit`, `--submit --no-checkout --wait 120`, `--verify-reply-bundle`)
- **Tested deliverable walkthrough & comparison:** `https://toolsenabled.ai/agents/handoff-tested-project/`
- **Compact text quickstart:** `https://toolsenabled.ai/agents/quickstart.txt` (full CLI reference: `https://toolsenabled.ai/agents/reference.txt`)
- **OpenAPI 3.1.1:** `https://toolsenabled.ai/agents/openapi.yaml`
