# Agent wallet — Detent

> Let an agent spend money without losing sleep. Set a monthly budget on a slider that clicks into place, ask to approve anything bigger, allow or block merchants, and open any purchase to read why the agent made it.

Canonical: https://detentui.com/components/agent-wallet
Last updated: 2026-11-19

## About

Let an agent spend money without losing sleep. Set a monthly budget on a slider that clicks into place, ask to approve anything bigger, allow or block merchants, and open any purchase to read why the agent made it.

## When to use

- Use it for: Setting and reviewing what an AI agent may spend on its own.
- Don't use it for: A personal wallet or a general expense report.

## Placement

The settings or billing page of an agent product, about 380 wide. Pass the agent’s name and card.

## For agents

Prompt to give a coding agent: "Add Detent's Agent wallet to this project. Fetch https://detentui.com/components/agent-wallet.md and follow its "For agents" steps. It's a Detent Pro piece: if the @detent-pro registry isn't set up here yet, do https://detentui.com/pro-setup.md first."

1. Check package.json: Detent needs React 19 and Tailwind CSS v4. If either is missing or older, stop and tell the user.
2. If the project root has no components.json, run `npx shadcn@latest init --defaults --yes` there.
3. This is a Pro piece. If components.json has no "@detent-pro" registry, or .env.local has no DETENT_PRO_KEY, follow https://detentui.com/pro-setup.md first. If the user has no Pro key, don't install it: tell them it needs Detent Pro and what it would add (this page's About), and only offer a free piece from https://detentui.com/agents.md if one genuinely does the same job.
4. Install it from the project root: `npx shadcn@latest add @detent-pro/agent-wallet`
5. Make sure the root layout (in Next.js, app/layout.tsx) wraps its children once in `<MotionConfig reducedMotion="user">` from motion/react. Add it only if it is not there.
6. Import `AgentWallet` from `@/components/detent/components/agent-wallet/AgentWallet` and render it where the user asked, sized and placed as the Placement section says. Start from the Example below, keep its layout, and swap in the project's real data.
7. If the project has no real data for it yet, put clearly marked placeholders in one content file. Never invent customer quotes, names or numbers and present them as real.
8. Detent pieces are client components. If you pass them functions (format, onChange, render props), do it from a client component; a server page can only pass plain data, so load the data on the server and hand it to a small client wrapper.
9. Use the Detent theme tokens (like bg-surface, text-ink, text-ink-3) for anything you draw around it, and className where the piece takes one. Don't rewrite its motion or internals.
10. Run the project's typecheck (for example `npx tsc --noEmit`; on a fresh Next.js project run `npx next typegen` first, or it can't find types like LayoutProps). If you can run the app, open the page at a desktop and a phone width and check it renders with no console errors.
11. If AGENTS.md or CLAUDE.md has no Detent section yet, add the block from https://detentui.com/agents.md so later tasks pick the right pieces.
12. Tell the user what you added, where, and anything they still need to fill in.

## Details

- Budget clicks into Light, Normal and Heavy; a marker shows what has been spent so far.
- Purchases over your limit wait in Activity with Approve, Decline or Always allow.
- Every purchase opens a receipt with the agent’s own reason, the task and a refund action.
- The tray shows spend against budget and where the month is heading, turning amber when it will run over.

## Install

Part of Detent Pro. The `@detent-pro` registry must be in components.json and `DETENT_PRO_KEY` set in .env.local first: https://detentui.com/pro-setup.md

```bash
npx shadcn add @detent-pro/agent-wallet
```

Needs React 19 and Tailwind CSS v4. The source lands in components/detent; import it from `@/components/detent/components/agent-wallet/AgentWallet`.

## Looks like

![Agent wallet](https://detentui.com/components/agent-wallet/opengraph-image)

This is the example below, rendered. The live, interactive version is at https://detentui.com/components/agent-wallet.

## Example

A working example that typechecks against the installed piece. Keep its layout as a starting point and swap the sample data for the project's real data. Outer wrappers like `size-full` or a dark background come from the demo stage: give the parent a real size, or drop them.

```tsx
'use client'

import { AgentWallet } from '@/components/detent/components/agent-wallet/AgentWallet'

export function AgentWalletExample() {
  return (
    <div className="flex size-full items-center justify-center p-4">
      <AgentWallet />
    </div>
  )
}
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `agent` | `string` | `'Atlas'` | The agent's name. |
| `role` | `string` | `'Research agent'` | What the agent does, under its name. |
| `card` | `string` | `'•• 7731'` | The agent's virtual card, shortened. |

## Keyboard shortcuts

| Keys | Action |
| --- | --- |
| Arrows | Change the budget |
| Esc | Close a receipt |

## Motion and accessibility

- Wrap your root layout once in `<MotionConfig reducedMotion="user">` from motion/react; every Detent piece then respects reduced motion.
- Style it through the Detent theme tokens and `className`, not by editing internals first.

Every Detent piece, with when to use each: https://detentui.com/llms.txt · Agent rules to paste into AGENTS.md: https://detentui.com/agents.md

## Related
- [All components](https://detentui.com/components)
- [Pro](https://detentui.com/pro)
