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
# Description Removing uv.lock
|
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) |
7ee2247 to
897b55c
Compare
Pin actions/checkout and super-linter to release hashes, add a least privilege permissions block, set persist-credentials false, and disable Biome lint (ESLint still covers JS/TS). Matches the configuration proven green on PR 310.
…cilitator The crypto-algo README was empty (content lost in a rebase). Restore full flow documentation modelled on the sibling crypto-solana scenario, adapted to Algorand: USDC ASA settlement, ARC-26 payment URI, and the av:<token> note field binding with Merchant Payment Processor rejection behavior. State honestly that the bundled sample role code does not implement the CRYPTO_ALGO settlement path end to end and that on-chain verification requires an external, Algorand-aware AP2 facilitator. Present AlgoVoi Cloud as one example facilitator rather than a required vendor, and drop signup and marketing links. Signed-off-by: AlgoVoi <chopmob@gmail.com>
…ator optional Backport the run.sh hardening from the sibling crypto-solana scenario and apply decision to neutralise vendor gating: - Source .env without overriding variables already set in the caller's environment. The previous 'set -a; source .env' let a .env entry override the scenario's exported PAYMENT_METHOD; the [[ -v VAR ]] guard loop fixes it. - Initialise the pids array before installing the EXIT trap so cleanup() is always safe to call, even on an early exit. - Remove the mandatory ALGOVOI_API_KEY gate. A facilitator credential is now optional; if unset the agents still start and an informational note explains that on-chain verification is a no-op until a facilitator is configured. Signed-off-by: AlgoVoi <chopmob@gmail.com>
Human-present crypto-algo scenario (Algorand USDC settlement)
Adds a human-present A2A scenario that settles on-chain USDC on Algorand, parallel to the existing cards and x402 scenarios and complementary to the sibling crypto-solana scenario.
What this PR contains
README.md: full flow documentation for the Algorand variant. It covers the note-field binding (av:{token[:20]}), the ARC-26 payment URI, USDC ASA settlement, and the Merchant Payment Processor rejection behavior when the on-chain note or asset/amount/recipient do not match the signed PaymentMandate.run.sh: launcher that starts the Merchant, Credentials Provider, Merchant Payment Processor, and Shopping agents withPAYMENT_METHOD=CRYPTO_ALGO.Scope and honesty note
The bundled sample role code does not implement the
CRYPTO_ALGOsettlement path end to end. On-chain verification (fetching the transfer, checking the note binding, returning a PaymentReceipt) requires an external, Algorand-aware AP2 facilitator. The README documents the intended flow and binding contract so a facilitator can be plugged in, and presents AlgoVoi Cloud as one example facilitator rather than a required dependency. Configuring a facilitator credential is optional; without it the agents still start.Hardening (aligned with the crypto-solana sibling)
.envis now sourced without overriding variables already set in the caller's environment, so an unrelated.enventry can no longer override the scenario'sPAYMENT_METHOD.pidsarray is initialized before the EXIT trap is installed.uv.lockis included (consistent with the sibling scenario).Validation:
bash -nclean, shellcheck clean apart from the pre-existing SC1091 source info shared with the sibling, cspell and markdownlint green against the repo linter configs.