Developing AI agents is a game of complexity. With ever-expanding prompts, intricate execution traces, and lengthy multi-turn conversations, traditional debugging quickly becomes overwhelming. LangChain's new AI assistant, Polly, is designed to change how we develop by providing expert debugging and optimization directly inside LangSmith.
Challenges of Debugging AI Agents
Human debugging often falls short when it comes to modern agents. Consider these common pain points:
- Massive prompts: Instructions can stretch to thousands of lines, making errors hard to track down.
- Complex traces: A single agent run may involve hundreds of steps and data points, which can swamp developers.
- Multi-turn conversations: Agents may interact over extended periods, requiring context that spans hours or days.
Manual analysis is not enough. Polly addresses these challenges with targeted, AI-powered solutions.
How Polly Elevates Debugging
Trace Debugging
Polly analyzes individual execution traces, making sense of hundreds of steps so you don’t have to. Just ask Polly questions like:
- Where did things go wrong?
- Did the agent make mistakes?
- Could the agent be more efficient?
- Why did it choose this approach?
Instead of overwhelming data dumps, Polly gives actionable insights, spotting patterns and failure points that might otherwise be missed.
Conversation Analysis
For issues spanning multiple interactions, Polly leverages the Thread view. Its capabilities include:
- Summarizing long agent conversations
- Identifying behavioral changes over time
- Explaining strategy shifts
- Flagging when critical context is lost
This holistic view uncovers the root causes of elusive bugs that emerge only after prolonged interactions.
Prompt Engineering Support
Polly excels as a prompt engineer. Using natural language, you can instruct Polly to:
- Modify system prompts for desired behaviors
- Define or update structured output schemas
- Refine tool definitions
- Optimize prompt lengths while preserving key details
- Add or tweak few-shot examples
This automation frees developers from endless manual tweaking and helps prevent accidental regressions.
Deep Integration with LangSmith
Polly’s power comes from LangSmith’s robust tracing infrastructure, which organizes data into:
- Runs: Single LLM calls or tool actions
- Traces: Complete agent executions made up of multiple runs
- Threads: Full conversations across traces
Getting started is quick,set up tracing in LangSmith, and Polly is ready to provide immediate debugging and improvement suggestions.
Getting Started with Polly
Polly is currently in beta and available to help you:
- Implement LangSmith tracing in minutes
- Debug agents using familiar workflows
- Chat with Polly for instant insights and recommendations
With Polly, LangChain users can accelerate development cycles, improve agent reliability, and focus on building rather than troubleshooting.
Takeaway
Polly signals a new era in agent engineering. By automating the toughest parts of debugging and prompt optimization, Polly empowers developers to innovate faster. If you’re building AI agents with LangChain, Polly is ready to transform your workflow.
Source: LangChain Blog

Polly: Your AI Debugging Partner for Smarter Agent Development