# Solvent Publishing Guide

> Source: <https://github.com/ianalloway/solvent-agent>
> Published: 2026-06-18 00:45:49+00:00

**An AI agent that runs as a profitable, self-funding business.**

It sells research briefs. It collects payment on Stripe. It spends its own revenue to provision the compute it needs. And it refuses any job that doesn't clear a margin.

Most agents can spend money. Almost none can **run as a business.**

SOLVENT closes the full loop:

```
  Client pays Stripe → Agent earns revenue → Agent fulfils the work
  → Agent pays its own vendor bills → P&L booked → balance sheet grows
```

Every job is **profit-gated before it starts**. Unprofitable work is declined without touching Stripe. Vendor payments are screened by a NemoClaw-style policy sandbox. The agent literally cannot spend more than it earns.

**Zero dependencies. No API keys. Works right now.**

```
git clone https://github.com/ianalloway/solvent-agent.git
cd solvent-agent
python3 run_demo.py
```

The agent will run a full batch of 4 analyst jobs — complete with margin gating, Stripe payment simulation, NVIDIA Nemotron fulfillment, guardrail screening, and live P&L — in about 30 seconds.

First run: A short onboarding wizard asks you to choose a model, interaction mode, and whether to enable Stripe test mode. Preferences are saved to`.solvent/config.json`

and never committed.

After a run, open the live treasury dashboard:

```
open treasury_dashboard.html   # macOS
```

A typical batch session:

| Metric | Value |
|---|---|
| Revenue | $223.00 |
| Operating spend | $13.35 |
Net profit |
$209.65 |
| Margin | 94% |
| Jobs declined | 1 (below margin floor) |

```
 inbound job
     │
     ▼
 ┌─────────────┐   margin < floor?  ┌───────────┐
 │  MARGIN GATE│ ─────────────────▶ │  DECLINE  │
 │  (pricing)  │                    └───────────┘
 └─────┬───────┘ accept
       ▼
 ┌─────────────┐   EARN
 │   STRIPE    │ ── Payment Link → poll/webhook until paid ──▶ + revenue
 └─────┬───────┘    (records cs_... + pi_... on ledger)
       ▼
 ┌─────────────┐   FULFIL
 │  NEMOTRON   │ ── Llama-3.1-Nemotron-Ultra produces the brief ──▶ resource usage
 └─────┬───────┘
       ▼
 ┌─────────────┐   SPEND (every payment screened first)
 │ GUARDRAILS  │ ── NemoClaw policy: allowlist · caps · reserve · ROI
 │   → STRIPE  │ ── Issuing virtual card (test) or simulated spend ──▶ − expense
 └─────┬───────┘
       ▼
   BOOK P&L  ──▶ treasury updated · dashboard refreshed
```

Revenue is **always collected before cost is incurred**, and no payment can violate policy. The business is safe by construction and profitable by rule.

| Layer | Technology | File |
|---|---|---|
Analyst / reasoning |
NVIDIA Nemotron (Llama-3.1-Nemotron-Ultra) | `solvent/nemotron.py` |
Spend safety |
NVIDIA NemoClaw-style policy sandbox | `solvent/guardrails.py` |
Earn |
Stripe Payment Links + Checkout Session polling | `solvent/stripe_client.py` |
Spend |
Stripe Issuing virtual cards (test mode) | `solvent/stripe_client.py` |
Orchestration |
Hermes / Nous tool-calling agent loop | `solvent/agent.py` |
Memory |
SQLite treasury + pricing ledger | `solvent/treasury.py` · `solvent/pricing.py` |

**Key design choices:**

**Structural profitability**—`pricing.py`

computes unit cost before quoting. If margin < floor, the job never reaches Stripe.**Spend policy**—`guardrails.py`

enforces vendor allowlist, per-transaction cap, rolling 24h budget, minimum cash reserve, and no-negative-ROI rule.**Offline-first**— without API keys the demo runs on deterministic stubs. Add`NVIDIA_API_KEY`

+`STRIPE_API_KEY=sk_test_...`

to unlock live inference and real Payment Links.**Audit trail**— every`cs_...`

checkout session ID and`pi_...`

PaymentIntent ID is recorded on the ledger before fulfilment begins.

```
python3 run_demo.py
```

4 pre-loaded jobs. ~30 seconds. Shows margin gating, Stripe earn/spend, Nemotron fulfillment, and guardrails in action.

```
python3 run_demo.py --interactive
```

