A2A-Powered Multi-Platform E-Commerce System
Built by Sanskar Thapa, Damarrion (DIIZZY) Morgan-Harper, and Joshua Soteras
An intelligent e-commerce orchestration platform that uses Google ADK agents to automatically create, manage, and negotiate product listings across multiple marketplaces (eBay and Tetsy).
- Features
- Architecture Overview
- Project Structure
- Prerequisites
- Installation
- Running the Application
- Usage
- API Endpoints
- Database Schema
- Technology Stack
- Multi-Agent System
- Data Flow
- System Architecture
- eBay Integration Notes
- Troubleshooting
- Contributing
- License
- Acknowledgments
Skillfully using Google's Agent 2 Agent (A2A) Protocol
- Intelligent Agent Orchestration β Multi-agent system with specialized agents for each platform
- AI-Powered Product Analysis β Upload product images and automatically extract details using Google Gemini AI
- Multi-Platform Listing β Seamlessly create listings on eBay and Tetsy from a single interface
- Automated Price Negotiation β AI agents handle buyer-seller negotiations on Tetsy with intelligent pricing strategies
- Real-Time Dashboard β WebSocket-powered live updates of all listings
- Unified Management β Track and manage inventory across all platforms in one place
This project uses a multi-tier architecture with:
| Layer | Technology |
|---|---|
| Agent System | Google ADK Multi-Agent System (Gemini 2.5-Flash) |
| Frontend | React, TypeScript, Tailwind CSS, Shadcn UI |
| Backend | FastAPI, Python, WebSocket support |
| Database | SQLite (Listings and negotiations) |
| Integrations | eBay Sandbox API, Tetsy API |
AgentBay/
βββ backend/ # Main API server (Port 8000)
β βββ apis.py # Primary API routes and WebSocket
β βββ db.py # SQLite database helpers
β βββ ebay_api.py # eBay sandbox integration (Port 8001)
β βββ requirements.txt # Python dependencies
β βββ offersb.db # SQLite database
β
βββ front/ # React frontend (Port 5173)
β βββ src/
β β βββ pages/ # Dashboard and CreateListing pages
β β βββ components/ # Reusable UI components
β β βββ lib/ # API client and utilities
β β βββ types/ # TypeScript type definitions
β βββ package.json
β
βββ specialty_agents/ # Google ADK agent system
β βββ my_agent/ # Root orchestrator (Port 10000)
β βββ ebay_agent/ # eBay specialist (Port 10002)
β βββ tetsy_agent/ # Tetsy specialist (Port 10001)
β
βββ Tetsy/ # Tetsy platform implementation
βββ backend/ # Negotiation API (Port 8050)
βββ frontend/ # Buyer-seller interface
- Python 3.8+
- Node.js 18+
- Google API Key (for Gemini AI)
- eBay Developer Account (for eBay integration)
git clone https://github.com/sskarz/AgentBay.git
cd AgentBaycd backend
pip install -r requirements.txtCreate a .env file in the backend/ directory:
GOOGLE_API_KEY=your_google_api_key_here
EBAY_CLIENT_ID=your_ebay_client_id
EBAY_CLIENT_SECRET=your_ebay_client_secret
EBAY_REDIRECT_URI=http://localhost:8001/oauth/callbackcd front
npm installThe agents use Google ADK and share the same requirements.txt from the backend:
cd specialty_agents/my_agent
pip install -r ../../backend/requirements.txtYou need to start 7 services in separate terminal windows:
| Terminal | Service | Command | Port |
|---|---|---|---|
| 1 | Main Backend API | cd backend && python apis.py |
8000 |
| 2 | eBay Backend | cd backend && uvicorn ebay_api:app --reload --port 8001 |
8001 |
| 3 | Tetsy Backend | cd Tetsy/backend && python main.py |
8050 |
| 4 | Root Orchestrator Agent | cd specialty_agents/my_agent && python -m __main__ |
10000 |
| 5 | Tetsy Agent | cd specialty_agents/tetsy_agent && python -m __main__ |
10001 |
| 6 | eBay Agent | cd specialty_agents/ebay_agent && python -m __main__ |
10002 |
| 7 | Frontend | cd front && npm run dev |
5173 |
- Navigate to the Create Listing page
- Upload Product Image β Drag & drop or click to upload
- AI Analysis β Gemini automatically extracts product details (name, price, description, brand)
- Review & Edit β Confirm or modify the extracted details
- Select Platform β Choose eBay or Tetsy
- Submit β The orchestrator agent routes to the appropriate platform agent
- View Dashboard β See your listing appear in real-time
- Dashboard β View all listings across platforms with live updates
- Status Tracking β Monitor listing status (Draft, Pending, Live, Sold)
- Platform Filtering β See which platform each listing is on (color-coded)
The Tetsy agent automatically handles buyer offers with intelligent pricing:
| Offer Range | Agent Response |
|---|---|
| β₯ 85% of asking price | Accept the offer |
| < 85% of asking price | Counter at 90% |
| Very low offers | Reject politely |
All negotiations are tracked in the Tetsy backend database.
| Endpoint | Method | Description |
|---|---|---|
/ |
GET | API information |
/health |
GET | Health check |
/api/analyze-product-image |
POST | AI image analysis (Gemini) |
/api/stream |
WebSocket | Real-time listing updates |
/api/create-listing-with-agent |
POST | Create listing via agent system |
/api/add_item |
POST | Direct database insertion |
| Endpoint | Method | Description |
|---|---|---|
/start-auth |
GET | Initiate eBay OAuth |
/oauth/callback |
GET | OAuth redirect handler |
/publish |
POST | Publish listing to eBay |
/create-all-policies |
POST | Create business policies |
| Endpoint | Method | Description |
|---|---|---|
/api/negotiations |
GET | Get all negotiations |
/api/negotiations/{id} |
GET | Get negotiation details |
/api/negotiations |
POST | Start new negotiation |
/api/negotiations/{id}/messages |
POST | Send message/offer |
CREATE TABLE users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
title TEXT NOT NULL,
description TEXT,
platform TEXT NOT NULL,
price REAL NOT NULL,
high_price REAL, -- Highest offer received
status TEXT, -- 'listed', 'sold', 'pending'
quantity INTEGER,
imageSrc BLOB, -- Product image bytes
createdAt TIMESTAMP,
updatedAt TIMESTAMP
);CREATE TABLE negotiations (
id TEXT PRIMARY KEY,
product_id TEXT,
buyer_id TEXT,
seller_id TEXT,
status TEXT, -- 'pending', 'accepted', 'rejected', 'counter'
last_offer_amount REAL,
created_at TIMESTAMP
);
CREATE TABLE messages (
id TEXT PRIMARY KEY,
negotiation_id TEXT,
sender_id TEXT,
sender_type TEXT, -- 'buyer', 'seller'
type TEXT, -- 'message', 'offer', 'counter_offer'
offer_amount REAL
);| Technology | Purpose |
|---|---|
| FastAPI | Modern Python web framework |
| Uvicorn | ASGI server |
| SQLite | Embedded database |
| WebSockets | Real-time communication |
| Google Generative AI | Gemini 2.0-flash for image analysis |
| Google ADK | Multi-agent orchestration framework |
| Httpx | Async HTTP client |
| Pydantic | Data validation |
| Technology | Purpose |
|---|---|
| React 19 | UI library |
| TypeScript | Type-safe JavaScript |
| Vite | Build tool and dev server |
| Tailwind CSS | Utility-first CSS |
| Shadcn UI | Component library (Radix UI + Tailwind) |
| React Router | Client-side routing |
| React Hook Form | Form management |
| Zod | Schema validation |
| Axios | HTTP client |
| Sonner | Toast notifications |
| Technology | Purpose |
|---|---|
| Google ADK | Agent development kit |
| Gemini 2.5-Flash | LLM for agent intelligence |
| RemoteA2aAgent | Agent-to-agent communication pattern |
- Purpose: Routes listing requests to appropriate platform agents
- Model: Gemini 2.5-Flash
- Sub-agents:
tetsy_agent,ebay_agent
- Purpose: Publishes listings to eBay Sandbox
- Tools:
publish_to_ebay()β Creates inventory items and offers- Database integration for tracking
- Purpose: Manages Tetsy listings and handles negotiations
- Tools:
post_listing_to_tetsy()β Creates listingscheck_tetsy_notifications()β Monitors offersrespond_to_negotiation()β Intelligent offer handling
- Strategy:
- Accept offers β₯ 85% of asking price
- Counter at 90% for lower offers
- Professional communication with buyers
User uploads image β Gemini AI analysis β Frontend form
β
User confirms details + selects platform β API call
β
Main Backend /api/create-listing-with-agent
β
Root Agent (Gemini 2.5-Flash) decides routing
β
βββ eBay Agent β eBay API β eBay Sandbox
β βββ Database save
β
βββ Tetsy Agent β Tetsy Backend β Tetsy Database
βββ Database save
β
WebSocket broadcasts update β All connected dashboards refresh
Complete System Architecture Diagram (click to expand)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β USER INTERFACE LAYER β
β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β React Frontend (Port 5173) β β
β β βββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββ β β
β β β CreateListing Page β β Dashboard Page β β β
β β β - Image Upload β β - Real-time listing view β β β
β β β - AI Analysis β β - Status tracking β β β
β β β - Platform Select β β - Platform filtering β β β
β β βββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββ β β
β β β β² β β
β β β HTTP POST β WebSocket β β
β β β (FormData) β (real-time) β β
β βββββββββββββββββΌβββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββ β
βββββββββββββββββββΌβββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββ
β β
βΌ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MAIN BACKEND LAYER (Port 8000) β
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β FastAPI Application (apis.py) β β
β β β β
β β POST /api/analyze-product-image β β
β β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
β β β 1. Receive image upload (multipart/form-data) β β β
β β β 2. Encode to base64 β β β
β β β 3. Send to Gemini 2.0-flash-exp β β β
β β β 4. Parse JSON response β β β
β β β 5. Extract: name, description, price, brand β β β
β β β 6. Return product details to frontend β β β
β β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
β β β β
β β POST /api/create-listing-with-agent β β
β β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
β β β 1. Receive: name, description, price, β β β
β β β quantity, brand, platform β β β
β β β 2. Create Runner with root_agent β β β
β β β 3. Invoke agent with prompt β β β
β β β 4. Collect agent response β β β
β β β 5. Return response to frontend β β β
β β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
β β β β
β β WebSocket /api/stream β β
β β βββββββββββββββββββββββββββββββββββββββββββ β β
β β β 1. Accept WebSocket connection β β β
β β β 2. Every 2s: query DB β send JSON β β β
β β βββββββββββββββββββββββββββββββββββββββββββ β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β βββββββββββββββββ βββββββββββββββ β
β β SQLite DB β β Gemini AI β β
β β (offersb.db) β β (Google) β β
β βββββββββββββββββ βββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
β Invokes via Runner
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MULTI-AGENT ORCHESTRATION LAYER β
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Root Orchestrator Agent (Port 10000) β β
β β Model: Gemini 2.5-Flash (Google ADK) β β
β β β β
β β Sub-agents: β β
β β - tetsy_agent (RemoteA2aAgent, localhost:10001) β β
β β - ebay_agent (RemoteA2aAgent, localhost:10002) β β
β βββββββββββββββββββββββββββββ¬βββββββββββββββββββ¬βββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββΌβββββββββββββββββββΌβββββββββββββββββββββββββββββ
β β
ββββββββββββββββββ ββββββββββββββββββ
βΌ βΌ
ββββββββββββββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββ
β Tetsy Agent (Port 10001) β β eBay Agent (Port 10002) β
β Model: Gemini 2.5-Flash β β Model: Gemini 2.5-Flash β
β β β β
β Tools: β β Tools: β
β - post_listing_to_tetsy() β β - publish_to_ebay() β
β - check_tetsy_notifications() β β β
β - respond_to_negotiation() β β Publishes to eBay Sandbox β
β β β via eBay Backend (Port 8001) β
β Posts to Tetsy Backend (Port 8050) β β β
ββββββββββββββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββ
Detailed Flow Sequences (click to expand)
User uploads image
β
CreateListing Page (React Frontend)
β POST /api/analyze-product-image (multipart/form-data)
Main Backend API (Port 8000)
β Send image + prompt
Google Generative AI (gemini-2.0-flash-exp)
β Returns: { name, description, price, brand, quantity }
Main Backend API β Parse JSON β Return to frontend
β
CreateListing Page β Pre-fill form β User reviews β User submits
β
[Continue to Flow 2]
CreateListing Page
β POST /api/create-listing-with-agent (name, description, price, quantity, brand, platform)
Main Backend API (Port 8000)
β Invoke agent via ADK Runner
Root Orchestrator Agent (Port 10000) β Gemini 2.5-Flash
β Routes based on platform
βββ Tetsy Agent (Port 10001) β [Flow 3]
βββ eBay Agent (Port 10002) β [Flow 4]
Tetsy Agent
β Calls post_listing_to_tetsy()
βββ POST http://localhost:8050/api/listings β Tetsy DB (negotiations.db)
βββ POST http://localhost:8000/api/add_item β Main DB (offersb.db)
β WebSocket broadcasts every 2s
All Dashboard clients update
eBay Agent
β Calls publish_to_ebay()
βββ POST http://localhost:8001/publish
β β 1. Validate OAuth token
β β 2. Create inventory item
β β 3. Create & publish offer
β β 4. Return listing URL
βββ POST http://localhost:8000/api/add_item β Main DB (offersb.db)
Buyer makes offer ($40 on a $50 item)
β POST /api/negotiations
Tetsy Backend (Port 8050) β Creates negotiation record
β Webhook: POST http://localhost:10001/webhook/message
Tetsy Agent β Decision Logic (Gemini 2.5-Flash):
β offer_percentage = 40/50 = 80%
β 80% < 85% threshold β Counter at 90% ($45)
β Calls respond_to_negotiation(type="counter", amount=45)
Tetsy Backend β Updates negotiation β Buyer sees counter-offer
Dashboard clients connect β ws://localhost:8000/api/stream
β
Main Backend (every 2 seconds):
β Query SQLite DB (SELECT * FROM users)
β Convert BLOB images to base64
β Send JSON array to all connected clients
β
Dashboard re-renders with updated listings, status badges, platform indicators
| Port | Service | Technology | Purpose |
|---|---|---|---|
| 5173 | React Frontend | Vite | User interface |
| 8000 | Main Backend API | FastAPI | Core orchestration & WebSocket |
| 8001 | eBay Integration Backend | FastAPI | eBay Sandbox API integration |
| 8050 | Tetsy Backend | FastAPI | Negotiation & listing management |
| 10000 | Root Orchestrator Agent | Google ADK | Multi-agent routing |
| 10001 | Tetsy Agent | Google ADK | Tetsy operations & negotiation |
| 10002 | eBay Agent | Google ADK | eBay listing publication |
Frontend (React)
β
βββ Main Backend API βββ SQLite DB (offersb.db)
β β
β βββ Google Gemini (image analysis)
β βββ Root Agent βββ Google ADK
β βββ Tetsy Agent
β β βββ Tetsy Backend βββ SQLite DB (negotiations.db)
β β βββ Main Backend (save listing)
β βββ eBay Agent
β βββ eBay Backend βββ eBay Sandbox API
β βββ Main Backend (save listing)
βββ Tetsy Backend (for buyer negotiations)
βββ Tetsy Agent (webhook for auto-response)
- Uses eBay Sandbox environment for testing
- Requires OAuth 2.0 authentication flow
- Business policies (fulfillment, payment, return) are mandatory
- SKU format: alphanumeric only (no special characters)
- Category-specific product attributes required
- Visit
/start-authto initiate OAuth - Complete authorization on eBay
- Run
/optin-to-business-policies - Create policies via
/create-all-policies - Now ready to publish listings
Agents not connecting
- Ensure all backend services are running first
- Check that ports 8000, 8001, 8050, 10000β10002 are available
- Verify
GOOGLE_API_KEYis set in.env
eBay authentication fails
- Check eBay credentials in
.env - Ensure redirect URI matches eBay app settings
- Verify you're using sandbox credentials for sandbox environment
WebSocket disconnects
- Check browser console for errors
- Ensure main backend (port 8000) is running
- Frontend auto-reconnects every 3 seconds
Image analysis fails
- Verify
GOOGLE_API_KEYis valid - Check image format is supported (JPEG, PNG)
- Ensure image file size is reasonable (< 10MB)
# Backend tests
cd backend && pytest
# Frontend tests
cd front && npm test# Frontend linting
cd front && npm run lint- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This project was developed for CalHacks 2025.
- Built with Google ADK and Gemini AI
- eBay Developers Program for sandbox access
- Shadcn UI for beautiful components
- FastAPI and React communities
