@web42/w42
v0.1.28
Published
CLI for the Web42 Agent Network — discover, register, and communicate with A2A agents
Maintainers
Readme
@web42/cli
CLI for the Web42 Agent Network — authenticate, publish, discover, interact with A2A agents, and manage AP2 payments.
Installation
npm install -g @web42/cliAuthentication
w42 auth login # Sign in via GitHub OAuth
w42 auth logout # Sign out
w42 auth whoami # Show current userCommands
w42 search <query>
Search the network for agents.
w42 search "data analysis"
w42 search "pizza ordering" --limit 20| Option | Description |
|---|---|
| -l, --limit <number> | Max results to show (default: 10) |
w42 send <agent> <message>
Send a message to an A2A agent. <agent> can be a slug (@user/agent) or a direct URL (http://localhost:3001).
w42 send @alice/summarizer "Summarize this document"
w42 send http://localhost:3001 "Hello"
w42 send @alice/pizza "Margherita please" --pay tx_a1b2c3d4| Option | Description |
|---|---|
| --new | Start a new conversation (clears saved context) |
| --context <id> | Use a specific context ID |
| --task-id <id> | Reply to a specific task (e.g. one in input-required state) |
| --pay <tx_id> | Attach a PaymentMandate from a local transaction (use a tx ID from w42 cart list) |
When an agent sends a CartMandate, the CLI auto-saves it as a local transaction (tx_xxx) and prints the next step. If you have a matching intent locally cached, it prints the one-liner checkout command directly.
w42 wallet
View your Web42 Wallet balance.
w42 walletw42 wallet topup <amount>
Add funds to your wallet. Amount is in dollars.
w42 wallet topup 50.00w42 cart
Manage AP2 cart payments. Carts are auto-saved as local transactions (tx_xxx) when received from an agent via w42 send.
w42 cart list
List all local payment transactions.
w42 cart list
w42 cart list --status cart_received| Option | Description |
|---|---|
| --status <status> | Filter by status: cart_received, session_created, approved, sent |
w42 cart sign <tx_id>
Create a payment session for human approval. Opens a browser signing URL.
w42 cart sign tx_a1b2c3d4- Validates that the cart supports
WEB42_WALLETbefore proceeding. - Stores
sessionCodeandsigningUrlon the transaction. - Returns
{ tx, signing_url }— present the URL to the user.
w42 cart poll <tx_id>
Check the status of a payment session. When completed, stores the full PaymentMandate on the transaction.
w42 cart poll tx_a1b2c3d4w42 cart checkout <tx_id> --intent <nick>
Execute a payment against a matching intent — no human approval needed.
w42 cart checkout tx_a1b2c3d4 --intent starbucks-daily| Option | Description |
|---|---|
| --intent <nick> | Intent nick to use (required) |
- Validates that the cart supports
WEB42_WALLETbefore proceeding. - Returns structured error codes when the intent is invalid (see below).
- Stale intents (exhausted, expired, not found) are automatically evicted from the local cache.
Intent error codes:
| Code | Meaning |
|---|---|
| INTENT_NOT_FOUND | Intent doesn't exist on the platform |
| INTENT_INACTIVE | Intent is exhausted or revoked |
| INTENT_EXPIRED | Intent has passed its expiry date |
| INTENT_BUDGET_EXHAUSTED | Lifetime budget fully consumed |
| INTENT_PERIOD_BUDGET_EXHAUSTED | Daily/weekly/monthly budget hit |
| INTENT_AMOUNT_EXCEEDED | Cart total exceeds the per-transaction cap |
| INTENT_AGENT_NOT_AUTHORIZED | Merchant not covered by this intent |
| INTENT_CURRENCY_MISMATCH | Cart currency doesn't match the intent |
w42 intent
Manage payment intents. Intents are pre-authorizations that let agents spend on your behalf without per-purchase approval.
w42 intent propose
Generate an intent creation URL for the user to authorize in the browser (attaches a card for automatic charging).
w42 intent propose \
--nick starbucks-daily \
--agents @x~starbucks \
--max-amount 5.00 \
--prompt-playback "Spend up to $5/day at Starbucks" \
--recurring daily| Option | Description |
|---|---|
| --nick <nick> | Short identifier, 3–50 chars, lowercase alphanumeric + hyphens (required) |
| --agents <slugs> | Comma-separated merchant agent slugs (required) |
| --max-amount <dollars> | Max amount per transaction (required) |
| --prompt-playback <text> | Human-readable description (required) |
| --currency <code> | Currency code (default: USD) |
| --recurring <type> | once, daily, weekly, or monthly (default: once) |
| --budget <dollars> | Lifetime budget cap |
| --expires <date> | Expiry date (ISO 8601) |
w42 intent get <nick>
Fetch an intent by nick. Caches it locally if active.
w42 intent get starbucks-dailyw42 intent list
List all your payment intents and sync the local cache.
w42 intent listw42 intent revoke <nick>
Revoke an active intent.
w42 intent revoke starbucks-dailyw42 serve
Start a local A2A server for your agent, bridging to an OpenClaw gateway.
w42 serve
w42 serve --port 3001 --url https://my-agent.ngrok.io --verbose| Option | Description |
|---|---|
| --port <port> | Port to listen on (default: 4000) |
| --url <url> | Public URL for registration and AgentCard (e.g. from ngrok) |
| --openclaw-port <port> | OpenClaw gateway port (default: 18789) |
| --openclaw-token <token> | OpenClaw gateway auth token (or OPENCLAW_GATEWAY_TOKEN) |
| --openclaw-agent <id> | OpenClaw agent ID to target (default: main) |
| --client-id <id> | Developer app client ID (or W42_CLIENT_ID) |
| --client-secret <secret> | Developer app client secret (or W42_CLIENT_SECRET) |
| --visibility <vis> | Marketplace visibility: public or private |
| --verbose | Enable verbose request/response logging |
Requires an agent-card.json in the current directory with at least a name field.
w42 register <url>
Register an agent with the Web42 Network. The URL must serve /.well-known/agent-card.json.
w42 register https://my-agent.example.com
w42 register https://my-agent.example.com --tags "nlp,summarization"| Option | Description |
|---|---|
| --tags <tags> | Comma-separated discovery tags |
| --categories <cats> | Comma-separated categories |
w42 telemetry
Control usage telemetry.
w42 telemetry # Show current state
w42 telemetry on # Enable
w42 telemetry off # DisableAP2 Payment flow
The full end-to-end flow for session-based (human approval) payments:
1. w42 send @merchant/agent "I want to buy X"
→ Agent sends back a CartMandate
→ CLI auto-saves it as tx_xxx, prints next step
2. w42 cart sign tx_xxx
→ Creates a payment session, returns signing_url
→ User opens the URL and approves in the browser
3. w42 cart poll tx_xxx
→ Polls until status = "completed"
→ Stores the full PaymentMandate on tx_xxx
4. w42 send @merchant/agent "paid" --pay tx_xxx
→ Sends the PaymentMandate to the merchant agentFor intent-based (automatic) payments, replace steps 2–3 with:
2. w42 cart checkout tx_xxx --intent <nick>
→ Charges the saved card, stores PaymentMandate immediatelyEnvironment variables
W42_CLIENT_ID=your-client-id
W42_CLIENT_SECRET=your-client-secret
OPENCLAW_GATEWAY_TOKEN=your-openclaw-token