A2A
The Agent-to-Agent (A2A) transport enables autonomous multi-agent commerce scenarios with complex coordination.
Overview
A2A (Agent-to-Agent) protocol enables direct communication between AI agents for complex commerce scenarios. Multiple agents can coordinate to compare prices, negotiate terms, and complete transactions autonomously.
A2A Endpoint Discovery
A2A endpoints are declared in the business profile:
{
"transports": {
"a2a": {
"endpoint": "https://a2a.business.com",
"protocol_version": "1.0",
"capabilities": ["negotiation", "multi-item", "scheduling"]
}
}
}Message Format
{
"type": "a2a.commerce.request",
"id": "msg_unique_123",
"from": {
"type": "agent",
"identifier": "agent:buyer-assistant-001",
"name": "Shopping Assistant"
},
"to": {
"type": "agent",
"identifier": "agent:store-agent-acme",
"name": "ACME Store Agent"
},
"conversation_id": "conv_abc123",
"timestamp": "2025-01-15T10:30:00Z",
"payload": {
"intent": "purchase",
"items": [
{ "sku": "WH-PRO-001", "quantity": 1 }
],
"constraints": {
"max_total": 250.00,
"currency": "USD",
"delivery_by": "2025-01-20"
},
"mandate_ref": "mandate_xyz789"
}
}Conversation Flow
Buyer agent discovers store A2A endpoint
Buyer sends purchase intent with constraints
Store agent responds with availability and pricing
Optional back-and-forth on terms
Buyer confirms within mandate limits
Transaction is executed
Both agents receive confirmation
Message Types
Purchase Intent
{
"type": "a2a.commerce.intent",
"payload": {
"intent": "purchase",
"items": [
{ "sku": "WH-PRO-001", "quantity": 1 }
],
"constraints": {
"max_total": 250.00,
"delivery_by": "2025-01-20"
}
}
}Quote Response
{
"type": "a2a.commerce.quote",
"payload": {
"quote_id": "quote_abc123",
"valid_until": "2025-01-15T11:30:00Z",
"items": [
{
"sku": "WH-PRO-001",
"name": "Pro Wireless Headphones",
"unit_price": 149.99,
"quantity": 1,
"availability": "in_stock"
}
],
"totals": {
"subtotal": 149.99,
"shipping": 9.99,
"tax": 14.40,
"total": 174.38
},
"delivery_estimate": "2025-01-18"
}
}Acceptance
{
"type": "a2a.commerce.accept",
"payload": {
"quote_id": "quote_abc123",
"mandate_proof": {
"mandate_id": "mandate_xyz789",
"transaction_hash": "sha256:...",
"signature": "base64..."
},
"shipping_address": {
"line1": "123 Main St",
"city": "San Francisco",
"state": "CA",
"postal_code": "94102",
"country": "US"
}
}
}Order Confirmation
{
"type": "a2a.commerce.confirmation",
"payload": {
"order_id": "ord_xyz789",
"status": "confirmed",
"items": [...],
"totals": {...},
"tracking": {
"url": "https://business.com/track/ord_xyz789"
}
}
}Negotiation Protocol
A2A supports optional negotiation for flexible commerce:
// Counter-offer from buyer
{
"type": "a2a.commerce.counter",
"payload": {
"quote_id": "quote_abc123",
"proposed_changes": {
"max_total": 160.00,
"reason": "Budget constraint"
}
}
}
// Store response
{
"type": "a2a.commerce.quote",
"payload": {
"quote_id": "quote_def456",
"replaces": "quote_abc123",
"items": [...],
"totals": {
"total": 159.99 // Adjusted price
},
"note": "Applied 10% discount"
}
}Multi-Agent Coordination
Buyer agents can query multiple stores simultaneously:
// Parallel quote requests
const stores = ['store-a', 'store-b', 'store-c'];
const quotes = await Promise.all(
stores.map(store =>
a2aClient.send({
type: 'a2a.commerce.intent',
to: `agent:${store}`,
payload: {
intent: 'quote',
items: [{ sku: 'WH-PRO-001', quantity: 1 }]
}
})
)
);
// Select best quote
const bestQuote = quotes.reduce((best, quote) =>
quote.payload.totals.total < best.payload.totals.total
? quote : best
);Error Handling
{
"type": "a2a.commerce.error",
"payload": {
"code": "ITEM_UNAVAILABLE",
"message": "Product WH-PRO-001 is out of stock",
"reference": "quote_abc123",
"alternatives": [
{ "sku": "WH-PRO-002", "name": "Pro Wireless Headphones V2" }
]
}
}Security
- Message signing - All messages are cryptographically signed
- Agent identity - Verified agent identifiers
- Mandate validation - Transaction authorization checked
- Replay protection - Nonces prevent duplicate processing
Next Steps
- Learn about Embedded Transport for hybrid flows
- See AP2 Mandates for authorization
- Explore AI Agent Integration for implementation
Ready to Get Started?
Join the waitlist for early access to UCPStore and start building with UCP.
Join Waitlist