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. |
- Remove redundant `uv pip install -e .` (uv sync already covers it) - Use `find -mindepth 1 -delete` for log clearing (safer than wildcard) - Point `adk web` at $AGENTS_DIR/shopping_agent subdirectory
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. 🙏 |
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