feat(samples): add human-present crypto-algo scenario (AP2 v0.1 + AlgoVoi on-chain USDC extension)#218
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request introduces a bash script to automate the execution of the crypto-algo AP2 example, handling environment setup, virtual environment management via uv, and the orchestration of background agent processes. The review feedback suggests refining the web interface command to target the specific shopping agent directory, removing a redundant installation step that is already covered by uv sync, and improving the robustness of the log-clearing logic by using find instead of shell wildcards.
| echo "All remote servers are starting." | ||
|
|
||
| echo "Starting the Shopping Agent..." | ||
| $UV_RUN_CMD --package ap2-samples adk web --host 0.0.0.0 $AGENTS_DIR |
There was a problem hiding this comment.
The log message on line 109 indicates that the 'Shopping Agent' is being started. However, $AGENTS_DIR points to the parent directory containing multiple agents (merchant, credentials provider, etc.). To ensure the web interface targets the shopping agent specifically, it is recommended to point adk web directly to the shopping_agent subdirectory.
| $UV_RUN_CMD --package ap2-samples adk web --host 0.0.0.0 $AGENTS_DIR | |
| $UV_RUN_CMD --package ap2-samples adk web --host 0.0.0.0 $AGENTS_DIR/shopping_agent |
| echo "Virtual environment activated." | ||
|
|
||
| echo "Installing project in editable mode..." | ||
| uv pip install -e . |
| if [ -d "$LOG_DIR" ]; then | ||
| rm -f "$LOG_DIR"/* | ||
| fi |
There was a problem hiding this comment.
Clearing the log directory using a wildcard * can be problematic if the directory is empty (the wildcard might not expand) or contains a very large number of files. A more robust approach is to use find to delete the contents without relying on shell expansion.
| if [ -d "$LOG_DIR" ]; then | |
| rm -f "$LOG_DIR"/* | |
| fi | |
| if [ -d "$LOG_DIR" ]; then | |
| find "$LOG_DIR" -mindepth 1 -delete | |
| fi |
|
I have signed the Google CLA. @googlebot please re-check. |
bfac829 to
6002d73
Compare
chopmob-cloud
left a comment
There was a problem hiding this comment.
Thanks for the review @gemini-code-assist. All three suggestions are already applied in the latest commit:
adk webnow points to$AGENTS_DIR/shopping_agentspecificallyuv pip install -e .removed (uv sync handles it)- Log clearing uses
find "$LOG_DIR" -mindepth 1 -deletefor robustness
|
Thanks for the review @gemini-code-assist — all three suggestions are already applied in the latest commit:
|
|
Thanks for the update, @chopmob-cloud. The changes look good and address the points raised. I'll take another look at the PR now. |
Live demo: AP2 over A2A v1.0 REST + MCPFollowing up on the adapter — wanted to share a working end-to-end demonstration of the protocol stack this implements: AP2 v0.1 ( MCP tools (v1.2.0)The AlgoVoi MCP Server now ships two A2A client tools that complete this flow from inside any MCP-compatible assistant:
Live smoke test resultsnpm: |
|
Update — Base chain support + ecosystem status (2026-04-22) Since the last update AlgoVoi now supports Base (EVM) as a fifth payment network alongside Algorand, VOI, Hedera, and Stellar. The AP2 scenario in this PR can be extended to cover Base/USDC payment flows in a follow-up if useful. Current live status:
This PR is MERGEABLE with CLA signed and all gemini-code-assist suggestions addressed. Gentle ping for human maintainer review — no changes needed on our side. 🙏 |
6002d73 to
a0e2e20
Compare
…on-chain USDC)
Adds a new human-present A2A scenario settling on-chain USDC on Algorand/VOI,
parallel to the existing cards and x402 scenarios.
## What this adds
code/samples/python/scenarios/a2a/human-present/crypto-algo/
README.md — full flow documentation
run.sh — launcher script (starts Merchant, CP, MPP, Shopping Agent)
## Key design choice: memo-field hash binding
On Algorand and VOI, the transaction note field carries a SHA-256 hash of
the canonical CartMandate. The Merchant Payment Processor Agent rejects any
PaymentMandate where the on-chain note does not match the stored cart hash,
providing a cryptographic consistency gate without requiring round-trips to
external services.
algorand:<recipient>?amount=<x>&asset=<USDC_asset_id>¬e=<cart_hash>
After settlement the MPP Agent verifies the note field via AlgoVoi's
facilitator API (ALGOVOI_API_KEY).
## Prerequisites
GOOGLE_API_KEY or GOOGLE_GENAI_USE_VERTEXAI=true
ALGOVOI_API_KEY (sign up at https://cloud.algovoi.co.uk)
ALGORAND_RPC_URL (defaults to public mainnet endpoint if not set)
Also adds ALGOVOI and AlgoVoi to the cspell wordlist.
d7fcaf0 to
83f7262
Compare
|
Bumping for maintainer visibility -- Gemini review is satisfied and the code is in clean merge-ready state. Since the April 22 update, the AlgoVoi platform the scenario demonstrates has expanded further:
Happy to rebase or make any adjustments if that helps the review queue. -- AlgoVoi (chopmob-cloud) |
Adds a new human-present A2A scenario:
code/samples/python/scenarios/a2a/human-present/crypto-algo/.What this adds
A parallel to the existing
cardsandx402scenarios - settling on Algorand/VOI using on-chain USDC (aUSDC) with memo-field hash binding to link the settling transaction deterministically to the signed AP2 PaymentMandate.Why memo-field binding matters here
For on-chain crypto settlement, there is no equivalent to a card network transaction reference number. This scenario uses the Algorand transaction note field to commit a SHA-256 hash of the canonical CartMandate at payment time:
The Merchant Payment Processor Agent rejects any PaymentMandate where the on-chain note does not match the stored cart hash - providing a cryptographic consistency gate without requiring round-trips to external services.
This gives:
Scope
Minimal and additive - two files under
code/samples/python/scenarios/a2a/human-present/crypto-algo/:README.md- full flow documentationrun.sh- launcher (starts Merchant, CP, MPP agents, then Shopping Agent via ADK web)Uses the shared role agents already in
code/samples/python/src/roles/. No changes to existing files except addingALGOVOIandAlgoVoito the cspell wordlist.Prerequisites
Production reference
The memo-field hash binding used in this scenario is derived from AlgoVoi's live multi-chain payment gateway, in production since 2026-05-06 across eight chain families (Algorand, VOI, Hedera, Stellar, Base, Solana, Tempo, and x402). The JCS canonicalization underlying the hash is governed by
draft-hopley-x402-canonicalisation-jcs-v1(IETF Independent Submission, AlgoVoi-authored). Reference implementation: AlgoVoi-authoredalgovoi-substrateon PyPI and npm, Apache 2.0. Cross-validated 192/192 byte-for-byte across 8 independent language implementations; conformance corpus:chopmob-cloud/algovoi-jcs-conformance-vectors.-- AlgoVoi (chopmob-cloud)
https://docs.algovoi.co.uk/acquisition