โ† Back to prompt archive
โœจ General / Other

๐ŸŽฎ AI Negotiation Battle Simulator

Multi-agent used car negotiation simulator with dual AI personalities, real-time streaming, and animated battle UI.

Added Apr 14, 2026
### A Real-Time Agent vs Agent Showdown with AG-UI!

Watch two AI agents battle it out in an epic used car negotiation! Built with **Google ADK** for the backend agents and **AG-UI + CopilotKit** for a jaw-dropping reactive frontend.

## โœจ Features

- **๐Ÿค– Dual AI Agents**: Buyer vs Seller with distinct personalities and negotiation strategies
- **๐Ÿ”„ AG-UI Protocol**: Real-time streaming of agent actions, tool calls, and state changes
- **๐Ÿ’… Jaw-Dropping UI**: Animated battle arena with live negotiation timeline
- **๐ŸŽญ 8 Unique Personalities**: 4 buyers + 4 sellers with different negotiation styles
- **๐Ÿ“Š Generative UI**: Custom React components render tool calls in real-time
- **๐Ÿ”— Shared State**: Agent state syncs bidirectionally with the frontend

## ๐Ÿ—๏ธ Architecture

```
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    Next.js + CopilotKit Frontend                โ”‚
โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”        โ”‚
โ”‚   โ”‚ Battle Arenaโ”‚    โ”‚  VS Display  โ”‚    โ”‚Chat Sidebar โ”‚        โ”‚
โ”‚   โ”‚   Timeline  โ”‚    โ”‚ Buyer/Seller โ”‚    โ”‚ (AG-UI)     โ”‚        โ”‚
โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
           โ”‚              AG-UI Events              โ”‚
           โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                โ”‚
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚   CopilotKit Runtime  โ”‚
                    โ”‚   (/api/copilotkit)   โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                โ”‚ HTTP/SSE
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚    FastAPI + AG-UI    โ”‚
                    โ”‚    ADK Middleware     โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                โ”‚
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚  ADK Negotiation Agent  โ”‚
                    โ”‚  (Battle Master)        โ”‚
                    โ”‚                         โ”‚
                    โ”‚  Tools:                 โ”‚
                    โ”‚  โ€ข configure_negotiationโ”‚
                    โ”‚  โ€ข start_negotiation    โ”‚
                    โ”‚  โ€ข buyer_make_offer     โ”‚
                    โ”‚  โ€ข seller_respond       โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
```

## ๐Ÿš€ Quick Start

### Prerequisites

