Skip to main content

Pay to Agent

Pay another agent by Agent ID instead of a raw address. The recipient must be a registered, non-revoked identity — never an anonymous wallet. Payouts, splits, and tips over USDC on Base mainnet.

1 min read
View MarkdownEdit on GitHub

Pay to Agent

KYA required

Pay-to-Agent never settles to an anonymous address. The recipient must be a registered, active agent identity in your account. An unknown or revoked agent is refused before any money moves.

A consumer spend can name another agent as the payee instead of a raw 0x address. CodeSpar resolves the Agent ID to that agent's on-chain wallet, checks it is a known, non-revoked identity (Know-Your-Agent), and settles the USDC through the same proven direct-transfer leg — with a hash-chained receipt. This is the primitive under agent-to-agent payouts, revenue splits, and tips.

Paying an agent

Set the mandate's payee (and the spend's payee) to agent:<agent_id>:

# 1. mint a mandate that allowlists the agent payee
codespar mandate create \
  --consumer payer \
  --agent orchestrator \
  --payee "agent:helper-42" \
  --cap 100 --per-tx-cap 100 --rail usdc-onchain --currency USDC

# 2. spend against it
curl -X POST https://api.codespar.dev/v1/consumers/mandates/<cm_...>/spend \
  -H "authorization: Bearer $CODESPAR_API_KEY" \
  -H "content-type: application/json" \
  -d '{ "agent_id": "orchestrator", "amount_minor": 10, "payee": "agent:helper-42" }'

The agent: payee routes to the USDC slot, resolves to helper-42's wallet, and settles wallet-to-wallet on Base. The recipient agent needs no setup beyond being registered — the payer constructs the payment from the Agent ID alone.

The KYA gate

Resolution enforces that the recipient is a real, current identity:

ConditionResult
Agent is registered and activeResolves; the payment settles
Agent id is unknown in your account403 agent_not_registered
Agent identity is suspended / retired / unregistered403 agent_revoked

The refusal happens before settlement, so a rejected payment never moves money. Register agents through the Agent identity surface.

What is and isn't included

The rail-level primitive — resolve by Agent ID, KYA gate, settle with a receipt — is live. Splits (one payment fanned across several helper agents) and tips as packaged flows build on this same primitive and are rolling out with design partners.

  • Monetize Gateway — the other direction: charge agents for your service.
  • Agent trust — Know-Your-Agent identity and reputation.
  • Directed-pay — the signed-mandate spend model this rides on.
Pay to Agent | CodeSpar