Add create_deep_agent option and LangSmith setup instructions

- Show both create_agent and create_deep_agent options in agent.py
- Add LangSmith signup link to README setup instructions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Stephen Chu
2026-01-23 09:30:14 -08:00
parent dcb8b0fe84
commit 91ab35981e
3 changed files with 15 additions and 24 deletions
-1
View File
@@ -1,7 +1,6 @@
# API Keys
OPENAI_API_KEY=your_openai_key_here
# Optional: LangSmith tracing
LANGSMITH_API_KEY=your_langsmith_key_here
LANGCHAIN_TRACING_V2=true
LANGCHAIN_PROJECT=music-support-bot
+5 -4
View File
@@ -1,6 +1,6 @@
# Music Store Customer Support Bot - Starter Code
Simple starter code for building a customer support agent for the Chinook music store database using `create_agent()`.
Simple starter code for building a customer support agent for the Chinook music store database using `create_agent()` or `create_deep_agent()`.
## Setup
@@ -9,8 +9,9 @@ Simple starter code for building a customer support agent for the Chinook music
pip install -r requirements.txt
pip install langgraph-cli
# 2. Add your API key to .env
# Edit OPENAI_API_KEY in the .env file
# 2. 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)
# 3. Run Studio
langgraph dev
@@ -29,7 +30,7 @@ take_home/
├── .env # Environment variables (add your API keys here)
├── .env.example # Template
└── src/
├── agent.py # Agent definition using create_agent()
├── agent.py # Agent definition
├── db.py # Database connection (loads from GitHub)
└── tools/
├── customer_tools.py # get_customer_orders tool
+10 -19
View File
@@ -1,19 +1,14 @@
"""
Music Store Customer Support Bot - Simple 2-Tool Agent
"""Music Store Customer Support Bot"""
Uses create_agent() with minimal tools for simplicity.
"""
import os
from langchain_openai import ChatOpenAI
from langchain.agents import create_agent
from langchain.agents import create_deep_agent
from src.tools.customer_tools import get_customer_orders
from src.tools.music_tools import list_tracks_by_artist
# Model configuration
DEFAULT_MODEL = os.getenv("MODEL", "gpt-4o")
# System prompt for the agent
SYSTEM_PROMPT = """You are a helpful customer support agent for a music store.
You can help customers with:
@@ -26,20 +21,16 @@ Important:
- Be friendly, helpful, and professional
- For questions outside these capabilities, politely explain what you can help with"""
TOOLS = [get_customer_orders, list_tracks_by_artist]
def build_agent():
"""Build the customer support agent with 2 simple tools."""
"""Build agent using create_agent."""
model = ChatOpenAI(model=DEFAULT_MODEL, temperature=0)
return create_agent(model=model, tools=TOOLS, system_prompt=SYSTEM_PROMPT)
tools = [
get_customer_orders, # View order history
list_tracks_by_artist # Browse tracks by artist
]
agent = create_agent(
model=model,
tools=tools,
system_prompt=SYSTEM_PROMPT
)
return agent
# def build_agent():
# """Build agent using create_deep_agent."""
# model = ChatOpenAI(model=DEFAULT_MODEL, temperature=0)
# return create_deep_agent(model=model, tools=TOOLS, system_prompt=SYSTEM_PROMPT)