Basic LangGraph Agent
Learn how to trace basic LangGraph agent workflows with Noveum Trace
This guide shows you how to trace basic LangGraph agent workflows using Noveum Trace. You'll learn how to monitor agent decision-making, tool usage, and state management.
🎯 Use Case
Research Assistant Agent: A simple agent that can search for information and provide answers. We'll trace the agent's decision-making process, tool usage, and state transitions.
🚀 Complete Working Example
Here's a complete, working example you can copy and run:
📋 Prerequisites
Set your environment variables:
🔧 How It Works
1. State Management
The AgentState
TypedDict defines the state structure:
messages
: Conversation historyresearch_complete
: Boolean flag for completion
2. Node Tracing
Each node execution is automatically traced:
- Input state
- Processing logic
- Output state changes
- Tool calls and results
3. Conditional Routing
The should_continue
function determines the next step:
- Traced as a decision point
- Shows routing logic in the dashboard
4. Tool Integration
Tools are automatically traced:
- Input parameters
- Execution time
- Output results
- Error handling
🎨 Advanced Examples
Multi-Step Agent
Agent with LLM Integration
📊 What You'll See in the Dashboard
After running these examples, check your Noveum dashboard:
Trace View
- Complete agent workflow execution
- Node-by-node execution flow
- State transitions and changes
- Tool calls and results
Span Details
- Individual node execution times
- State input/output for each node
- Tool execution details
- Decision point reasoning
Analytics
- Workflow execution patterns
- Node performance metrics
- Tool usage statistics
- State transition frequency
🔍 Troubleshooting
Common Issues
No traces appearing?
- Check your
NOVEUM_API_KEY
is set correctly - Verify the callback handler is added to your LLM
- Ensure you're calling
agent.invoke()
with proper state
Missing node traces?
- Make sure each node function is properly defined
- Check that the graph is compiled correctly
- Verify state structure matches your TypedDict
State not updating?
- Ensure nodes return the updated state
- Check that state keys match your TypedDict
- Verify node connections in the graph
🚀 Next Steps
Now that you've mastered basic agent tracing, explore these advanced patterns:
- Iterative Research - Self-looping agents
💡 Pro Tips
- Use TypedDict: Define clear state structures for better tracing
- Name your nodes: Use descriptive names for easier debugging
- Add logging: Include print statements to track execution flow
- Monitor state: Watch how state evolves through your graph
- Test edge cases: Ensure your routing logic handles all scenarios
Get Early Access to Noveum.ai Platform
Be the first one to get notified when we open Noveum Platform to more users. All users get access to Observability suite for free, early users get free eval jobs and premium support for the first year.