Multi-agent used car negotiation simulator with dual AI personalities, real-time streaming, and animated battle UI.
### 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!* ๐