Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions content/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ navigation:
path: tutorials/build-with-ai/alchemy-agent-skills.mdx
- page: Alchemy CLI
path: tutorials/build-with-ai/alchemy-cli.mdx
- page: Agent Wallets
path: tutorials/build-with-ai/agent-wallets.mdx
- page: Alchemy MCP Server
path: tutorials/build-with-ai/alchemy-mcp-server.mdx
- page: Agent Authentication and Payment
Expand Down
89 changes: 89 additions & 0 deletions content/tutorials/build-with-ai/agent-wallets.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
title: Agent Wallets
description: Set up Agent Wallets so AI agents can run wallet-signed Alchemy CLI actions without exposing private keys.
subtitle: Set up Agent Wallets so AI agents can run wallet-signed Alchemy CLI actions without exposing private keys.
slug: docs/agent-wallets
---

Agent Wallets are embedded wallets for agents that you manage in the Alchemy Dashboard. They let an AI agent use the [Alchemy CLI](docs/alchemy-cli) to execute wallet-signed EVM actions while the wallet private key stays out of the CLI.

Use Agent Wallets when you want an agent to send tokens, execute swaps, manage allowances, call contracts, or bridge tokens from a CLI session that you can review and revoke in the [Alchemy Dashboard](https://dashboard.alchemy.com/products/agent-wallet/evm-wallet).

<Note>
In the CLI, `session` means an Agent Wallet session approved through the Alchemy Dashboard. It is not a generic browser wallet connection. Solana transaction commands currently use a local Solana wallet.
</Note>

## What are Agent Wallets?

Agent Wallets give agents a controlled signing surface:

* You create and manage the wallet in the Alchemy Dashboard.
* The CLI gets access through a browser-approved Agent Wallet session.
* Private keys are never exposed to or stored by the CLI.
* Access is scoped and revocable from the Alchemy Dashboard.
* The Alchemy Dashboard remains the source of truth for wallets, sessions, and revocation.

## How it works

1. Create or select an EVM Agent Wallet in the [Alchemy Dashboard](https://dashboard.alchemy.com/products/agent-wallet/evm-wallet).
2. Install and authenticate the Alchemy CLI.
3. Run `alchemy wallet connect`.
4. Approve the CLI session in the browser and dashboard flow.
5. Run wallet-signed actions from the CLI.
6. Revoke CLI sessions from the Alchemy Dashboard when access is no longer needed.

The approved session lets the CLI request signatures for supported EVM actions, but it does not expose the wallet private key to the terminal, your shell environment, or the agent.

## Set up the CLI session

```bash
npm i -g @alchemy/cli@latest
alchemy auth
alchemy wallet connect
alchemy wallet use session
```

`alchemy wallet connect` starts the browser approval flow. Use `alchemy wallet use session` to select your Agent Wallet session signer for EVM transactions.

## Run wallet-signed actions

After approval, use the same CLI command surface for signed actions:

```bash
alchemy evm send <recipient> 0.01 -n base-mainnet
alchemy evm swap quote --from 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE --to <token> --amount 0.01 -n base-mainnet
alchemy xchain bridge quote --from <token> --to <token> --amount 1 --to-network <network> -n <source-network>
alchemy evm status <call-id-or-tx-hash>
```

Quote commands do not submit transactions. Use the corresponding execute command when you are ready to submit a swap or bridge with your Agent Wallet session signer.

For the full command surface, see [Alchemy CLI wallets and signing](docs/alchemy-cli#wallets-and-signing).

## Manage sessions and revocation

`alchemy wallet connect` creates a CLI session for your Agent Wallet. You can check or clear the session from the CLI:

```bash
alchemy wallet status --verify
alchemy wallet disconnect
```

You can also view and revoke sessions in the [Agent Wallets dashboard](https://dashboard.alchemy.com/products/agent-wallet/evm-wallet). Revoking a session prevents future CLI signing for that session.

## Use Agent Wallets with automation

For agents and scripts, combine CLI commands with `--json --no-interactive` so output is structured and commands do not wait for prompts:

```bash
alchemy --json --no-interactive evm data balance vitalik.eth
```

Approve the Agent Wallet session before running non-interactive wallet-signed commands. For signed EVM actions, use the active `session` signer or pass `--signer session`.

## Next steps

* [Alchemy CLI](docs/alchemy-cli)
* [Alchemy Dashboard Agent Wallets](https://dashboard.alchemy.com/products/agent-wallet/evm-wallet)
* [Agent Skills](docs/alchemy-agent-skills)
* [Alchemy MCP Server](docs/alchemy-mcp-server)
19 changes: 12 additions & 7 deletions content/tutorials/build-with-ai/alchemy-cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ slug: docs/alchemy-cli
The Alchemy CLI wraps Alchemy's node, Data API, wallet, transaction, webhook, and account management surfaces. Use it to:

* Live query onchain data without writing a script
* Send transactions with a session wallet or local wallet
* Send EVM transactions with an [Agent Wallet session](docs/agent-wallets) or local wallet
* Run admin tasks like creating apps, rotating allowlists, and managing webhooks
* Automate workflows in shell scripts, cron jobs, and CI pipelines

Expand Down Expand Up @@ -161,6 +161,8 @@ All four accept an optional `--block-tag` (defaults to `latest`).

Wallet-signed EVM actions return a smart wallet call ID and, once confirmed, a transaction hash. Use `alchemy evm status <id-or-hash>` to check either value.

To use the `session` signer, connect an [Agent Wallet session](docs/agent-wallets) approved through the Alchemy Dashboard.

```bash
alchemy wallet connect
alchemy wallet use session
Expand All @@ -182,22 +184,24 @@ Use `--gas-sponsored` and `--gas-policy-id <id>` on supported EVM actions to req

Use `0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE` as the native token address for swap and bridge commands.

Most wallet-signed EVM commands accept `--signer session|local` to override the active signer for that invocation. If both session and local EVM wallets are configured and you have not chosen one, the CLI defaults to the session wallet and prints a warning with the command to switch.
Most wallet-signed EVM commands accept `--signer session|local` to override the active signer for that invocation. In this flag, `session` refers to your Agent Wallet session signer. If both an Agent Wallet session and local EVM wallet are configured and you have not chosen one, the CLI defaults to the Agent Wallet session and prints a warning with the command to switch.

### Wallets and signing

Use `alchemy wallet` to connect the signer used by onchain actions. EVM commands can use a browser-approved session wallet or a local private key. Solana transaction commands currently use a local Solana wallet.
Use `alchemy wallet` to connect the signer used by onchain actions. EVM commands can use an [Agent Wallet session](docs/agent-wallets) approved through the Alchemy Dashboard or a local private key. The `session` signer refers to an Agent Wallet session, not an arbitrary browser wallet connection. Solana transaction commands currently use a local Solana wallet.

Create, view, and revoke Agent Wallet sessions in the [Agent Wallets dashboard](https://dashboard.alchemy.com/products/agent-wallet/evm-wallet).

| Command | Description |
|---|---|
| `alchemy wallet connect` | Connect a wallet. Use `--mode session` or `--mode local`. Local mode supports `--chain evm\|solana\|both` and defaults to both. |
| `alchemy wallet connect` | Connect a wallet. Use `--mode session` for an Agent Wallet session or `--mode local` for a local wallet. Local mode supports `--chain evm\|solana\|both` and defaults to both. |
| `alchemy wallet connect --mode local --chain evm --import <path>` | Import a local EVM private key file |
| `alchemy wallet connect --mode local --chain solana` | Create or configure a local Solana wallet |
| `alchemy wallet status` | Show session, local EVM, local Solana, and active signer status. Add `--verify` to check the backend session. |
| `alchemy wallet status` | Show Agent Wallet session, local EVM, local Solana, and active signer status. Add `--verify` to check the backend session. |
| `alchemy wallet address` | Display configured wallet addresses |
| `alchemy wallet qr` | Display an EVM or Solana wallet address as a QR code |
| `alchemy wallet use <session\|local>` | Set the active signer for EVM transactions |
| `alchemy wallet disconnect` | Revoke the current wallet session and clear it locally |
| `alchemy wallet use <session\|local>` | Set the active signer for EVM transactions. Use `session` to select your Agent Wallet session signer. |
| `alchemy wallet disconnect` | Revoke the current Agent Wallet session and clear it locally |

### Solana

Expand Down Expand Up @@ -358,6 +362,7 @@ alchemy completions fish > ~/.config/fish/completions/alchemy.fish
## Next steps

* [Agent Skills](docs/alchemy-agent-skills)
* [Agent Wallets](docs/agent-wallets)
* [Alchemy MCP Server](docs/alchemy-mcp-server)
* [Agent Authentication and Payment](docs/alchemy-for-agents)
* [Alchemy Dashboard](https://dashboard.alchemy.com/)
Loading