Back to guides

Vouch + Claude Agent SDK

Give your Claude agent a verifiable identity in 5 minutes.

Prerequisites

terminal
# Install Vouch CLI
curl -fsSL https://vouch.directory/install.sh | bash
# Initialize your identity (links your X account)
vouch init
# Install the Claude Agent SDK
pip install claude-agent-sdk
# Set your API key
export ANTHROPIC_API_KEY="sk-ant-..."

The Agent SDK

The Claude Agent SDK gives your agent built-in tools — including a Bash tool for running shell commands. Call query(), allow the Bash tool, and Claude runs vouch CLI commands autonomously — no manual tool loop needed.

Setup

Configure the Agent SDK with the Bash tool and your preferred model. Reuse this config for every request.

setup.py
from claude_agent_sdk import query, ClaudeAgentOptions
options = ClaudeAgentOptions(
model="claude-sonnet-4-6",
allowed_tools=["Bash"],
permission_mode="bypassPermissions",
)

Sign Outbound Messages

Tell the agent to sign a payload. Claude calls vouch sign --json via the Bash tool and returns the signed envelope.

sign.py
import asyncio
async def main():
async for message in query(
prompt=(
"Sign this JSON payload with the vouch CLI "
"(use vouch sign --json) and return the envelope:\n"
'{"task": "deploy", "id": "cr-42"}'
),
options=options,
):
if hasattr(message, "result"):
print(message.result)
asyncio.run(main())
# Claude runs: echo '{"task":"deploy","id":"cr-42"}' | vouch sign --json
# Returns the signed envelope

Verify Inbound Messages

Pass a signed envelope to the agent. Claude calls vouch verify --json and reports the result.

verify.py
signed_envelope = '{"envelope": {...}, "payload": {"task": "deploy"}}'
async def main():
async for message in query(
prompt=f"Verify this signed message with vouch verify --json and report the signer:\n{signed_envelope}",
options=options,
):
if hasattr(message, "result"):
print(message.result)
asyncio.run(main())
# Claude runs: echo '<envelope>' | vouch verify --json
# Returns: valid=true, x_handle="alice", checked_at="..."

Look Up Identities

Ask the agent to look up an identity by X handle, wallet address, or capability.

lookup.py
async def main():
async for message in query(
prompt="Look up @alice with vouch lookup and show their wallet address.",
options=options,
):
if hasattr(message, "result"):
print(message.result)
asyncio.run(main())
# Claude runs: vouch --json lookup @alice
# Returns identity info: wallet, delegations, agents

Download the Vouch Skill

The vouch-cli skill bundle contains a SKILL.md with every command, flag, and recipe — plus example outputs. Use it with the Agent SDK or include it in your system prompt.

Download vouch-cli.zip
$ curl -fsSL https://vouch.directory/vouch-cli.zip -o vouch-cli.zip

Get Started

$curl -fsSL https://vouch.directory/install.sh | bash