Real flows, real code

How agents pay agents

Every use case below is a working pattern. The flow diagrams show what happens step by step. The code samples are copy-paste ready. Pick the one closest to what you are building and wire it up.

Orchestration01 / 06

Multi-agent workflows

One job. Four agents. Paid in parallel.

An orchestrator agent receives a task, fans out to specialist agents, and pays each one based on the work done. The whole cycle completes in milliseconds because txn.dev settles transfers inline with the workflow. No payment step, no blocking, no batching.

~4msper transfer
$0.002per word
4parallel agents

How it flows

1

Client submits document (1,360 words, 4 languages)

2

Orchestrator fans out to 4 translation agents

3

Each agent translates and charges per word

4

4 transfers settle in parallel via txn.dev (~4ms each)

5

Orchestrator returns combined result to client

orchestration.ts
// Orchestrator pays specialist agents in parallel
const tasks = [
{ agent: "wallet_en_fr", words: 340, rate: 0.002 },
{ agent: "wallet_en_de", words: 340, rate: 0.002 },
{ agent: "wallet_en_es", words: 340, rate: 0.002 },
{ agent: "wallet_en_ja", words: 340, rate: 0.003 },
]
const payments = await Promise.all(
tasks.map(t => txn.transfers.create({
from: "wallet_orchestrator",
to: t.agent,
amount: t.words * t.rate,
memo: `translated ${t.words} words`
}))
)
// All 4 settled in ~16ms total

Transfer flow

Client
1,360 words
submit
Orchestrator
wallet_orch
$0.68 en>fr
FR agent
$0.68 en>de
DE agent
$0.68 en>es
ES agent
$1.02 en>ja
JA agent
Marketplace02 / 06

AI agent marketplaces

200 agents. Zero checkout flows.

A marketplace lists specialist agents that offer services to humans or other agents. When a consumer selects an agent, payment happens inline through txn.dev. No redirect, no checkout page, no invoice. The marketplace takes a platform fee on every transaction automatically.

0%checkout friction
200+agents listed
10%platform fee

How it flows

1

Consumer selects a code review agent from the marketplace

2

Marketplace calls txn.dev to split payment (agent + platform fee)

3

Transfer settles in ~4ms, agent receives funds

4

Agent executes the code review task

5

Result returned to consumer, full audit trail in the ledger

marketplace.ts
// Marketplace handles payment inline with service call
const result = await marketplace.dispatch({
consumer: "wallet_user_42",
agent: "wallet_code_reviewer",
task: { type: "pr_review", repo: "acme/api" },
})
// Under the hood:
// 1. Consumer wallet debited $0.15
// 2. Platform fee wallet credited $0.015 (10%)
// 3. Agent wallet credited $0.135
// 4. Agent executes task and returns result
// Total time: 247ms (4ms payment + 243ms task)

Transfer flow

Consumer
wallet_user_42
$0.15pay
Marketplace
split logic
$0.13590%
Agent
wallet_reviewer
$0.01510% fee
Platform
wallet_platform
Research03 / 06

Autonomous research agents

Budget-constrained spending. Full audit trail.

Give a research agent a funded wallet and a budget. It pays for premium data sources, other agents' analysis, and API calls as it works. Every transaction is logged. If it hits the budget ceiling, it stops. You see exactly where the money went.

$5.00budget
$0.17total spent
3agents paid

How it flows

1

Create a session wallet with a $5 budget

2

Research agent pays $0.10 for financial data API

3

Pays $0.05 for a summarisation agent to condense results

4

Pays $0.02 for a fact-checking agent to verify claims

5

Budget tracking via wallet balance, full ledger history

research.ts
// Research agent with budget constraints
const wallet = await txn.wallets.create({
name: "research-agent-session-42",
metadata: { budget: 5.00, spent: 0 }
})
await txn.funding.create({
wallet: wallet.id,
amount: 5.00,
source: "stripe"
})
// Agent autonomously pays for data as it researches
await txn.transfers.create({
from: wallet.id,
to: "wallet_financial_data_api",
amount: 0.10,
memo: "AAPL quarterly revenue 2024-2025"
})
// Check remaining budget anytime
const balance = await txn.wallets.getBalance(wallet.id)
// balance.available -> 4.90

Transfer flow

Funding
Stripe
$5.00fund
Research Agent
budget: $5
$0.10
Data API
$0.05
Summariser
$0.02
Fact check
Remaining: $4.83
Content04 / 06

Content generation pipelines

Five stages. $0.16 total. Settled before the page loads.

Content workflows where agents form a pipeline. Each stage does its work and gets paid for it. The money flows as fast as the data. Every agent in the chain has a clear price, and the total cost is transparent and auditable.

$0.16total pipeline
5stages
~20mstotal settlement

How it flows

1

Pipeline owner triggers content generation for a topic

2

Writer agent drafts the article ($0.05)

3

Editor agent refines language and structure ($0.02)

4

Image generation agent creates illustrations ($0.08)

5

SEO agent optimises metadata and structure ($0.01)

