Skip to main content

What We Built

PageWhat You Learned
IntroductionLLM vs agent distinction, ReAct loop with createAgent, weather agent with tool calling
Model Context ProtocolMCP architecture, 3-server split (KnowledgeBase, CustomerInfo, IncidentTicket), tool design principles
Agent MemoryWorking memory (MemorySaver + thread_id), long-term memory (cross-session persistence), integration patterns

Key Takeaways

  1. Agents = LLM + tools + loop. A simple LLM call can’t look up data or take actions. Agents add tool calling with a reasoning loop — the LLM decides which tool to use, observes the result, and continues until it can answer.
  2. MCP decouples tools from agents. Instead of hardcoding tools inside agents, MCP servers expose them over HTTP. Any agent connects, discovers tools via tools/list, and calls them — no code changes when tools are added or updated.
  3. Split servers by domain. One monolithic MCP server with 15 tools is hard to maintain. Three servers (knowledge base, customer info, tickets) can be deployed, scaled, and owned independently. The agent connects to all of them via MultiServerMCPClient.
  4. The agent is stateless. user_uuid and thread_id are passed per call. All conversation state lives in the MemorySaver checkpointer, not the agent instance. One agent serves all users concurrently.
  5. User identity flows via headers, not tool params. The x-user-uuid header identifies the user at the HTTP layer. MCP servers read it from the request — the LLM never needs to pass it. Tools like get_customer_info take no user parameter.
  6. Tool design is the #1 reliability lever. Clear names, “when to use / when NOT to use” descriptions, and 1-3 parameters per tool. The LLM only sees descriptions — not your implementation.
  7. Memory has two tiers. Working memory (MemorySaver + thread_id) handles within-session state. Long-term memory (external store) handles cross-session persistence. Start with working memory; add long-term when needed.

Production Checklist

  • Tools exposed via MCP servers (not hardcoded in agent)
  • Servers split by domain (separate deployment and ownership)
  • Tool descriptions include “when to use” and “when NOT to use”
  • Tool parameters kept simple (1-3 per tool)
  • User identity via x-user-uuid header (not in tool schemas)
  • MemorySaver with thread_id for session persistence
  • Agent is stateless — userId and threadId passed per call
  • Structured error responses from tools (never throw to agent)
  • System prompt instructs agent to call get_customer_info on first turn
  • Tool call logging for observability

Learn More

Specifications & Standards

Frameworks (used in this module)

Other Agent Frameworks

Research

Memory