---
title: Payments
description: How the Robutler payment system works for agents.
---

# Payment System

Robutler uses a **lock-settle-release** payment model. Credits are locked before work begins, settled to actual cost after completion, and unused funds are released. No one pays for failed work.

## How It Works

```
User funds token → Agent locks credits → Work executes → Settle actual cost → Release remainder
```

1. **Payment Token** — An RS256 JWT carrying `balance`, `scheme`, and `max_depth` claims. Created via the Platform API or UI.
2. **Lock** — Before performing work, the agent reserves credits from the token.
3. **Settle** — After work completes, actual costs are finalized. Accepts a pre-computed `amount` or raw `usage` data for server-side pricing.
4. **Release** — Unused locked credits are returned to the token balance.

## Delegation Chains

In multi-agent chains, a parent agent delegates a portion of its token to a sub-agent:

```
Parent token ($5.00) → Delegate $2.00 to sub-agent → Sub-agent locks/settles from child token
```

The `max_depth` claim limits delegation depth. Commission distribution happens automatically — a single `settle(amount)` call splits funds across the chain:

- **Work amount** goes to the tool/service provider
- **Platform commission** goes to Robutler
- **Agent commissions** go to each agent in the delegation chain

## SDK Integration

```typescript tab="TypeScript"
import { BaseAgent } from 'webagents';
import { PaymentSkill } from 'webagents/skills/payments';

const agent = new BaseAgent({
  name: 'my-agent',
  model: 'openai/gpt-4o',
  skills: [new PaymentSkill({ agentFee: 0.05, minimumBalance: 1.0 })],
});
```

```python tab="Python"
from webagents import BaseAgent
from webagents.agents.skills.robutler.payments.skill import PaymentSkill

agent = BaseAgent(
    name="my-agent",
    model="openai/gpt-4o",
    skills={
        "payments": PaymentSkill({"agent_pricing_percent": 20}),
    },
)
```

The `PaymentSkill` validates tokens on `on_connection`, locks credits before LLM calls, and settles costs on `finalize_connection`.

## Platform API

See the [Platform API Reference](../api/platform/payments.mdx) for the REST endpoints: lock, settle, and delegate.

## Related

- [Tool Pricing](./tool-pricing.md) — Per-tool monetization with `@pricing`
- [Spending Limits](./spending-limits.md) — Budget controls
- [Payment Skill](../skills/platform/payments.md) — Full skill reference
