Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Tour of Agent Protocols: MCP, A2A, UCP, AP2, AG...

Tour of Agent Protocols: MCP, A2A, UCP, AP2, AG-UI, A2UI

There are many emerging protocols around agents. Model Context Protocol (MCP) standardizes how models and agents access external tools and resources. Agent2Agent Protocol (A2A) defines how agents running on diverse frameworks and platforms communicate. Universal Commerce Protocol (UCP) standardizes merchant discovery, catalog browsing, and checkout for agentic commerce, while Agent Payments Protocol (AP2) secures agent-led payments with cryptographically signed mandates. Agent to User Interface Protocol (A2UI) defines how agents generate UI and Agent-User Interaction Protocol (AG-UI) defines how agents communicate with frontends. In this session, we’ll deep-dive into each protocol and show how they complement each other. As a bonus, we’ll also see demos on how to use these protocols in agent frameworks such as Agent Development Kit (ADK) to give you practical knowledge to start building your own interoperable agents.

Mete Atamel

April 02, 2026

Transcript

145 slides
  1. Tour of Agent Protocols: MCP, A2A, AG-UI, A2UI, AP2, UCP

    with ADK Mete Atamel Developer Advocate @ Google @meteatamel atamel.dev speakerdeck.com/meteatamel github.com/meteatamel/genai-beyond-basics/tree/main/samples/protocols
  2. modelcontextprotocol.io An open protocol that defines a standardized way to

    provide tools (functions) and context to your LLMs
  3. After MCP MCP Host AI App MCP Client MCP Client

    MCP Client MCP Server MCP Server MCP Server (local) (remote) (remote) Tools
  4. MCP Data and Transport Layers MCP Client MCP Client Stdio

    transport ✉ Streamable HTTP transport ✉ Streamable HTTP transport MCP Server MCP Server (remote) (local) ✉ JSON-RPC 2.0
  5. MCP in Agent Development Kit root_agent = Agent( ... tools=[

    MCPToolset( connection_params=StdioServerParameters( command='npx', args=[ "-y", "@modelcontextprotocol/server-filesystem", os.path.abspath(TARGET_FOLDER_PATH), ], ),
  6. MCP is a stateless protocol now Every client request send

    the protocol version and the capabilities its _meta field Servers advertise their supported versions and capabilities through the mandatory server/discover request
  7. Tools Tools enable AI models to interact with external systems

    Each tool defines a specific operation with inputs and outputs
  8. Tools mcp = FastMCP(name="Tool Example") @mcp.tool() def sum(a: int, b:

    int) -> int: """Add two numbers together.""" return a + b @mcp.tool() def get_weather(city: str, unit: str = "celsius") -> str: """Get weather for a city.""" # This would normally call a weather API return f"Weather in {city}: 22degrees{unit[0].upper()}" github.com/meteatamel/genai-beyond-basics/tree/main/samples/protocols/mcp/create-local-mcp
  9. Resources Resources provide read-only access to data that the AI

    application can retrieve and provide as context to models
  10. Resources mcp = FastMCP(name="Resource Example") @mcp.resource("file://documents/{name}") def read_document(name: str) ->

    str: """Read a document by name.""" # This would normally read from disk return f"Content of {name}" @mcp.resource("config://settings") def get_settings() -> str: """Get application settings.""" return """{ "theme": "dark", "language": "en", "debug": false }"""
  11. Prompts mcp = FastMCP(name="Prompt Example") @mcp.prompt(title="Code Review") def review_code(code: str)

    -> str: return f"Please review this code:\n\n{code}" @mcp.prompt(title="Debug Assistant") def debug_error(error: str) -> list[base.Message]: return [ base.UserMessage("I'm seeing this error:"), base.UserMessage(error), base.AssistantMessage("I'll help debug that. What have you tried so far?"), ]
  12. Tools, Resources, Prompts Who controls it? Use Cases Tools Model-controlled:

    Model decides when to call these Allow LLM to interact with external systems Resources App-controlled: App decides when to call these Provide read-only access to data that the AI application can retrieve and provide as context to models Prompts User-controlled: The user decides when to use these Provide reusable prompts for a domain, or showcase how to best use the MCP server github.com/meteatamel/genai-beyond-basics/tree/main/samples/protocols/mcp/document-server
  13. Deploy MCP servers to Cloud Run Agent MCP Client ✅

    Deploy your MCP server alongside your AI agents, one product to learn Cloud Run ✅ Scalable: Cloud Run will scale your MCP server automatically based on demand MCP Server ✅ Centralized server: Share access to a centralized MCP server with team members through IAM privileges, allowing them to connect to it from their local machines instead of all running their own servers locally ✅ Security: Cloud Run provides an easy way to force authenticated requests to your MCP server Cloud Run External resources github.com/meteatamel/genai-beyond-basics/tree/main/samples/protocols/mcp/deploy-mcp-to-cloudrun
  14. Elicitation Elicitation enables MCP servers to request approval, ask for

    missing info, clarification requests from users via MCP clients for more dynamic workflows
  15. Elicitation MCP Client User MCP Server 1. tools/call request 2.

    elicitation/create (Request more information) 3. Present elicitation UI 4. Provide requested information 5. Return user response 6. tools/call response
  16. Elicitation – MCP Server @mcp.tool async def approve_action(ctx: Context) ->

    str: """Simple tool that asks for user approval. No response.""" result = await ctx.elicit( "Approve this action?", response_type=None) if result.action == "accept": print(f"Accepted!") return "Action approved!" print("Declined or Cancelled!") return "Action not approved!" github.com/meteatamel/genai-beyond-basics/tree/main/samples/protocols/mcp/elicitation
  17. Elicitation – MCP Client async def elicitation_handler_approve_action(message: str, response_type: type,

    params, context): print(f"Server asks: {message}") try: user_input = input(f"Your response: ") if user_input.lower() in ["no", "n"]: return ElicitResult(action="decline") return ElicitResult(action="accept") client = Client(" http://127.0.0.1:8080/mcp/ ", elicitation_handler= elicitation_handler_approve_action) async with client: result = await client.call_tool("approve_action") print(f"Tool result: {result.content[0].text}") github.com/meteatamel/genai-beyond-basics/tree/main/samples/protocols/mcp/elicitation
  18. Progress Reporting and Monitoring MCP supports optional progress reporting from

    MCP servers and progress tracking from MCP clients for long-running operations
  19. Progress – MCP Server @mcp.tool async def process_items(items: list[str], ctx:

    Context) -> dict: """Process a list of items with progress updates.""" total = len(items) results = [] for i, item in enumerate(items): # Report progress as we process each item await ctx.report_progress(progress=i, total=total) # Simulate processing time await asyncio.sleep(0.1) results.append(item.upper()) # Report completion await ctx.report_progress(progress=total, total=total) return {"Processed": len(results), "results": results} github.com/meteatamel/genai-beyond-basics/tree/main/samples/protocols/mcp/progress
  20. Progress – MCP Client async def progress_handler( progress: float, total:

    float | None, message: str | None ) -> None: if total is not None: if total == 100: percentage = (progress / total) * 100 print(f"Progress: {percentage:.1f}%") else: print(f"Progress: {progress}/{total}") else: print(f"Progress: {progress}") github.com/meteatamel/genai-beyond-basics/tree/main/samples/protocols/mcp/progress
  21. Agent2Agent Protocol (A2A) Mete Atamel Developer Advocate @ Google @meteatamel

    atamel.dev speakerdeck.com/meteatamel github.com/meteatamel/genai-beyond-basics/tree/main/samples/protocols/a2a
  22. Agents need to talk …but how? ✈ Flight agent 🏨

    Hotel agent 🎒 Travel agent 📌 Guide agent 🏄 Activity agent
  23. Agent2Agent (A2A) Protocol a2a-protocol.org An open protocol started at Google,

    now part of Agentic AI Foundation (AAIF), that standardizes how agents running on diverse frameworks and platforms communicate
  24. A2A GitHub 🏢 github.com/a2aproject - GitHub Organization 📜 github.com/a2aproject/A2A -

    Protocol and Documentation 🐍 github.com/a2aproject/a2a-python - Python SDK 🕸 github.com/a2aproject/a2a-js - TypeScript/Node.js SDK ☕ github.com/a2aproject/a2a-java - Java SDK 🦫 github.com/a2aproject/a2a-go - Go SDK 🔱 github.com/a2aproject/a2a-dotnet - C#/.NET SDK 📋 github.com/a2aproject/a2a-samples - Code Samples/Demos 🔍 github.com/a2aproject/a2a-inspector - Test A2A Agents
  25. A2A SDK pip install a2a-sdk from a2a.types import AgentCard, AgentSkill

    agent_card = AgentCard( name='Hello World Agent', description='Just a hello world agent', url='http://localhost:9999/', version='1.0.0', default_input_modes=['text'], default_ouput_modes=['text'], capabilities=AgentCapabilities(streaming=True), skills=[skill], ) goo.gle/a2a-python-sdk
  26. Agent Discovery User Client Agent A (Client) Agent B (Remote)

    What can you do? How can I contact you?
  27. Agent Discovery Agent Card - A JSON metadata document describing

    an agent's identity, capabilities, endpoint, skills, and authentication requirements User Client Agent A (Client) Agent B (Remote) Agent Card /.well-known/agent-card.json
  28. AgentSkill skill = AgentSkill( id='get_exchange_rate', name='Currency Exchange Rates Tool', description='Gets

    exchange rates between currencies', input_modes=['text/plain'], output_modes=['text/plain'], tags=['currency conversion', 'currency exchange'], examples=['What is 1 GBP in USD?'], )
  29. AgentCard agent_card = AgentCard( name='Currency Agent', description='Helps with exchange rates

    for currencies', url=f'http://{host}:{port}/', version='0.0.1', defaultInputModes=["text/plain"], defaultOutputModes=["text/plain"], capabilities=AgentCapabilities(streaming=True), supported_interfaces=[AgentInterface( protocol_binding='JSONRPC', url='http://127.0.0.1:9999', protocol_version='1.0')], skills=[skill])
  30. AgentExecutor DefaultRequestHandler Bridge between Agent and A2A AgentExecutor User Client

    Agent A (Client) Agent B (Remote) HTTP(S) Message Role (user, agent) Parts (text, file, or JSON) HTTP(S) Message Role (user, agent) Part (text, file, or JSON)
  31. AgentExecutor class AgentExecutor(ABC): """ Implementations of this interface contain the

    core logic of the agent, executing tasks based on requests and publishing updates to an event queue. """ @abstractmethod async def execute(self, context: RequestContext, event_queue: EventQueue ) -> None: """Execute the agent's logic for a given request context. ) @abstractmethod async def cancel( self, context: RequestContext, event_queue: EventQueue ) -> None:
  32. Agent Executor - Example async def execute(self, context: RequestContext, event_queue:

    EventQueue) -> None: # 1. Collect a task from request context if context.current_task: task = context.current_task else: # 1.1 If there is no task, create one and add it event queue task = new_task_from_user_message(context.message) await event_queue.enqueue_event(task) 54
  33. Agent Executor - Example async def execute(self, context: RequestContext, event_queue:

    EventQueue) -> None: ... # 2. Update task status in EventQueue using TaskUpdater class object task_updater = TaskUpdater( event_queue=event_queue, task_id=task.id, context_id=task.context_id ) await task_updater.update_status( state=TaskState.TASK_STATE_WORKING, message=new_text_message('Processing request...'), ) 55
  34. Agent Executor - Example async def execute(self, context: RequestContext, event_queue:

    EventQueue) -> None: ... # 3. Collect user request from request content and invoke LLM agent to generate content query = get_message_text(context.message) if query: result = await self.agent.invoke(user_request=query) else: result = 'No text input is provided!' 56
  35. Agent Executor - Example async def execute(self, context: RequestContext, event_queue:

    EventQueue) -> None: ... # 4. Add generated response as an artifact to EventQueue await task_updater.add_artifact( parts=[new_text_part(text=result, media_type='text/plain')]) print('Result: ', result) # 5. Update task status to completed await task_updater.update_status( state=TaskState.TASK_STATE_COMPLETED, message=new_text_message('Request is completed!'), ) 57
  36. A2A with Agent Development Kit (ADK) pip install google-adk[a2a] Expose

    an ADK Agent over A2A with automatic agent card generation and AgentExecutor already implemented from google.adk.agents.llm_agent import Agent from google.adk.a2a.utils.agent_to_a2a import to_a2a root_agent = Agent( model='gemini-2.0-flash', name='hello_world_agent', # ... ) # Make your agent A2A-compatible a2a_app = to_a2a(root_agent, port=8001) goo.gle/adk-a2a
  37. Option 1: Messages for trivial interactions Message - A single

    turn of communication between a client and an agent, containing content and a role ("user" or "agent") User Client Agent A (Client) Agent B (Remote) HTTP(S) Message Role (user, agent) Parts (text, file, or JSON) HTTP(S) Message Role (user, agent) Part (text, file, or JSON)
  38. Option 2: Tasks for stateful interactions Task - A stateful

    unit of work initiated by an agent, with a unique ID and defined lifecycle User Task Status: Unspecified Submitted Working Completed Failed Cancelled Input required Rejected Auth Required Client Agent A (Client) Agent B (Remote) Message Role Task ID Status (user, agent) Parts (text, file, or JSON) HTTP(S) ⚙ Processing….
  39. Option 2: Tasks for stateful interactions Artifact - A tangible

    output generated by an agent during a task (for example, a document, image, or structured data) User Task Status: Unspecified Submitted Working Completed Failed Cancelled Input required Rejected Auth Required Client Agent A (Client) Agent B (Remote) Message Role Task (user, agent) Parts (text, file, or JSON) JSON-RPC HTTP(S) ID Status Artifact Parts (text, file, or JSON) JSON-RPC
  40. Agent Interactions Request/Response (Polling) User ❌ Simple but inefficient Client

    Agent A (Client) Agent B (Remote) Message Role Task ID Status (user, agent) Parts (text, file, or JSON) HTTP(S)
  41. Agent Interactions Streaming with SSE User Client Agent A (Client)

    Agent B (Remote) HTTPS Agent Card Push updates Best suited for: Real-time progress monitoring of long-running tasks Receive large results (artifacts) incrementally. Interactive, conversational exchanges where immediate feedback or partial responses are beneficial with low latency Message Role (user, agent) Parts (text, file, or JSON) JSON-RPC Initial task Messages Artifacts streaming: true
  42. Agent Interactions Push Notifications for disconnected clients User Client Agent

    A (Client) Agent B (Remote) HTTPS Agent Card Best suited for: Very long-running tasks that can take minutes, hours, or days to complete. Clients that cannot or prefer not to maintain persistent connections, such as mobile applications. Clients only need to be notified of significant state changes rather than continuous updates. Message Role (user, agent) Parts (text, file, or JSON) JSON-RPC pushNotifications: true
  43. A2A Client – fetch agent card import httpx from a2a.client

    import A2ACardResolver # Initialize the A2ACardResolver instance with an HTTP client, base URL, # and use the default path for the agent card. async with httpx.AsyncClient() as httpx_client: resolver = A2ACardResolver( httpx_client=httpx_client, base_url='http://127.0.0.1:9999', ) public_agent_card = await resolver.get_agent_card() 68
  44. A2A Client – send non-streaming message from a2a.client import ClientConfig,

    create_client from a2a.helpers import new_text_message from a2a.types import Role, SendMessageRequest config = ClientConfig(streaming=False) client = await create_client(agent=public_agent_card, client_config=config) # Create a new text message to be sent to the A2A Server. message = new_text_message('Why is the sky blue?', role=Role.ROLE_USER) request = SendMessageRequest(message=message) print('Response:') async for chunk in client.send_message(request): print(chunk) 69
  45. A2A Client – send streaming message client_config = ClientConfig(streaming=True) client

    = await create_client(agent=public_agent_card, client_config=client_config) print('Response:') async for chunk in client.send_message(request): print(chunk) 70
  46. A2A with Agent Development Kit (ADK) pip install google-adk[a2a] Consume

    a remote agent in ADK from google.adk.agents.remote_a2a_agent import RemoteA2aAgent currency_agent = RemoteA2aAgent( name="currency_agent", description="Agent that can convert from one currency to another.", agent_card=( f"https://google.com/.well-known/agent-card.json" ), ) goo.gle/adk-a2a
  47. Agent-User Interaction Protocol (AG-UI) Mete Atamel Developer Advocate @ Google

    @meteatamel atamel.dev speakerdeck.com/meteatamel github.com/meteatamel/genai-beyond-basics/tree/main/samples/protocols/ag-ui
  48. Agent-User Interaction (AG-UI) Protocol docs.ag-ui.com AG-UI is an open, lightweight,

    event-based protocol, created by the CopilotKit, that standardizes how agent backends connect to agent frontends
  49. • CopilotKit is the reference client implementation • Most major

    agent frameworks such as LangGraph, CrewAI, Google ADK, and more are supported
  50. Agent to UI Protocol (A2UI) Mete Atamel Developer Advocate @

    Google @meteatamel atamel.dev speakerdeck.com/meteatamel github.com/meteatamel/genai-beyond-basics/tree/main/samples/protocols/a2ui
  51. Agent to UI Protocol (A2UI) a2ui.org A2UI is a generative

    UI protocol, from Google, that enables AI agents to generate rich, interactive user interfaces across web, mobile, desktop
  52. When a user asks a question to an agent (e.g.

    "What are some good restaurants in New York?"), the agent can not only return the list of restaurants, but also return UI descriptions that can be used by renderers to display the restaurants in a rich interactive format
  53. AG-UI vs. A2UI AG-UI connects frontends to agentic backends A2UI

    is a declarative generative UI spec, which agents can use to return UI widgets as part of their responses
  54. Message Flow Book a table for 2 tomorrow at 7pm

    1. Agent creates surface 1. 2. 3. 4. 5. 6. 7. { "version": "v0.9", "createSurface": { "surfaceId": "booking", "catalogId": "https://a2ui.org/specification/v0_9/basic_catalog.json" } }
  55. Message Flow 2. Agent defines UI structure 1. 2. 3.

    4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. { "version": "v0.9", "updateComponents": { "surfaceId": "booking", "components": [ { "id": "root", "component": "Column", "children": ["header", "guests-field", "submit-btn"] }, { "id": "header", "component": "Text", "text": "Confirm Reservation", "variant": "h1" }, ...
  56. Message Flow 3. Agent populates data 1. 2. 3. 4.

    5. 6. 7. 8. 9. 10. 11. { "version": "v0.9", "updateDataModel": { "surfaceId": "booking", "path": "/reservation", "value": { "datetime": "2025-12-16T19:00:00Z", "guests": "2" } } }
  57. Message Flow 4. User edits guests to "3" → Client

    updates /reservation/guests automatically
  58. Message Flow 5. User clicks "Confirm" → Client sends action

    1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. { "version": "v0.9", "action": { "name": "confirm", "surfaceId": "booking", "context": { "details": { "datetime": "2025-12-16T19:00:00Z", "guests": "3" } } } }
  59. Message Flow 6. Agent responds → Updates UI or sends

    1. 2. 3. 4. { "version": "v0.9", "deleteSurface": { "surfaceId": "booking" } }
  60. Agent Payments Protocol (AP2) Mete Atamel Developer Advocate @ Google

    @meteatamel atamel.dev speakerdeck.com/meteatamel github.com/meteatamel/genai-beyond-basics/tree/main/samples/protocols/ap2
  61. Agent Payments Protocol (AP2) ap2-protocol.org AP2 is an open protocol,

    originated by Google, that secures agent-initiated payment transactions using cryptographically signed mandates and verifiable credentials
  62. AP2 vs. UCP UCP is the commerce layer: merchant discovery,

    catalog, cart, and checkout AP2 is the trust & payment layer: cryptographically signed mandates (SD-JWT)
  63. Four Challenges AP2 Solves 1. Authorization & Auditability: Cryptographic proof

    the user gave the agent permission to buy 2. Authenticity of Intent: Ensure the agent’s request reflects true user intent, not prompt injection 3. Agent Errors & Hallucinations: Hard bounds on merchants, SKUs, and max payment amounts 4. Accountability: Non-repudiable cryptographic audit trail for dispute resolution
  64. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10.

    11. 12. 13. 14. 15. 16. 17. 18. // AP2 v0.2 Mandate & Receipt Credentials (SD-JWT & KB-SD-JWT) { "checkout_domain": { "OpenCheckoutMandate": "mandate.checkout.open.1", // User -> Agent "CheckoutMandate": "mandate.checkout.1", // -> Merchant "CheckoutReceipt": "Signed ES256 JWT (reference = sha256(leaf))" }, "payment_domain": { "OpenPaymentMandate": "mandate.payment.open.1", // User -> Agent "PaymentMandate": "mandate.payment.1", // -> CP / MPP "PaymentReceipt": "Signed ES256 JWT (reference = sha256(leaf))" }, "cryptographic_primitives": { "SD-JWT": "Selective Disclosure JWT signed on Trusted Surface", "KB-SD-JWT": "Key-Binding SD-JWT chaining Agent key via cnf claim", "hash_bind": "SHA-256 base64url digest binding Mandate to Checkout" } }
  65. AP2 Roles • Shopping Agent (SA): AI surface that discovers

    products, builds carts, and chains mandates • Trusted Surface (TS): Secure, non-agentic UI that renders terms and signs with User key • Merchant (M) & Payment Processor (MPP): Verifies CheckoutMandate and settles payment • Credential Provider (CP) & Network (NI): Verifies PaymentMandate and issues tokens
  66. Trust Boundary Agentic (LLM-Driven): Only the Shopping Agent is agentic;

    it holds its own ephemeral signing key (Key_SA) and never touches the user’s private key Non-Agentic (Deterministic): Trusted Surface MUST be non-agentic (renders deterministic templates directly from protocol parameters) Deterministic Verification: All mandate chain & constraint checks MUST execute in deterministic code, never delegated to an LLM
  67. Two Operating Modes • Human Present (Direct): User is present

    at checkout, reviews finalized cart & price on a Trusted Surface, and directly signs Closed Mandates (CheckoutMandate & PaymentMandate) • Human Not Present (Autonomous): User pre-authorizes Open Mandates with constraints (budget, merchants, SKUs) and binds the Agent’s public key (cnf); Agent later chains Closed Mandates (KB-SD-JWT)
  68. Mandate Flow Buy White Shoes (<= $150) from RunFast Store

    1. User signs OpenCheckoutMandate (SD-JWT) 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. open_checkout_token = client.create( payloads=[OpenCheckoutMandate( constraints=[ AllowedMerchants(allowed=[merchant]), LineItems(items=[LineItemRequirements( id="req-running-shoes", quantity=1, acceptable_items=[ MandateItem(id="SKU-SHOE-WHITE", title="White Shoes") ])]), ], cnf={"jwk": agent_pub_dict}, iat=now, exp=now + 3600, )], issuer_key=user_jwk)
  69. Mandate Flow 2. User signs OpenPaymentMandate (SD-JWT) 1. 2. 3.

    4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. open_checkout_hash = compute_sha256_b64url(open_checkout_token) open_payment_token = client.create( payloads=[OpenPaymentMandate( constraints=[ AmountRange(currency="USD", min=0, max=15000), # Max $150.00 AllowedPayees(allowed=[merchant]), PaymentReference( conditional_transaction_id=open_checkout_hash ), ], cnf={"jwk": agent_pub_dict}, # Bind Shopping Agent public key iat=now, exp=now + 3600, )], issuer_key=user_jwk, )
  70. Mandate Flow 3. Merchant creates signed UCP Checkout JWT 1.

    2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. checkout = Checkout( id="chk_98765", merchant=merchant, status=Status.ready_for_complete, currency="USD", totals=[Total(type="total", amount=12000)], line_items=[LineItem( id="li_1", quantity=1, totals=[Total(type="total", amount=12000)], item=Item(id="SKU-SHOE-WHITE", title="White Shoes", price=12000), )], links=[Link(type="terms_of_service", url="https://runfast.io/tos")], ) checkout_jwt = create_jwt( header={"alg": "ES256", "typ": "JWT", "kid": "merchant-key-1"}, payload=json.loads(checkout.model_dump_json(exclude_none=True)), private_key=merchant_jwk, ) checkout_hash = compute_sha256_b64url(checkout_jwt)
  71. Mandate Flow 4. Open Mandate constraints bound what the agent

    can approve: • checkout.allowed_merchants — Restricts allowed merchants • checkout.line_items — Acceptable SKUs & quantities (max-flow) • payment.amount_range — Min/max transaction amount (in cents) • payment.allowed_payees — Restricts which payees receive funds • payment.budget & agent_recurrence — Caps spend & frequency • payment.reference & execution_date — Links open checkout & dates
  72. Mandate Flow 5. Agent chains Closed Mandates (KB-SD-JWT) 1. 2.

    3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. # Agent binds checkout_hash and signs KB-SD-JWT with agent_jwk checkout_chain_token = client.present( holder_key=agent_jwk, mandate_token=open_checkout_token, payloads=[CheckoutMandate( checkout_jwt=checkout_jwt, checkout_hash=checkout_hash, iat=now, exp=now + 3600)], aud="merchant", nonce="nonce_chk_98765", ) payment_chain_token = client.present( holder_key=agent_jwk, mandate_token=open_payment_token, payloads=[PaymentMandate( transaction_id=checkout_hash, payee=merchant, payment_amount=Amount(amount=12000, currency="USD"), payment_instrument=card_instrument, iat=now, exp=now + 3600)], aud="credential-provider", nonce="nonce_pay_98765", )
  73. Mandate Flow 6. Deterministic verification & Receipts 1. 2. 3.

    4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. # Merchant & CP verify SD-JWT/KB-SD-JWT signatures and constraints chk_payloads = client.verify( token=checkout_chain_token, key_or_provider=lambda _: user_pub_jwk, expected_aud="merchant", expected_nonce="nonce_chk_98765") chk_violations = CheckoutMandateChain.parse(chk_payloads).verify( expected_checkout_hash=checkout_hash, checkout_jwt=checkout_jwt) pay_payloads = client.verify( token=payment_chain_token, key_or_provider=lambda _: user_pub_jwk, expected_aud="credential-provider", expected_nonce="nonce_pay_98765") pay_violations = PaymentMandateChain.parse(pay_payloads).verify( expected_transaction_id=checkout_hash, expected_open_checkout_hash=open_checkout_hash) assert not chk_violations and not pay_violations
  74. Verify & Enforce AP2 Mandates 1. Verify Checkout Mandate Chain

    deterministically 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. from ap2.sdk.checkout_mandate_chain import CheckoutMandateChain from ap2.sdk.mandate import MandateClient client = MandateClient() checkout_payloads = client.verify( token=checkout_chain_token, key_or_provider=lambda _tok: user_pub_jwk, expected_aud="merchant", expected_nonce="nonce_chk_98765", ) checkout_chain = CheckoutMandateChain.parse(checkout_payloads) violations = checkout_chain.verify( expected_checkout_hash=checkout_hash, checkout_jwt=checkout_jwt) assert not violations # 0 constraint violations
  75. Verify & Enforce AP2 Mandates 2. Verify Payment Mandate Chain

    deterministically 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. from ap2.sdk.payment_mandate_chain import PaymentMandateChain payment_payloads = client.verify( token=payment_chain_token, key_or_provider=lambda _tok: user_pub_jwk, expected_aud="credential-provider", expected_nonce="nonce_pay_98765", ) payment_chain = PaymentMandateChain.parse(payment_payloads) violations = payment_chain.verify( expected_transaction_id=checkout_hash, expected_open_checkout_hash=open_checkout_hash, ) assert not violations # Amount $120 <= $150 & PaymentReference valid
  76. Verify & Enforce AP2 Mandates 3. Issue & verify cryptographic

    Receipts 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. from ap2.sdk.receipt_wrapper import ReceiptClient receipt_client = ReceiptClient() closed_leaf = client.get_closed_mandate_jwt(checkout_chain_token) checkout_ref = compute_sha256_b64url(closed_leaf) chk_receipt = receipt_client.create_checkout_receipt( merchant=merchant.website, reference=checkout_ref, order_id="ord_1001") chk_receipt_jwt = create_jwt( header={"alg": "ES256", "typ": "JWT"}, payload=json.loads(chk_receipt.model_dump_json(exclude_none=True)), private_key=merchant_jwk) res = receipt_client.verify_receipt( chk_receipt_jwt, merchant_pub_jwk, lambda r: r == checkout_ref, False)
  77. Verify & Enforce AP2 Mandates 4. Guardrail check: reject out-of-budget

    purchase 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. # Agent attempts to pay $250.00 against $150.00 OpenPaymentMandate over_budget_token = client.present( holder_key=agent_jwk, mandate_token=open_payment_token, payloads=[PaymentMandate( transaction_id="tx_over_budget", payee=merchant, payment_amount=Amount(amount=25000, currency="USD"), # $250.00! payment_instrument=card_instrument, iat=now, exp=now + 3600)], aud="credential-provider", nonce="nonce_over_budget", ) payloads = client.verify( over_budget_token, lambda _: user_pub_jwk, expected_aud="credential-provider", expected_nonce="nonce_over_budget") violations = PaymentMandateChain.parse(payloads).verify( "tx_over_budget", expected_open_checkout_hash=open_checkout_hash) # -> Violations: ['Amount 25000 exceeds maximum 15000']
  78. AP2 Hello World & ADK Scenarios $ uv run python

    mandate_demo.py === 1. Generating Keys for User (Trusted Surface), Agent, and Merchant === === 2. User Signs Open Mandates on Trusted Surface (SD-JWT) === Intent: 'Buy white running shoes (SKU-SHOE-WHITE) from RunFast Store (<= $150)' === 3. Merchant Creates Signed UCP Checkout ($120.00) === Merchant Checkout JWT Hash: L23UciCkCgTu8fZgvU8o7awhJ6XqrYbfibTOjWrU9C0 === 4. Shopping Agent Signs Closed Mandates (KB-SD-JWT Delegation Chain) === Agent appended closed KB-SD-JWT hop to both open mandates. === 5. Deterministic Verification & Receipt Issuance === [Merchant] Checkout Mandate Chain verified! Constraints satisfied (0 violations). [Payment Processor] Payment Mandate Chain verified! Amount $120.00 <= $150.00 max. [Shopping Agent] Checkout & Payment Receipts verified: {'verified': True} === 6. Guardrail Demo: Agent Tries to Exceed Budget ($250.00 > $150.00) === [Payment Processor] Rejected! Violations: ['Amount 25000 exceeds maximum 15000']
  79. Universal Commerce Protocol (UCP) Mete Atamel Developer Advocate @ Google

    @meteatamel atamel.dev speakerdeck.com/meteatamel github.com/meteatamel/genai-beyond-basics/tree/main/samples/protocols/ucp
  80. Universal Commerce Protocol (UCP) ucp.dev UCP is an open standard,

    co-developed by Google, Shopify, and industry partners, that defines a common language and functional primitives for agentic commerce
  81. UCP enables AI agents, consumer platforms, businesses, and payment providers

    to interoperate across merchant discovery, capability negotiation, and checkout without bespoke one-off integrations
  82. Four Layers of UCP 1. Services: Vertical or domain groupings

    (dev.ucp.shopping, dev.ucp.common) 2. Capabilities: Discrete, versioned features (checkout, cart, catalog.search) 3. Extensions: Optional schemas augmenting a capability via extends (fulfillment, discount) 4. Transports: Transport-agnostic bindings for REST, MCP, A2A, and Embedded
  83. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10.

    11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. { "ucp": { "version": "2026-08-25", "services": { "dev.ucp.shopping": [{ "transport": "rest", "endpoint": "http://127.0.0.1:8182" }] }, "capabilities": { "dev.ucp.shopping.checkout": [{ "version": "2026-08-25" }], "dev.ucp.shopping.fulfillment": [ { "version": "2026-08-25", "extends": "dev.ucp.shopping.checkout" } ], "dev.ucp.shopping.discount": [ { "version": "2026-08-25", "extends": "dev.ucp.shopping.checkout" } ] }, "payment_handlers": { "com.google.pay": [{ "id": "gpay", "version": "2026-08-25" }], "dev.shopify.shop_pay": [{ "id": "shop_pay", "version": "2026-08-25" }] } }, "keys": [{ "kid": "merchant_key_2026", "kty": "EC", "crv": "P-256", "alg": "ES256" }] }
  84. Roles & Participants • Platform (AI Agent): Consumes merchant capabilities

    on behalf of a user • Business (Merchant of Record): Publishes /.well-known/ucp and retains customer relationship • Credential Provider (CP): Issues scoped payment tokens (e.g., Google Wallet, Shop Pay) • Payment Service Provider (PSP): Authorizes, captures, and settles funds (e.g., Stripe, Adyen)
  85. Capabilities & Extensions Capabilities: Reverse-domain naming ({domain}.{service}.{capability}) and date-based versions

    (2026-08-25) without a central registry Extensions: Optional schemas augmenting a parent capability via extends (fulfillment, discount, buyer_consent, ap2_mandate); pruned if parent is inactive ucp.dev/latest/specification/overview/
  86. Capability Negotiation • Discovery: Business publishes its profile at GET

    /.well-known/ucp; Platform sends its profile URL in the UCP-Agent HTTP header • Server-selects negotiation: Business computes capability intersection, selects latest mutually supported version, and prunes orphaned extensions • HTTP Message Signatures (RFC 9421): Permissionless request authentication verified against JWK public keys (keys[]) in each party's profile
  87. Checkout Flow Buy Red Roses Bouquet ($25) & Ceramic Vase

    ($15) 1. Agent discovers Merchant profile 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. GET /.well-known/ucp HTTP/1.1 UCP-Agent: profile="https://agent.example.com/.well-known/ucp-agent.json" { "ucp": { "version": "2026-08-25", "services": { "dev.ucp.shopping": [{ "transport": "rest", ... }] }, "capabilities": { "dev.ucp.shopping.checkout": [...], ... }, "payment_handlers": { "com.google.pay": [...], "dev.shopify.shop_pay": [...] } } }
  88. Checkout Flow 2. Agent creates checkout session 1. 2. 3.

    4. 5. 6. 7. 8. 9. 10. 11. 12. // POST /checkout-sessions { "items": [ { "sku": "sku_roses", "quantity": 1 }, { "sku": "sku_vase", "quantity": 1 } ], "platform_capabilities": [ "dev.ucp.shopping.checkout", "dev.ucp.shopping.fulfillment", "dev.ucp.shopping.discount" ] }
  89. Checkout Flow 3. Merchant negotiates capabilities → status: incomplete 1.

    2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. { "id": "chk_9c35e04f", "status": "incomplete", "currency": "USD", "line_items": [ { "id": "li_1", "item": { "id": "sku_roses", "price": 2500 }, "quantity": 1 }, { "id": "li_2", "item": { "id": "sku_vase", "price": 1500 }, "quantity": 1 } ], "totals": [ { "type": "subtotal", "amount": 4000 }, { "type": "total", "amount": 4000 } ] }
  90. Checkout Flow 4. Explicit checkout states guide autonomous vs. escalated

    flows: • incomplete — Missing required buyer or fulfillment info • requires_escalation — Hand off to buyer via continue_url • ready_for_complete — Finalized totals; ready for payment • complete_in_progress — Completion executing (blocks new updates) • completed — Payment processed and OrderConfirmation created • canceled — Checkout session canceled or expired
  91. Checkout Flow 5. Agent updates fulfillment & discount 1. 2.

    3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. // PUT /checkout-sessions/chk_9c35e04f { "buyer_email": "[email protected]", "shipping_method": "Express Delivery", "discount_code": "SAVE10" } // Response: status = "ready_for_complete" (amounts in minor units / cents) "totals": [ { "type": "subtotal", "amount": 4000 }, { "type": "discount", "display_text": "10% Promo (SAVE10)", "amount": -400 }, { "type": "fulfillment", "display_text": "Shipping (Express Delivery)", "amount": 500 }, { "type": "total", "amount": 4100 } ]
  92. Checkout Flow 6. Agent submits payment token → status: completed

    1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. // POST /checkout-sessions/chk_9c35e04f/complete { "payment_handler": "com.google.pay", "payment_token": "tok_gpay_demo_987654" } // Response: status = "completed" "order": { "id": "ord_ef9fcc12", "label": "Order #ORD_EF9FCC12", "permalink_url": "https://flowershop.example.com/orders/ord_ef9fcc12" }
  93. Integrate UCP into your agent 1. Discover merchant capabilities with

    ucp-sdk 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. from ucp_sdk.models.schemas.profile import BusinessSchema as BusinessProfile def discover_merchant() -> dict: resp = client.get("/.well-known/ucp") profile = BusinessProfile.model_validate(resp.json()) return { "version": profile.ucp.version, "capabilities": list((profile.ucp.capabilities or {}).keys()), "payment_handlers": list(profile.ucp.payment_handlers.keys()), }
  94. Integrate UCP into your agent 2. Create and validate a

    checkout session 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. from ucp_sdk.models.schemas.shopping.checkout import Checkout def create_checkout_session(sku: str, quantity: int = 1) -> dict: resp = client.post("/checkout-sessions", json={ "items": [{"sku": sku, "quantity": quantity}], "platform_capabilities": [ "dev.ucp.shopping.checkout", "dev.ucp.shopping.fulfillment", "dev.ucp.shopping.discount", ], }) return Checkout.model_validate(resp.json()).model_dump(mode="json")
  95. Integrate UCP into your agent 3. Update and complete checkout

    session 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. def update_checkout_session(checkout_id: str, email: str) -> dict: resp = client.put(f"/checkout-sessions/{checkout_id}", json={ "buyer_email": email, "shipping_method": "Express Delivery", "discount_code": "SAVE10", }) return Checkout.model_validate(resp.json()).model_dump(mode="json") def complete_checkout_session(checkout_id: str, token: str) -> dict: resp = client.post(f"/checkout-sessions/{checkout_id}/complete", json={ "payment_handler": "com.google.pay", "payment_token": token, }) return Checkout.model_validate(resp.json()).model_dump(mode="json")
  96. Integrate UCP into your agent 4. Equip a Google ADK

    Agent with UCP tools 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. from google.adk.agents import Agent root_agent = Agent( name="ucp_shopping_agent", model="gemini-2.5-flash", description="AI Shopping Agent using Universal Commerce Protocol (UCP).", instruction="Discover merchant, then create, update & complete checkout.", tools=[ discover_merchant, create_checkout_session, update_checkout_session, complete_checkout_session, ], )
  97. UCP with Agent Development Kit (ADK) [user]: What capabilities and

    products does this merchant support? [ucp_shopping_agent]: I checked the merchant's UCP profile at /.well-known/ucp (2026-08-25): - Capabilities: dev.ucp.shopping.checkout, fulfillment, discount - Payment Handlers: com.google.pay, dev.shopify.shop_pay - Products: Red Roses Bouquet ($25.00), Ceramic Vase ($15.00) [user]: Buy 1 Red Roses Bouquet with Express Delivery, promo SAVE10, and Google Pay. [ucp_shopping_agent]: Your order is complete! - Checkout ID: chk_a1b2c3d4 (status: completed) - Subtotal: $25.00 | Discount (SAVE10): -$2.50 | Express Delivery: $5.00 | Total: $27.50 - Order: Order #ORD_9F8E7D6C (https://flowershop.example.com/orders/ord_9f8e7d6c) github.com/meteatamel/genai-beyond-basics/tree/main/samples/protocols/ucp/adk
  98. Thank you! Mete Atamel Developer Advocate at Google @meteatamel atamel.dev

    speakerdeck.com/meteatamel github.com/meteatamel/genai-beyond-basics/tree/main/samples/protocols

More Decks by Mete Atamel

Other Decks in Technology