AI Hints
Home›LangGraph Tutorial›Handoffs and Teams
LangGraph · Lesson 71 of 120

Specialist Agents

Focused prompts.

⏱ 2 min read▶ Video at 1:15:58🎓 Free
Watch this lesson in the LangGraph courseWatch on YouTube ↗Full LangGraph course

The whole point of a team is focus. Each specialist gets a short prompt, only the tools it needs, and if useful, a different model. Let's look at our two specialists, side by side.

Specialist Agents
From the video: Specialist Agents
  • Focus is the point
  • Short prompts, few tools
  • Maybe a different model

specialists.py

The order status tool belongs only to the orders specialist. Each specialist is made with create agent. The books specialist gets the three shop tools, and a one line prompt. The orders specialist gets only order status. Each has a name, which becomes its node name.

specialists.pypython
from langchain.agents import create_agent
from langchain.tools import tool
from shop_tools import check_stock, get_price, get_author

@tool
def order_status(order_id: str) -> str:
    """Status of an order. Order ids look like RB-1234."""
    return {"RB-1234": "shipped, arriving Thursday", "RB-5678": "being packed"}.get(order_id, "not found")

MODEL = "google_genai:gemini-flash-lite-latest"
books = create_agent(MODEL, tools=[check_stock, get_price, get_author], name="books",
                     system_prompt="You are the books specialist at Riverside Books. Be brief.")
orders = create_agent(MODEL, tools=[order_status], name="orders",
                      system_prompt="You are the orders specialist at Riverside Books. Be brief.")

Designing specialists

Give each specialist one area of responsibility. Keep its tools to that area. Write a short prompt, that says what it does, and what it doesn't. And test each specialist alone, before putting it in the team.

keyvalue
One areaper specialist
Toolsonly for that area
Promptwhat it does and doesn't
Testalone first

Summary

Specialists are focused agents, each with a short prompt and only the tools it needs. Next, practise building a complete shop team.

Key takeaways
  • One area each
  • Few tools
  • Test alone
Next up: Practice: Shop Team — supervisor and specialists