coinbase / coinbase/agentkit

Would a policy-guarded payment example be useful for AgentKit?

Open
#1,484 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.3k
Forks
815
Avg merge
13h 31m
Merged PRs (30d)
2

Description

AgentKit payment actions can execute transfers and x402 payments, but applications may want an **additional policy layer** evaluated before invoking those actions — budgets, per-transaction caps, merchant allow/block lists, human approval.

I built a small, working example that places [SpendShield](https://github.com/felixpg13-glitch/spendshield) between an agent’s payment decision and AgentKit’s payment action:

```
agent decides to transfer
-> policy authorization (SpendShield)
-> signed one-time grant, verified once
-> AgentKit Action.invoke()
-> WalletProvider executes
```

The example uses only the public AgentKit Python SDK (`WalletActionProvider`, the `WalletProvider` interface, real `Action.invoke`) — **no changes to AgentKit are required**. It runs with one command and no configuration:

https://github.com/felixpg13-glitch/spendshield/tree/main/examples/integration/agentkit

Real results (executions are counted at `WalletProvider.native_transfer`, the true execution point under `Action.invoke`):

| Scenario | Policy decision | native_transfer executions |
|---|---|---|
| $5 to trusted merchant | ALLOW | 1 |
| $50 (over $30 autonomous limit) | APPROVAL → human grants → ALLOW | 1 |
| same grant replayed | REUSED → REFUSED | 0 |
| $500 to blocked address | DENY (merchant blocked) | 0 |

Would an example like this be useful to AgentKit users? If so, is there a preferred example location or integration pattern you would recommend before I prepare a PR?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.