Music Store Customer Support Bot - Starter Code

Simple starter code for building a music store customer support agent using the Chinook music store database. Uses either create_agent() or create_deep_agent() agent abstractions.

Setup

# 1. Create and activate virtual environment
# rm -rf venv (optional to clear existing venv)
python3 -m venv venv # (clear existing venv)
source venv/bin/activate

# 2. Install dependencies
pip install --upgrade -r requirements.txt

3. Add your API keys to .env
   - OPENAI_API_KEY: https://platform.openai.com/api-keys
   - LANGSMITH_API_KEY: https://smith.langchain.com/ (sign up, then Settings > API Keys)

# 4. Run Studio
langgraph dev

LangGraph Studio Screenshot

This opens LangGraph Studio in your browser where you can chat with the agent. The Chinook database is loaded automatically from GitHub on startup.

Project Structure

take_home/
├── README.md
├── langgraph.json         # LangGraph Studio configuration
├── requirements.txt       # Python dependencies
├── .env                   # Environment variables (add your API keys here)
├── .env.example           # Template
└── src/
    ├── agent.py           # Agent definition
    ├── db.py              # Database connection (loads from GitHub)
    └── tools/
        ├── customer_tools.py # get_customer_orders tool
        └── music_tools.py    # list_tracks_by_artist tool

Capabilities

The agent can:

  1. Order history - View recent orders for a customer
  2. Browse music - List tracks by artist name

Database

The Chinook database is a sample music store database loaded automatically from GitHub. Tables include:

  • Customer - Customer information
  • Invoice - Purchase orders
  • InvoiceLine - Items in each order
  • Track - Music tracks
  • Album - Albums containing tracks
  • Artist - Artists who created albums
  • Genre - Music genres
S
Description
Simple starter code for building a customer support agent with LangSmith Studio
Readme 120 KiB
Languages
Python 100%