content.ts
// Content pipeline with per-stage payments
const pipeline = [
{ agent: "wallet_writer", amount: 0.05, task: "draft" },
{ agent: "wallet_editor", amount: 0.02, task: "refine" },
{ agent: "wallet_image_gen", amount: 0.08, task: "illustrate" },
{ agent: "wallet_seo", amount: 0.01, task: "optimise" },
]
let content = { topic: "AI agent payments" }
for (const stage of pipeline) {
// Pay the agent, then pass the content forward
await txn.transfers.create({
from: "wallet_pipeline_owner",
to: stage.agent,
amount: stage.amount,
memo: `${stage.task}: ${content.topic}`
})
content = await agents[stage.task].run(content)
}
// Total: $0.16 across 4 agents

Transfer flow

Owner
trigger
$0.05
Writer
$0.02
Editor
$0.08
Image Gen
$0.01
SEO
IoT05 / 06

IoT and edge agents

100,000 transactions per hour. All sub-cent.

Lightweight agents on edge devices making high-frequency, low-value transactions. A sensor agent pays a processing agent for inference. A logistics agent pays a routing agent for path optimisation. The transaction volume and size make traditional payment rails impossible. txn.dev handles it natively.

100Ktxn/hour
$0.001per transaction
1,000edge devices

How it flows

1

1,000 sensor agents deployed across edge devices

2

Each sensor generates readings and needs inference

3

Sensor agent pays inference cluster $0.001 per reading

4

100 readings per hour per device = 100,000 transactions/hour

5

All settled in real time, full audit trail per device

iot.ts
// Edge device agent making high-frequency micropayments
const sensorAgent = await txn.wallets.create({
name: "sensor-node-417",
metadata: { fleet: "warehouse-east", type: "temperature" }
})
// Each reading triggers a micropayment for inference
async function onReading(data: SensorData) {
const transfer = await txn.transfers.create({
from: sensorAgent.id,
to: "wallet_inference_cluster",
amount: 0.001,
memo: `inference: ${data.type} @ ${data.timestamp}`
})
// transfer.settled_at is ~4ms after creation
return await inferenceCluster.process(data)
}
// 100 readings/hour * 1,000 devices = 100,000 txn/hour

Transfer flow

x1,000 devices
Sensor 1
node-117
$0.001
Sensor 2
node-217
$0.001
Sensor 3
node-317
$0.001
...
Inference Cluster
wallet_inference
100K transactions/hour
DevTools06 / 06

Developer tool agents

Every push triggers a payment chain.

Agents embedded in your CI/CD pipeline. On every push, a security scanner runs, a license checker verifies dependencies, a performance benchmark profiles critical paths. Each tool is an independent agent with its own pricing. The project wallet pays them all automatically.

$0.06per push
3tool agents
<50mspayment overhead

How it flows

1

Developer pushes code to the repository

2

CI hook triggers 3 tool agents in parallel

3

Security scanner ($0.03), license checker ($0.01), perf benchmark ($0.02)

4

All transfers settle in ~4ms each, agents execute concurrently

5

Results posted back to the PR, project wallet debited $0.06 total

devtools.ts
// CI pipeline pays tool agents on every push
async function onPush(event: PushEvent) {
const projectWallet = "wallet_project_acme_api"
const checks = await Promise.all([
// Security scan
txn.transfers.create({
from: projectWallet,
to: "wallet_security_scanner",
amount: 0.03,
memo: `security scan: ${event.sha.slice(0, 7)}`
}).then(() => scanAgent.run(event.repo, event.sha)),
// License check
txn.transfers.create({
from: projectWallet,
to: "wallet_license_checker",
amount: 0.01,
memo: `license check: ${event.sha.slice(0, 7)}`
}).then(() => licenseAgent.run(event.repo)),
// Performance benchmark
txn.transfers.create({
from: projectWallet,
to: "wallet_perf_benchmark",
amount: 0.02,
memo: `perf bench: ${event.sha.slice(0, 7)}`
}).then(() => perfAgent.run(event.repo, event.sha)),
])
return checks // All 3 paid + executed in parallel
}

Transfer flow

git push
a3f7c2e
CI hook
Project Wallet
wallet_project
$0.03
Security
$0.01
License
$0.02
Perf
Total: $0.06 per push
Ledger feed
All use cases, single ledger
FromToAmountMemoSettled
wallet_orchwallet_en_fr$0.680translated 340 words en>fr2ms
wallet_orchwallet_en_de$0.680translated 340 words en>de3ms
wallet_user_42wallet_reviewer$0.150pr review: acme/api#8474ms
wallet_researchwallet_data_api$0.100AAPL quarterly revenue2ms
wallet_pipelinewallet_writer$0.050draft: AI agent payments3ms
wallet_sensorwallet_inference$0.001inference: temp @ 14:02:334ms
wallet_ciwallet_scanner$0.030security scan: a3f7c2e2ms
wallet_orchwallet_en_es$0.680translated 340 words en>es3ms

Build your flow in minutes

Create wallets, wire up transfers, and start settling payments between your agents. The SDK handles the rest.