Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What I built
I implemented an A2A v1.0 seller and buyer using a custom Python harness backed by GroqCloud
openai/gpt-oss-120b.The harness makes negotiation decisions, while Python handles A2A communication and enforces hard safety constraints such as seller reserves and buyer budgets.
Base assignment
The seller exposes an A2A v1.0 Agent Card, uses JSON-RPC, keeps the required reserves for
lamp,chair, andbookshelf, returnsTASK_STATE_INPUT_REQUIREDduring negotiation, continues follow-up messages on the sametaskId, and returns a structured receipt artifact with a numericpricewhen a deal completes.The buyer reads the seller Agent Card, selects the JSON-RPC v1.0 interface, sends
A2A-Version: 1.0, continues negotiation using the sametaskId, never offers above its budget, and stops when the harness decides that no acceptable deal is possible.The harness decides seller opening asks, counteroffers, accept/reject decisions, buyer offers, and walk-away decisions. The Python code additionally enforces seller reserve and buyer budget as hard boundaries.
Base result
Required Challenge 1 — Large catalog seller
I generated and committed a synthetic catalog containing 4,000 products. Instead of sending the full catalog to the model, the system uses this pipeline:
Recorded successful case:
The final sale price stayed above reserve.
I also tested an impossible request for a bamboo bookshelf with strict height/capacity constraints. The search returned zero candidates and the seller rejected the request instead of choosing the wrong product.
Evidence is stored in:
Required Challenge 2 — Many shops and one total budget
I created 20 A2A shops with different inventories, reserves, and advertised prices. The buyer reads all 20 Agent Cards, builds a shop directory, asks the harness to choose shops and item-level budgets, and then negotiates with selected shops concurrently.
Recorded shopping list:
Total budget: 450
Harness plan:
Each negotiation maintains its own
taskId, task state, item budget, turn number, latest seller price, a compact state summary, and only the two most recent messages.Recorded purchases:
Final verification:
Therefore all 20 Agent Cards were read, all 3 requested items were purchased from 3 different shops, no item was duplicated, and total spending stayed within the global budget.
Evidence is stored in:
What I tried and fixed
During development, the first seller implementation used an SDK call that was incompatible with the installed A2A SDK:
I replaced it with the SDK's
requires_input(...)helper forTASK_STATE_INPUT_REQUIRED.Another manual run produced:
I hardened the custom harness with API retries, JSON extraction/recovery, semantic validation retries, seller-reserve enforcement, and buyer-budget enforcement. After the fixes, the official trade test passed 21/21.
What A2A fixed and what remained outside A2A
A2A standardized Agent Card discovery, JSON-RPC communication, protocol versioning,
taskIdcontinuation, task states, and structured completion artifacts.A2A did not define the business semantics of negotiation, so the agents still had to agree on item representation, numeric offers, current asking price, acceptance meaning, and receipt fields.
Harness
openai/gpt-oss-120bhttps://api.groq.com/openai/v10a2a-sdk 1.2.2OPENAI_API_KEYand is not committed.Validation summary
check_week06.pyHow to run
From the repository root:
Challenge 1 seller:
Challenge 2:
Limitations
Challenge 2 currently plans shop selection and item budgets before negotiations start and does not perform a second global re-planning step if a selected shop later fails. Exact model-generated offers may vary between runs because the harness uses an external model service.
Challenge 3, deployment, and cross-student trading were not included because they are optional / extra credit.
Checklist
Additional verification:
check_week06.py: all checks passedsubmissions/25512089/week-06/