Metadata-Version: 2.4
Name: zambo-ai
Version: 1.0.18
Summary: Official Python SDK for Zambo (zambo.dev), the verifiable work layer for AI: tools behind one MCP endpoint (https://zambo.dev/mcp) over plain JSON-RPC, a verifiable receipt for every job. Includes SpendGuard: a hard per-call and per-day cap in front of your agent wallet, refusals recorded. Plus costcalc: prices an agent loop and generates a spend policy sized to the worst case. No account, no API key. Free: every tool free once a day, plus 3 continue calls; one free wrap-up handover per day, pickup free.
Author-email: Zambo <brennanzambo@zambo.dev>
License: MIT
Project-URL: AER-1 standard, https://zambo.dev/aer1/
Project-URL: Add Zambo to your AI, https://zambo.dev/add/
Project-URL: Homepage, https://zambo.dev
Project-URL: Documentation, https://zambo.dev
Project-URL: Source, https://gitlab.com/rambozambodotdev/zambo
Keywords: mcp,ai-tools,zambo,agents,crypto,seo-audit,spend-limit,agent-wallet,x402,spend-guard
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# zambo-ai

**AER-1, the agent execution receipt standard: [zambo.dev/aer-1](https://zambo.dev/aer-1/) | Add Zambo to your AI: [zambo.dev/add/](https://zambo.dev/add/)**

Zambo is the verifiable work layer for AI. This is its official Python SDK: tools behind one MCP endpoint over plain JSON-RPC, a verifiable receipt for every job.

Receipt format: AER-1, IETF Internet-Draft [draft-zambo-aer1-26](https://datatracker.ietf.org/doc/draft-zambo-aer1/26/).

Official Python SDK for [Zambo](https://zambo.dev), MCP tools for AI agents and apps over plain JSON-RPC 2.0. **No account, no API key.** Free: every tool free once a day, plus 3 continue calls; picking up in another AI is always free.

Every call returns a **verifiable receipt** (UUID + timestamp + SHA-256). Check any receipt at `https://zambo.dev/run/<id>`.

## Install

```bash
pip install zambo-ai
```

Zero dependencies, stdlib only. Python 3.8+.

## Quickstart

```python
from zambo_ai import Zambo

z = Zambo()

# Live crypto price
btc = z.price("BTC")
print(btc.text)
# BTC · $75,704.00 USD ...   (live value at publish time)

# Describe any job in plain language: Zambo chains the right tools
job = z.universal("audit https://example.com for AI discoverability", session="my-session-1")
print(job.text)
print("receipt:", job.receipt_id)  # verify at https://zambo.dev/run/<id>

# Call any tool directly
r = z.call("live_price", {"coin": "ETH"})

# Search the tool catalog
found = z.search("generate QR code")

# List exposed tools
tools = z.list_tools()
```

## API

| Method | Description |
|---|---|
| `z.price(coin)` | Live crypto price (`"BTC"`, `"ETH"`, …) |
| `z.universal(goal, session=None)` | Plain-language job → Zambo routes and executes tools. Pass a stable `session` id to continue a trail across models. |
| `z.call(tool, args)` | Direct tool call, e.g. `z.call("live_price", {"coin": "ETH"})` |
| `z.search(query)` | Search the full tool catalog |
| `z.list_tools()` | List exposed tools with descriptions |

Every result: `text`, `receipt`, `receipt_id`, `audit_url`, `raw`. JSON-RPC failures raise `zambo_ai.ZamboError`.

## Spend Guard: stop your agent from spending your money

Your agent has a wallet, a task, and no brakes. One stuck loop can burn the whole balance before you wake up: agents have drained wallets retrying a failing payment hundreds of times, and a cap that lives in a prompt is not a cap at all. Spend Guard is a hard cap that sits in front of the payment call itself, in code, where a loop cannot talk its way past it.

It ships inside this SDK (`zambo_ai.spendguard`, stdlib only) and adds a `spendguard` command line tool.

Two lines in front of any payment callable:

```python
from zambo_ai import SpendGuard

guard = SpendGuard(per_call_cap_usd=10, daily_cap_usd=25)

@guard.protect(amount_of=lambda amount, payee=None: amount)
def pay(amount, payee=None):
    ...  # your wallet or x402 payment call: it runs only when the guard allows the spend
```

Or guard a block:

```python
with guard.spend(4.99, payee="api.example.com"):
    pay(4.99, payee="api.example.com")  # a refusal raises SpendRefused before this runs
```

What it enforces:

- **Per-call cap and per-day cap** (USD, UTC days). A spend inside the caps is recorded and allowed. A spend over a cap never fires.
- **Optional payee allowlist.** A payee that is not on the list is refused like any other cap breach.
- **Refusals are records, not silence.** Every refusal is appended to `refusals.jsonl` in the state directory with the timestamp, the amount, the payee, and which cap it hit. When you ask "did my agent try to spend $900 at 3am?", the log answers with a fact you can audit, and the state file proves the day's total never went past the cap.
- **State survives restarts.** Caps and totals live in `~/.spendguard` (or `$SPENDGUARD_HOME`), so a fresh process keeps enforcing the same numbers.

From the shell:

```bash
spendguard init --per-call 10 --daily 25
spendguard check 4.99 --payee api.example.com   # exit 0: allowed and recorded
spendguard check 40                             # exit 3: refused and recorded
spendguard status                               # today's spend vs the caps, refusal count
spendguard refusals                             # the audit log
```

**Server-side cap too.** If the machine can reach the Zambo endpoint, `spendguard sync --session <your-job-id>` also sets the same daily cap on the Zambo work connection itself through the `spend_limit_set` tool (free, no quota), so the server enforces the cap even across session restarts. If the network is down, sync says so and the local guard keeps enforcing on its own. It never blocks a local verdict.

The local guard is free forever. The portable version, caps set on the Zambo connection so they follow the work instead of one machine, runs on the same pricing as everything else here: the Day Pass is $0.99 for the days your agent works, the Zambo Pass is $29 for 30 days ($19 for $ZAMBO holders), and Lifetime is $250, one payment.

## Cost Calculator: price the loop before it runs

Spend Guard enforces the caps. This calculator tells you what the caps should be. Give it your model's token prices and your loop's shape, and it returns the expected bill, the worst case at the iteration limit, and the runaway rate: what one hour costs if the loop never stops.

```bash
costcalc estimate --input-price 3 --output-price 15 --input-tokens 4000 --output-tokens 800 --tool-calls 3 --tool-cost 0.02 --expected-iterations 12 --max-iterations 50 --runs-per-day 20
costcalc policy --input-price 3 --output-price 15 --input-tokens 4000 --output-tokens 800 --tool-calls 3 --tool-cost 0.02 --expected-iterations 12 --max-iterations 50 --runs-per-day 20
```

For that loop the estimate reads: $0.08 per iteration, $1.01 expected per run, $4.20 worst case per run, $84.00 worst case per day, and $60.48 per hour if the loop runs away with no limit. The `policy` command prints a ready-to-enforce spend policy sized to the worst case: a SpendGuard config, the `spendguard init` command, and the `spend_limit_set` arguments for the Zambo work connection. In code: `from zambo_ai.costcalc import estimate_run, generate_policy`. You pass the prices in; the calculator ships no price list, because a stale price list is worse than none. Free and local, no account. Guide: https://rambozambodotdev.gitlab.io/aer1-hub/agent-runaway-cost-calculator.html

## Pricing

Free: every tool free once a day, plus 3 continue calls; one free wrap-up handover per day, pickup always free. No account, no API key.

When the free calls run out mid-job, the next call is refused and does not run, and the refused call burns no quota. To keep going the same day, get a Day Pass: $0.99 for unlimited calls for 24 hours at https://zambo.dev/day-pass/ (card or PayPal for humans, USDC on Base via x402 for agents).

Run Zambo every day: the Zambo Pass is $29 for 30 days ($19 for $ZAMBO holders), or Lifetime at $250, one payment. Day Pass and Pass are one-time payments, never subscriptions.

Every job can close as a handover your client or your next AI picks up and checks from its verifiable AER-1 receipt. Try it first: https://zambo.dev/demo/

(From [zambo.dev/pricing](https://zambo.dev/pricing).)

## Links

- Zambo: https://zambo.dev
- Full tool catalog: https://zambo.dev/mcp?full=true
- MCP endpoint: `https://zambo.dev/mcp`

## License

MIT

## Where these receipts run live: Zambo

zambo-ai is the official Python SDK for Zambo, every call returning a verifiable AER-1 receipt, and it has been downloaded more than 5,000 times on PyPI. The live home of those receipts is Zambo, the verifiable work layer for AI. Connect any AI to the live endpoint at https://zambo.dev/mcp or add Zambo to your AI in one step at https://zambo.dev/add/

Free tier: every tool free once a day, plus 3 continue calls; picking up in another AI is always free. The Day Pass is $0.99 for 24 hours, unlimited.

Install:

    pip install zambo-ai