- Python 3.11+
- Node.js 18+
- Google AI API Key ([Get one here](https://aistudio.google.com/))

### 1. Clone and Navigate

```bash
git clone https://github.com/Shubhamsaboo/awesome-llm-apps.git
cd advanced_ai_agents/multi_agent_apps/ai_negotiation_battle_simulator
```

### 2. Set Up Backend

```bash
cd backend
pip install -r requirements.txt

# Create .env file
echo "GOOGLE_API_KEY=your_api_key_here" > .env

# Start the backend
python agent.py
```

The backend will start on `http://localhost:8000`

### 3. Set Up Frontend

```bash
cd frontend
npm install

# Start the frontend
npm run dev
```

The frontend will start on `http://localhost:3000`

### 4. Start Negotiating! ๐ŸŽฎ

Open `http://localhost:3000` and tell the Battle Master:
- "Start a negotiation for a used car"
- "Show me available scenarios"
- "Use Desperate Dan as buyer and Shark Steve as seller"

## ๐ŸŽญ Personalities

### Buyers
| Personality | Emoji | Style |
|-------------|-------|-------|
| Desperate Dan | ๐Ÿ˜ฐ | Needs car TODAY, weak poker face |
| Analytical Alex | ๐Ÿงฎ | Cites every data point, very logical |
| Cool-Hand Casey | ๐Ÿ˜Ž | Master of the walkaway bluff |
| Fair-Deal Fran | ๐Ÿค | Just wants a win-win |

### Sellers
| Personality | Emoji | Style |
|-------------|-------|-------|
| Shark Steve | ๐Ÿฆˆ | Never drops more than 5% |
| By-The-Book Beth | ๐Ÿ“Š | Goes strictly by KBB |
| Motivated Mike | ๐Ÿ˜… | Really needs to sell |
| Drama Queen Diana | ๐ŸŽญ | Everything is "final offer" |

## ๐Ÿ“ Project Structure

```
ai_negotiation_battle_simulator/
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ .env.example
โ”‚
โ”œโ”€โ”€ backend/                    # Python ADK + AG-UI
โ”‚   โ”œโ”€โ”€ agent.py               # Main agent with tools
โ”‚   โ”œโ”€โ”€ requirements.txt
โ”‚   โ”œโ”€โ”€ config/
โ”‚   โ”‚   โ”œโ”€โ”€ personalities.py   # 8 unique personalities
โ”‚   โ”‚   โ””โ”€โ”€ scenarios.py       # 3 negotiation scenarios
โ”‚   โ””โ”€โ”€ agents/
โ”‚       โ”œโ”€โ”€ buyer_agent.py
โ”‚       โ”œโ”€โ”€ seller_agent.py
โ”‚       โ””โ”€โ”€ orchestrator.py
โ”‚
โ””โ”€โ”€ frontend/                   # Next.js + CopilotKit
    โ”œโ”€โ”€ package.json
    โ”œโ”€โ”€ src/
    โ”‚   โ””โ”€โ”€ app/
    โ”‚       โ”œโ”€โ”€ layout.tsx     # CopilotKit provider
    โ”‚       โ”œโ”€โ”€ page.tsx       # Battle Arena UI
    โ”‚       โ”œโ”€โ”€ globals.css    # Battle animations
    โ”‚       โ””โ”€โ”€ api/
    โ”‚           โ””โ”€โ”€ copilotkit/
    โ”‚               โ””โ”€โ”€ route.ts  # CopilotKit runtime
    โ””โ”€โ”€ tailwind.config.js
```

## ๐ŸŽฌ Sample Battle

```
๐Ÿ”” NEGOTIATION BEGINS: 2019 Honda Civic EX

๐Ÿ“‹ ASKING PRICE: $15,500

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

๐Ÿ˜Ž COOL-HAND CASEY (Round 1):
"I've seen similar Civics go for less. $11,500 seems fair 
given the market. Cash in hand today."

๐Ÿฆˆ SHARK STEVE (Round 1):
"$15,000. This car is pristine. I've got two other 
interested buyers coming this weekend."

๐Ÿ˜Ž COOL-HAND CASEY (Round 2):
"$12,500 is my limit. Take it or I walk."

๐Ÿฆˆ SHARK STEVE (Round 2):
*considers* "$14,000. Final offer."

๐Ÿ˜Ž COOL-HAND CASEY (Round 3):
"$13,000. Meet me in the middle."

๐Ÿฆˆ SHARK STEVE (Round 3):
"...$13,500 and you've got a deal."

๐Ÿ˜Ž COOL-HAND CASEY (Round 4):
"$13,250. Final answer."

๐Ÿฆˆ SHARK STEVE (Round 4):
"Deal. ๐Ÿค"

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

โœ… DEAL CLOSED AT $13,250 ๐ŸŽ‰
   Buyer saved: $2,250 (14.5% off asking)
```

## ๐Ÿง  How It Works

1. **User Request**: You tell the Battle Master what kind of negotiation to run
2. **Configuration**: The agent sets up the scenario and personalities
3. **Tool Calls**: The agent alternates between `buyer_make_offer` and `seller_respond` tools
4. **AG-UI Streaming**: Each tool call streams to the frontend via AG-UI protocol
5. **Generative UI**: Custom React components render each offer/response beautifully
6. **Shared State**: The negotiation timeline updates in real-time
7. **Outcome**: Deal or no-deal is celebrated with animations!

## ๐Ÿ“š Learn More

- [Google ADK Documentation](https://google.github.io/adk-docs/)
- [AG-UI Protocol Docs](https://docs.ag-ui.com/)
- [CopilotKit Documentation](https://docs.copilotkit.ai/)

## ๐Ÿค Contributing

Feel free to add:
- New negotiation scenarios (salary, apartment, contracts)
- Additional personality types
- More dramatic UI effects
- Cross-framework agents (LangChain, CrewAI via A2A)

---

*May the best negotiator win!* ๐Ÿ†
#multi-agent #negotiation #simulation #AG-UI #Google ADK