Quickstart
See KryptWarden work in 2 minutes, then run a real agent against your own wallet.
Everything below runs against the hosted Testnet stack. You don't need to clone the repo or deploy anything.
Path A: look around (2 minutes, no wallet)
Open the demo wallet
Go to www.kryptwarden.xyz/dashboard. With no wallet connected, it shows the public demo wallet, CBRS…4NVO, read-only.
Read the ledger
The Spend Ledger page lists every payment the demo agent made or tried to make. Each one shows the decision (Settled or Rejected), the reason, and a link to the transaction on stellar.expert.
Check reconciliation
The Overview page compares what the contract says each agent has spent today with what the indexer recorded. A green match means the off-chain ledger agrees with the chain.
You can't approve holds on the demo wallet, because only its owner can sign. Path B gives you a wallet of your own.
Path B: run an agent on your own wallet (about 15 minutes)
You'll create a wallet, give an agent a 5 USDC daily budget, and run a six-call script that hits every outcome: two auto-payments, one approval hold, one refused seller, one more auto-payment and one blown budget.
You need: a Stellar wallet extension (Freighter, xBull or Lobstr) set to Testnet, and Node.js 20 or newer.
Fund your owner account
- Fund the account with Testnet XLM using Friendbot in Stellar Lab. It pays the fees for your own transactions.
- In your wallet extension, add a trustline for USDC issued by
GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5. - Get Testnet USDC from the Circle faucet (choose Stellar Testnet). 10 USDC is plenty.
Create and fund the smart wallet
Open the dashboard, click Connect wallet (top right), then open Wallet & Kill Switch:
- Click Deploy wallet · 1 signature and sign. The factory deploys a wallet owned by your account and returns its
C…address. - Deposit 10 USDC and sign. The agent spends from this wallet, never from your account.
Create the agent key
On the machine that will run the agent:
mkdir kw-agent && cd kw-agent
npm init -y && npm pkg set type=module
npm install @kryptwarden/sdk
npx @kryptwarden/sdk keygen --out .env.agentkeygen writes a new ed25519 keypair to .env.agent and prints the public key (G…). This key needs 0 XLM. Keep the secret out of git.
Register the agent
In the dashboard, open Register Agent and paste the public key. Keep the defaults:
| Setting | Default |
|---|---|
| Daily budget | 5.00 USDC |
| Auto-approve up to | 1.00 USDC |
| Allowed sellers | search.demo, llm.demo, data.demo |
| Hold timeout | 10 minutes |
Sign the transaction. The policy now lives in the contract.
Run the agent
Add your wallet address to .env.agent:
KW_WALLET_ADDRESS=C...your wallet...
KW_AGENT_SECRET_KEY=S...written by keygen...Save this as agent.mjs:
import { createKryptWarden, KryptWardenPaymentError } from "@kryptwarden/sdk";
const kw = createKryptWarden({
walletAddress: process.env.KW_WALLET_ADDRESS,
agentSecretKey: process.env.KW_AGENT_SECRET_KEY,
network: "stellar:testnet",
onHoldCreated: (h) =>
console.log(` hold #${h.holdId} for ${h.amountUsdc} USDC: approve it in the dashboard`),
});
const api = "https://demo-apis.kryptwarden.xyz/paid";
const json = (body) => ({
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(body),
});
const calls = [
["search 0.05 (auto)", `${api}/search?q=soroban`],
["summary 0.20 (auto)", `${api}/summarize`, json({ topic: "agent spend controls" })],
["dataset 3.00 (hold)", `${api}/dataset/market`],
["scrape 0.10 (unlisted seller)", `${api}/scrape`],
["summary 0.20 (auto)", `${api}/summarize`, json({ topic: "Q4 synthesis" })],
["dataset 2.00 (over budget)", `${api}/dataset/secondary`],
];
for (const [label, url, init] of calls) {
try {
const res = await kw.fetch(url, init);
console.log(`✓ ${label}: HTTP ${res.status}`);
} catch (err) {
if (err instanceof KryptWardenPaymentError) console.log(`✗ ${label}: ${err.code}`);
else throw err;
}
}
console.log(await kw.getSummary());node --env-file=.env.agent agent.mjsWhen the third call prints a hold, open Approvals in the dashboard and approve it. The script carries on by itself.
What you should see
| # | Call | Result | Why |
|---|---|---|---|
| 1 | search, 0.05 | ✓ settled | Under the 1.00 auto-approve limit |
| 2 | summary, 0.20 | ✓ settled | Under the limit |
| 3 | dataset, 3.00 | ✓ settled after approval | Over the limit but within budget, so it became a hold |
| 4 | scrape, 0.10 | ✗ REJECTED_SELLER | scrape.xyz isn't on the allow-list |
| 5 | summary, 0.20 | ✓ settled | Under the limit |
| 6 | dataset, 2.00 | ✗ REJECTED_BUDGET | 3.45 already spent + 2.00 > 5.00 |
The agent spent 3.45 USDC and never needed XLM. Both refusals are recorded on-chain, so they show up in your Spend Ledger next to the payments.
Prefer the repo's script?
The same six steps live in examples/research-agent. From a clone, run pnpm --filter @kryptwarden/research-agent build && node --env-file=.env examples/research-agent/dist/run-demo-day.js.
Next
- How it works: what happened on-chain at each step.
- Handle payment errors in your own agent.
- Spend API: read the same ledger from your code.