VeriState
# VeriState — Agent-Native State, Verification & Micro-Billing SaaS
VeriState is a metered API SaaS built specifically for autonomous AI agents and bots. Agents discover capabilities via `/.well-known/agent.json`, register programmatically, pay per call in micro-USD (`1 USD = 1,000,000 micro-USD`), and handle `HTTP 402 Payment Required` top-ups automatically.
## Core Capabilities & Pricing
- **Checkpoints**: `POST /v1/checkpoints` (`$0.002`), `GET /v1/checkpoints` (free), `POST /v1/checkpoints/{id}/restore` (`$0.001`) — Content-addressed project snapshots and rollback.
- **Sandboxed Verification**: `POST /v1/verify` (`$0.005`) — JSON validation and isolated Python syntax, `entrypoint`, and `unittest` runner returning compact verdicts. Runs inside ephemeral `--network=none`, `--read-only`, CPU/RAM/PID-capped Docker containers in production.
- **Shared Agent Memory**: `POST /v1/memory` (`$0.0005`), `GET /v1/memory/{ns}/{k}` (`$0.0001`), `DELETE /v1/memory/{ns}/{k}` (free) — TTL-aware key-value memory across subagents.
- **Billing & Replay Protection**: `POST /v1/billing/topup` & `POST /v1/billing/stripe-webhook` — Single-use `payment_proof` tracking (`HTTP 409` on replay), hardened test/voucher mode, and optional live Stripe `PaymentIntent` verification when `STRIPE_SECRET_KEY` is configured.
- **Account & Audit**: `GET /v1/agents/balance`, `GET /v1/agents/ledger`, `GET /health`.
## Run Locally
```bash
pip install -r requirements.txt
uvicorn app.main:app --reload
```
## Run Tests
```bash
python -m unittest discover -s tests -v
```
## Agent Discovery & MCP Integration
- **Web Dashboard**: `/` or `/dashboard`
- **AI Crawler Summary**: `/llms.txt`, `/robots.txt`, `/sitemap.xml`
- **Machine Manifest**: `/.well-known/agent.json`
- **Remote MCP Server (Streamable HTTP)**: `POST /mcp` (metadata at `GET /mcp`, registry manifest in [server.json](server.json))
## Python SDK
Install directly from source or GitHub:
```bash
pip install git+https://github.com/stonedtalesdivision/veristate.git
```
See [sdk/veristate_agent.py](sdk/veristate_agent.py) (`VeriStateClient`) for programmatic discovery, registration, checkpointing, verification, memory, and automatic `402` top-up retries.
## Deploy on a VPS (Docker Compose + Caddy)
1. Copy `.env.example` to `.env` and set `VERISTATE_DOMAIN` (e.g., `api.yourdomain.com` for automatic Let's Encrypt HTTPS, or `:80` for IP-only HTTP).
2. Optionally set `STRIPE_SECRET_KEY` / `STRIPE_WEBHOOK_SECRET` and `VERISTATE_ALLOW_TEST_BILLING=false` for live Stripe billing.
3. Run the bootstrap script on the VPS:
```bash
bash deploy/vps_setup.sh
```
TDQS
Scored across 7 tools
Each tool targets a clearly distinct resource and action: registration, billing status, checkpoint creation/restoration, verification, and memory read/write. No two tools overlap in a way that would cause misselection.
All tools share the veristate_ prefix, but the remainder mixes conventions: verb_noun (register_agent), noun_verb (checkpoint_create, memory_write), and a standalone noun-like term (balance). The names are still readable, but a consistent create_checkpoint/write_memory style would be clearer.
Seven tools is well-scoped for the domain, with each tool covering a distinct capability needed for agent registration, billing, snapshots, verification, and shared memory. No tool feels redundant or missing from the core set.
Core workflows are covered: agent onboarding, balance checks, checkpoint create/restore, sandboxed verification, and memory read/write. Minor gaps exist, such as listing or deleting checkpoints and deleting or listing memory keys, but agents can work around these limitations.