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 |
Summary
Adds a new human-present scenario demonstrating on-chain USDC payment via the
AP2
crypto-algo/v1extension on Algorand and VOI.samples/python/scenarios/a2a/human-present/crypto-algo/README.md— full walkthrough matching the style of thecardsandx402scenariosrun.sh— one-command startup script matching the pattern ofcards/run.shWhat this demonstrates
The
crypto-algo/v1extension (published athttps://api1.ilovechicken.co.uk/ap2/extensions/crypto-algo/v1) defines:PaymentMethodData—network,receiver,amount_microunits,asset_id,min_confirmations,memo_requiredPaymentResponseDetails—network,tx_id,note_fieldThe scenario covers the full human-present flow:
CartMandatewithcrypto-algo/v1inpayment_methodsnote_field=sha256(CartMandate)— cryptographically binds payment proof to the approved cart (addresses the binding gap discussed in issue [Security Hardening Suggestion]AP2 Human-Present: CartMandate ↔ PaymentMandate Binding and Verification Gap #211)PaymentMandatewith the payer's ed25519 keynote_fieldhash, then confirms on-chain via public indexerReference implementation
A complete open-source server-side gate (
Ap2Gate) is available atAlgoVoi-Platform-Adapters/ap2-adapter/ —
81/81 tests, zero pip dependencies, 4-chain smoke tested (Algorand, VOI, Hedera, Stellar — 13 April 2026).
Chain support
algorand-mainnetvoi-mainnetTest plan
README.mdrenders correctly and matches style of existing scenariosrun.shfollows the same startup pattern ascards/run.shhttps://api1.ilovechicken.co.uk/ap2/extensions/crypto-algo/v1https://api1.ilovechicken.co.uk/ap2/extensions/crypto-algo/v1/schema.json🤖 Generated with Claude Code