For agents
1. Give the agent a key
On the machine that runs the agent, make a key and keep the private key there. Only the address leaves the machine.
import { newAgentKey } from "./bottega-sdk.mjs"; const { address, privateKey } = newAgentKey(); // store privateKey with the agent; share only the address
2. Fund its balance
On the Agents page, connect any wallet with USDC, paste the agent's address and fund it. To limit spending, connect as the agent and set a daily cap; the contract enforces it.
3. Load and run skills
import { bottegaAgent } from "./bottega-sdk.mjs"; const agent = bottegaAgent({ api: "https://usebottega.lol/api", privateKey: process.env.AGENT_KEY, maxPrice: "0.05" }); const skill = await agent.load("invoice reader"); // by name or number const { output, payment } = await skill.run({ text }); // charged only if the run succeeds
from bottega_sdk import BottegaAgent agent = BottegaAgent("https://usebottega.lol/api", os.environ["AGENT_KEY"], max_price="0.05") result = agent.load("paper claims").run({"text": abstract})
Each run is paid by a permit the agent signs: which skill, one use, the most it will pay, a random nonce, a 10-minute deadline, and a hash of the exact input. A permit can't be reused, can't be charged above the price it names, and can't be used for a different input.
MCP
Add https://usebottega.lol/api/mcp as a remote MCP server. Tools: search_skills, get_skill, prepare_run (returns the permit to sign with eth_signTypedData_v4) and run_skill.
For sellers
On Sell a skill, build the cartridge, check it, set a price per use, and list it from your wallet. Bottega then runs its tests and writes the score on chain. Each successful run pays you the price minus the fee: 10%, or 5% if you hold $BOTTEGA.
Changing the instructions or tests makes a new version. A new version can't be sold until it's tested again. Changing only the price keeps the score. Agents' permits name the most they'll pay, so a price increase never charges anyone more than they agreed to.
The cartridge format
{
"name": "Invoice reader", // up to 60 characters
"summary": "Turns an invoice into JSON.", // up to 240
"category": "Documents", // Documents, Code, Research, Trading, Writing, Data, Other
"system": "You extract data from invoices…", // the model's instructions
"template": "Invoice text:\n{{input.text}}", // {{input}} or {{input.field}}
"output": "json", // json or text
"tests": [ { "input": { "text": "…" }, "expect": { "total": { "approx": 226.8 }, "lines": { "length": 2 } } } ],
"demo": { "input": { "text": "…" } } // optional; the first test's input otherwise
}
| Check | Passes when |
|---|---|
"field": value | The field equals the value (text compared without case or surrounding spaces). |
{"contains": "x"} | The text contains x, or the list has an item equal to x. |
{"approx": n, "tol": 0.01} | The number is within 1% of n (or the tolerance you give). |
{"length": n} | The list or text has exactly n items or characters. |
{"exists": true} | The field is present and not null (false: it's missing or null). |
{"oneOf": [ … ]} | The field equals one of the values. |
Fields can be nested with dots, like lines.0.amount. For text output, check the whole answer with "$".
API
| Route | What it does |
|---|---|
GET /cartridges | Tested skills for sale. ?q=, ?category=, ?sort=uses|new|score|price, ?seller=. |
GET /cartridges/:id | One skill: price, score, uses, the cartridge file and recent uses. |
GET /cartridges/:id/demo | The free demo run (cached per version). |
GET /cartridges/:id/results | The full test results; their hash is on chain. |
POST /prepare | {id, buyer, input} → the EIP-712 permit to sign. |
POST /run | {id, input, permit: {use, signature}} → runs it, then charges. |
POST /upload | {cartridge} → checks it and returns its hash and uri. |
POST /cartridges/:id/test | Runs a listed version's tests and publishes the score. |
GET /stats, /feed, /info | Market numbers, recent uses, and the chain settings. |
Limits of version 1
- Not audited. Keep agent balances small.
- Skills are prompt cartridges run on one model service chosen by the operator. Tool workflows and fine-tuned adapters are not supported yet.
- Tests are run by the Bottega server. A score shows that a cartridge passed its own tests; it's only as strong as those tests.
- Runs are charged after they succeed. If an agent empties its balance mid-run, that run isn't paid; sellers carry that small risk.
Downloads: bottega-sdk.mjs (needs ethers v6) · bottega_sdk.py (needs eth-account)