When your LangGraph agent runs, a lot happens under the hood. If it gives a wrong answer, you need to know: Was it a bad retrieval? Did the tool fail? Or did the LLM just misinterpret the data?
LangSmith allows you to trace every single step.
Tracing: See the exact prompt sent and the raw JSON returned.
Latency: Find out which node is slowing down your app.
Cost: Track exactly how many tokens that "loop" consumed.
Pro Tip: Simply setting two environment variables in your .env file enables tracing automatically. No code changes required!
π 2. LangServe: Turning Code into an API
You can't give your users a Python script. You need a REST API.
LangServe helps you deploy your chains and graphs as a professional web service using FastAPI.
It even gives you a built-in "Playground" UI to test your API in the browser.
from fastapi import FastAPI
from langserve import add_routes
# Import your 'graph' from Day 13
from my_agent import graph
app = FastAPI(title="My AI Agent API")
# This creates /invoke, /stream, and /batch endpoints automatically!
add_routes(app, graph, path="/agent")
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="localhost", port=8000)
β 3. The Production Checklist
Before you hit "Deploy," ask yourself these three questions:
Does it have a System Prompt? Ensure your agent has clear "guardrails" (e.g., "Do not answer political questions").
Is the Memory capped? Use
WindowMemoryorSummaryMemoryso your database doesn't explode.Are the Tools safe? If your tool can delete data, make sure there is a "human-in-the-loop" check.
π Graduation: Where to go from here?
Two weeks ago, LangChain was a mystery. Now, itβs a tool in your belt. The field of AI moves fast, but the fundamentals you learnedβPrompts, Models, Parsers, RAG, and Graphsβare the pillars of the industry.
Your Final Challenge: Take everything youβve built over the last 14 days and combine it. Build a "Personal Study Assistant" that can read your local PDFs (RAG), search the web (Tools), and remember your name (Memory).
π― Day 14 Summary
LangSmith: For debugging and tracing.
LangServe: For deploying as an API.
Evaluations: Testing your agent against "Golden Sets" of data to ensure it stays smart.
It has been an incredible journey. Keep building, keep breaking things, and most importantly, keep sharing your progress.
The future is agentic. And youβre ready for it. β
Top comments (0)