Type a research topic and client budget at the prompt. The agent quotes, pays, fulfils, and books P&L for each one in real time. Keep going until you quit.

```
python3 run_demo.py --seed 500        # start with $500 instead of $100
python3 run_demo.py --keep-balance    # resume existing treasury balance
```

In interactive mode, type `/fund 200`

at the prompt to deposit $200 into the live treasury without restarting.

``` python
from solvent.agent import Solvent

agent = Solvent(seed_cents=10_000)          # reset treasury, seed $100
agent.handle_job(SAMPLE_JOBS[0])            # process one job
snap = agent.run(SAMPLE_JOBS[1:])           # process a list; returns snapshot

print(snap["balance_cents"], snap["margin_pct"])
python3 demo_guardrails.py
```

Shows five spend attempts and which ones the NemoClaw-style policy blocks — without starting the agent or touching Stripe.

To use live Nemotron inference and real Stripe test-mode payment links:

```
pip install -r requirements.txt

export NVIDIA_API_KEY=nvapi-...        # from build.nvidia.com
export STRIPE_API_KEY=sk_test_...      # Stripe test mode only (live keys refused)

python3 run_demo.py
```

With both keys set:

- Briefs are written by
**NVIDIA Nemotron**(Llama-3.1-Nemotron-Ultra). - Each job creates a real
**Stripe Payment Link**. Pay with test card`4242 4242 4242 4242`

. - SOLVENT
**polls** the Checkout Session (`cs_...`

) until`payment_status == paid`

before fulfilling — no instant confirm. - Optional: set
`STRIPE_WEBHOOK_SECRET`

and forward`checkout.session.completed`

events via`StripeClient.process_webhook()`

. - Optional: enable
**Stripe Issuing** on your test account to provision capped single-use virtual debit cards for each vendor payment.

| Variable | Purpose |
|---|---|
`NVIDIA_API_KEY` |
Live Nemotron inference (`nvapi-...` ) |
`STRIPE_API_KEY` |
Stripe test key (`sk_test_...` ) |
`STRIPE_WEBHOOK_SECRET` |
Optional webhook verification |
`STRIPE_PAYMENT_POLL_TIMEOUT` |
Seconds to wait for payment (default `120` ) |
`STRIPE_PAYMENT_POLL_INTERVAL` |
Poll interval in seconds (default `2` ) |
`SOLVENT_FORCE_STRIPE_SIMULATE` |
Force offline simulate mode even with a key |

Product/Price objects are cached in `.solvent/stripe_catalog.json`

so repeated runs reuse a single **SOLVENT Research Brief** product instead of cluttering your Stripe dashboard.

```
pip install pytest
python3 -m pytest tests/ -v
```

Unit tests cover: pricing & margin gate · guardrail policy · treasury ledger · Stripe client (simulate + test mode) · config/onboarding.

```
solvent/
  agent.py         the orchestrator (earn → fulfil → spend → book)
  treasury.py      SQLite ledger / balance sheet
  pricing.py       the margin gate
  guardrails.py    NemoClaw-style spend policy
  stripe_client.py two-sided Stripe layer (earn + spend)
  nemotron.py      NVIDIA Nemotron client (+ offline stub)
  service.py       the product: an on-demand research brief
  jobs.py          sample inbound work
  dashboard.py     renders the treasury to HTML + JSON
  config.py        onboarding wizard and config persistence
run_demo.py        the full business loop (CLI entry point)
demo_guardrails.py the safety story (standalone)
tests/             pytest suite
docs/              screenshots and supporting assets
```

**Hermes Agent Accelerated Business Hackathon** — NVIDIA × Stripe × Nous Research

The agent was designed to demonstrate:

- An agent that is
**economically self-aware**— it has a treasury, prices against its own costs, and gates every action on projected profit - A
**complete two-sided Stripe integration**— earns via Payment Links, spends via Issuing virtual cards **Provable spend safety**— a NemoClaw-style policy sandbox that makes "give an agent a payment credential" a reasonable thing to do** Live inference with NVIDIA Nemotron**— the offline stub means the demo always works, even without API keys

Issues, PRs, and ideas are very welcome. Some good starting points:

- Add more sample research topics in
`solvent/jobs.py`

- Improve the Nemotron prompt template in
`solvent/service.py`

- Add a new guardrail policy to
`solvent/guardrails.py`

- Extend the dashboard with charts or new metrics in
`solvent/dashboard.py`

**If SOLVENT gave you ideas, give it a ⭐**
