How an Agent Gets Permission to Spend: Smart Account, Permission, Session Key, Execute, Revoke
Last updated 2026-09-08
An agent should never hold the owner's private key. The pattern that avoids it: the owner controls a smart account (ERC-4337 or ERC-7702), grants the agent a scoped permission (what, how much, until when), the agent signs with its own session key inside that scope, the account executes, and the owner can revoke at any time. Each step maps to a directory listing.
Key takeaways
- ▸The owner keeps the root key. The agent gets a permission and a session key, both scoped and both revocable.
- ▸Smart accounts (ERC-4337 today, ERC-7702 for EOAs) are what make a permission enforceable on-chain rather than by convention.
- ▸ERC-7715 is the request format for a permission; ERC-7710 is the delegation an account can honour. Not every wallet implements them yet.
- ▸Revocation is the step people skip. If you cannot revoke, you have not scoped anything.
Builders keep asking the same question in different words: *how do I let my agent trade, pay, or rebalance without giving it my key?* The answer is a five-step flow, and every step is a thing you can install today. This page walks it once, names the standard behind each step, and points at the listed tools that implement it. It does not tell you the flow is safe — it tells you where the limits are set and who can undo them.
Why It Matters
An agent with a raw private key has the owner's full authority forever, and every prompt injection, bug or model error is a potential total loss. A scoped permission turns that into a bounded loss: this token, this much, this venue, until this date. The difference is not a feature; it is the line between a demo and something you would run with real funds. It is also what auditors, counterparties and the agent's own operator can inspect on-chain.
How It Works
- ▸1. Smart account. The owner's funds sit in a smart account, not an EOA. ERC-4337 accounts (ZeroDev Kernel, Safe, Coinbase Smart Wallet) can run arbitrary validation logic; ERC-7702 lets an existing EOA delegate to account code. Either way the account, not a human, will check the agent's signatures.
- ▸2. Permission. The agent (or its app) requests a permission from the owner's wallet: which token, a spend cap, an allowed target or method set, an expiry. ERC-7715 defines the request (`wallet_grantPermissions`); the owner approves it once in their wallet UI. The permission is data the account can verify, not a promise.
- ▸3. Session key. The permission is bound to a key the agent controls — a fresh keypair generated for this job, held by the agent's runtime or a key-management service (Turnkey, Privy, Coinbase Agentic Wallets). The owner's key never leaves the owner.
- ▸4. Execute. The agent signs a user operation with the session key. The account's validator checks the signature against the permission: right key, right target, under the cap, before expiry. Anything outside the scope reverts on-chain, whatever the agent intended. ERC-7710 is the delegation framework several accounts use to express and enforce this.
- ▸5. Revoke. The owner revokes the permission (or lets it expire). From that block the session key signs nothing that executes. Rotate the session key on a schedule regardless, because a key that exists can leak.
Key Components
- •A smart account with a pluggable validator (ERC-4337) or a delegated EOA (ERC-7702)
- •A permission request and grant (ERC-7715) the owner approves once
- •A delegation the account can enforce (ERC-7710 or the account's own module system)
- •A session key the agent holds, ideally generated and stored by a key-management service
- •A bundler and paymaster so the agent's user operations get included and, optionally, gas-sponsored
- •A revocation path the owner can trigger without the agent's cooperation
Which listed tools cover which step
Account: ZeroDev (Kernel) and the Safe tooling give you ERC-4337 accounts with session-key modules; Coinbase Agentic Wallets and MetaMask's agent wallet bundle the account with the key handling. Permission and delegation: the MetaMask Delegation Framework implements ERC-7710-style delegations with caveats (spend limits, allowed targets, expiry). Session key custody: Turnkey and Privy generate and hold keys behind policies so the agent process never sees raw key material. Execution: Coinbase AgentKit and the framework SDKs wrap the user-operation path; 0xGasless AgentKit adds sponsored gas. The directory entries linked below carry each tool's Sato Score, liveness and whether we reproduced its install.
Where the flow breaks in practice
Three failure modes come up repeatedly in builder reports. First, permission scope that is too wide — a cap on one token but no target restriction, so a compromised agent can still route funds anywhere. Second, no expiry — a permission granted in a demo that is still live months later. Third, revocation that depends on the agent — if the only way to stop the agent is to ask the agent to stop, the owner has no control. Set all three at grant time; the account will enforce them, but only if they are there.
ERC-7702 changes the first step, not the others
ERC-7702 lets an ordinary EOA temporarily point at account code, so an owner can get smart-account behaviour without moving funds. It removes the migration cost of step one. Steps two to five are unchanged: the permission, the session key, the enforced execution and the revocation all still happen in the account code the EOA now delegates to.
What the owner should be able to see
Every grant, every execution and every revocation is a transaction or a signed object the owner can inspect. A good setup shows the owner the current permissions, the agent's session-key address, the spend so far against each cap, and a one-click revoke. If a tool cannot show those four things, the scope exists only in its documentation.
Examples
- ▸A rebalancing agent granted USDC-only, 500 per day, to one DEX router, expiring in 30 days, signing with a Turnkey-held session key from a ZeroDev Kernel account.
- ▸A payments agent with a permission that allows transfers only to a list of vendor addresses, revoked by the owner when the vendor contract changes.
- ▸A research agent with a zero-spend permission (read-only calls) so it can query contracts but never move funds.
- ▸A trading agent whose session key is rotated weekly by the operator's runtime, with the previous key's permission revoked in the same transaction.
Risks & Limitations
- ⚠A permission without a target restriction still lets a compromised agent send funds to any address under the cap.
- ⚠Session keys stored in the agent's process memory or environment are as exposed as the process; a key-management service moves the key out of the blast radius but adds a dependency.
- ⚠Bundler or paymaster outages can strand an agent mid-task; the agent needs a plan for a user operation that never lands.
- ⚠Not every wallet implements ERC-7715 yet; the request may fall back to a full-approval prompt, which is the thing this flow exists to avoid.
Frequently Asked Questions
- Can I do this with a normal EOA wallet?
Not with an EOA alone: an EOA has one key and no logic to check a permission. Either move funds to a smart account or use ERC-7702 to delegate the EOA to account code, after which the rest of the flow applies.
- Is a session key the same as an API key?
No. An API key authorises calls to a service; a session key signs on-chain operations that the account then checks against a permission. If the service is compromised, an API key is the whole story; a session key is still bounded by the on-chain scope.
- Who pays gas for the agent's operations?
Either the account (from its own balance) or a paymaster that sponsors the user operation. Sponsorship is a product choice; the permission scope should cover it either way so a sponsor cannot widen what the agent can do.
- How do I know the tools listed here actually work?
Each linked listing shows its Sato Score, the share of our daily checks it answered, and whether we reproduced its documented install in a container. That is evidence the tool is maintained and installable; it says nothing about whether your permission scope is right.
- What happens to in-flight operations when I revoke?
A user operation signed before revocation but included after it will fail validation at inclusion time, because the account checks the permission when it executes, not when the agent signed.
Sources
Related Resources
MetaMask Delegation Framework
ActiveMetaMask's official smart-account delegation contracts — grant an AI agent scoped, revocable permissions instead of a private key.
ZeroDev
ActiveERC-4337 smart-account SDK (Kernel) with session keys, gas sponsorship, and batched transactions for agent wallets.
Coinbase Agentic Wallets
ActiveCoinbase Developer Platform wallet infrastructure built for AI agents, with spend caps, gasless Base settlement, and native x402.
Turnkey
ActiveSecure key management infrastructure with policy controls, commonly used for agent wallets.
Privy
ActiveEmbedded and server wallet infrastructure used to give agents secure key management.
Safe Wallet MCP (safer)
EarlyCLI and MCP client for querying Safe{Wallet} multisig transactions and owner/threshold details.
0xGasless AgentKit
EarlyToolkit giving AI agents gasless access to crypto wallets and onchain functionality.
Related Wiki Pages
Cite this page
Sato Hub. "How an Agent Gets Permission to Spend: Smart Account, Permission, Session Key, Execute, Revoke." Sato Hub, updated 2026-09-08, accessed 2026-09-08. https://satohub.ai/wiki/agent-spending-permissions-session-keysThis page is refreshed daily. Citations include the date so a reader can tell which snapshot a claim came from.
Join the Sato Hub Briefing
One email a week — the agents, tools, and infrastructure that actually shipped, and why they matter.