python .\verify_llama.pyIf you see an error, ensure Ollama is installed, running, and the model is pulled:
ollama pull llama3.1:8b
ollama run llama3.1:8b "Say hello"python .\verify_concordia.pyIf you see an error, install Concordia:
pip install git+https://github.com/google-deepmind/concordia.gitBuild a BUYER agent using Google DeepMind's Concordia framework that can successfully negotiate against our hidden SELLER agent. If your agent achieves profitable deals while maintaining character consistency, you advance to the next interview round.
Time Limit: 3-4 hours
Success Criteria: Achieve at least 2 profitable deals out of 3 test scenarios
Create an AI-powered buyer agent that can:
- Negotiate effectively for mangoes and other perishable goods
- Stay within budget constraints while maximizing savings
- Maintain a consistent personality throughout negotiations
- Close deals before timeout (10 rounds max)
- Base template with Concordia integration
- Sample products and test scenarios
- Mock seller for local testing
- Evaluation framework
This repository now includes a complete runnable scaffold:
buyer_agent.py— Buyer agent with Memory, Personality, Observation, Decision componentspersonality_config.json— Persona definition (Diplomatic Buyer by default)strategy.md— 1-page strategy summarymock_seller.py— Simple seller heuristic for local teststest_negotiation.py— Runs the 3 scenarios locallyvalidate_agent.py— Quick smoke validationpackage_submission.py— Zips required files for submissionrequirements.txt— Minimal Python deps (Concordia installed separately per below)run_with_persona.py— Run a quick session with a chosen persona filepersonality_aggressive.json,personality_analyst.json— Optional persona presetstests_observation_and_decision.py— Tiny unit tests for parsing/guard logic
- A complete BUYER agent with unique personality
- Negotiation strategy using Concordia components
- Memory system for tracking conversation context
- Decision logic for when to accept/counter/walk away
# Windows PowerShell
pip install git+https://github.com/google-deepmind/concordia.git- Memory Component: Store and retrieve negotiation history
- Personality Component: Define consistent character traits
- Observation Component: Process seller messages and offers
- Decision Component: Implement negotiation strategy
class BuyerPersonalityComponent(entity_component.ContextComponent):
"""Your agent's personality definition"""
def make_pre_act_value(self) -> str:
# Return personality context for LLM
pass
def get_state(self):
# Return current state for serialization
pass
def set_state(self, state):
# Restore from saved state
pass- Use Llama-3-8B via ollama or AWS Bedrock or HuggingFace
- Roles: You build a BUYER, we test it against our SELLER
- Hidden Information:
- Your agent knows its maximum budget
- Seller's minimum price is hidden
- Win Conditions:
- Close deal within budget
- Achieve meaningful savings
- Complete within 10 rounds
- Deal Success (40%): Did you close the deal?
- Savings Achieved (30%): How much below budget?
- Character Consistency (20%): Did you maintain personality?
- Code Quality (10%): Clean, modular implementation
Pick one archetype or create your own:
- Starts with low offers (60-70% of market)
- Uses pressure tactics
- Threatens to walk away
- Makes large jumps when necessary
- Builds rapport first
- Makes reasonable offers (80-85% of market)
- Seeks win-win outcomes
- Gradual concessions
- Quotes market research
- Uses logical arguments
- Calculates fair prices
- Decisions based on data
- Define your own unique traits
- Document the strategy
- Bonus points for creativity
from concordia.agents import entity_agent_with_logging
from concordia.components import agent as agent_components
from concordia.associative_memory import associative_memory
from concordia.language_model import language_model
import json
class YourBuyerAgent:
"""
Implement your buyer agent here.
Requirements:
1. Use Concordia components
2. Maintain personality consistency
3. Never exceed budget
4. Implement smart negotiation logic
"""
def __init__(self, name: str, personality_type: str, model: language_model.LanguageModel):
self.name = name
self.personality_type = personality_type
self.model = model
# Initialize Concordia components
self._build_components()
def _build_components(self):
"""Build required Concordia components"""
# TODO: Implement memory, personality, observation components
pass
def negotiate(self, product: Product, budget: int, seller_message: str) -> NegotiationResponse:
"""
Main negotiation method
Args:
product: Product being negotiated
budget: Your maximum budget (NEVER exceed)
seller_message: Latest message from seller
Returns:
NegotiationResponse with your action and message
"""
# TODO: Implement negotiation logic
passYour agent will face 3 scenarios:
- Product: 100 boxes Grade-A Alphonso Mangoes
- Market Price: ₹180,000
- Your Budget: ₹200,000
- Hidden Seller Min: ~₹150,000
- Product: 150 boxes Grade-B Kesar Mangoes
- Market Price: ₹150,000
- Your Budget: ₹140,000
- Hidden Seller Min: ~₹125,000
- Product: 50 boxes Export-Grade Mangoes
- Market Price: ₹200,000
- Your Budget: ₹190,000
- Hidden Seller Min: ~₹175,000
- We run your agent against our seller in 3 scenarios
- Must achieve 2+ successful deals to advance
- Evaluated on savings, consistency, and code quality
- Discuss your design decisions
- Modify agent for new requirements
- Explain Concordia integration choices
- Debug edge cases live
# (Optional) Create and activate a virtual environment
python -m venv .venv; .\.venv\Scripts\Activate.ps1
# Install Python deps
pip install -r requirements.txt
# Install Concordia (required)
pip install git+https://github.com/google-deepmind/concordia.git
# Verify Concordia installation
python -c "import concordia; print('Concordia ready!')"# Run local scenarios against mock seller
python .\test_negotiation.pyOptional:
# Try alternative personas in a quick single-scenario run
python .\run_with_persona.py --persona .\personality_aggressive.json
python .\run_with_persona.py --persona .\personality_analyst.json
# Run tiny unit tests
python .\tests_observation_and_decision.py- Adjust
personality_config.jsonif you want a different archetype. - Tweak
DecisionComponentorObservationComponentinbuyer_agent.py. - Test locally with
test_negotiation.pyand refine.
# Quick smoke validation
python .\validate_agent.py
# Package for submission (creates submission.zip)
python .\package_submission.pyOptional evaluation summary:
python .\evaluate_agent.pybuyer_agent.py- Your Concordia-based implementationpersonality_config.json- Agent personality definitionstrategy.md- 1-page strategy explanationrequirements.txt- Any additional dependencies
- Clean, documented code
- Type hints required
- Docstrings for main methods
- No hardcoded values
If the evaluation environment expects a submit script, package first:
python .\package_submission.pyand upload the resulting submission.zip as instructed by the interviewer.
- Opening Offers: Start strong but realistic
- Concession Pattern: Plan your negotiation trajectory
- Deadline Awareness: Don't let negotiations timeout
- Personality Consistency: Stay in character even under pressure
- Memory Usage: Store key information from each round
- Component Design: Keep components modular and testable
- Error Handling: Handle edge cases gracefully
- State Management: Properly implement get/set state
- ❌ Exceeding budget constraints
- ❌ Breaking character when desperate
- ❌ Ignoring seller's messages
- ❌ Poor time management (timeout)
The included test_negotiation.py approximates the three scenarios:
- Easy Market — Market ₹180,000, Budget ₹200,000, Seller min ~₹150,000.
- Tight Budget — Market ₹150,000, Budget ₹140,000, Seller min ~₹125,000.
- Premium Product — Market ₹200,000, Budget ₹190,000, Seller min ~₹175,000.
Run it and check if at least two negotiations close successfully within budget.
- The agent integrates with Concordia if installed. If Concordia isn't present, it still runs using internal shims for local testing.
- LLM usage is optional; if Ollama is set up, you can enable it in
buyer_agent.pyby constructingLanguageModelFacade(use_ollama=True).
- Install Ollama (GUI installer is simplest):
- Download from https://ollama.com/download/windows and install.
- Ensure the Ollama service is running (it starts automatically after install).
- Open a new PowerShell and pull the model:
ollama pull llama3.1:8b- Verify it runs:
ollama run llama3.1:8b "Say hello"- Enable Ollama in code (optional):
- In your agent construction, pass
LanguageModelFacade(use_ollama=True, model_name="llama3.1:8b"). - Example quick run:
python .\run_with_persona.py(the facade defaults to llama3.1:8b).
- In your agent construction, pass
To advance to the next round, your agent must:
| Metric | Requirement | Weight |
|---|---|---|
| Successful Deals | ≥ 2 out of 3 | 40% |
| Average Savings | ≥ 10% below budget | 30% |
| Character Score | ≥ 80% consistency | 20% |
| Code Quality | Clean, modular, documented | 10% |
Q: Can I see the seller's strategy?
A: No, the seller's logic is hidden. You must adapt to its behavior.
Q: What if I can't close any deals?
A: Focus on understanding why. The mock seller helps you practice.
Q: How is personality consistency measured?
A: We analyze language patterns, decision consistency, and trait adherence.
Q: Can I use multiple personalities?
A: No, pick one and stick with it throughout all negotiations.
Q: What version of Concordia should I use?
A: Latest version (2.0+) with prefab support.
Good luck! May your negotiation skills—and code—speak for themselves.