How kumardhananjaya/agentlens works
AgentLens is a LangGraph visualizer SDK: an application developer attaches it to a FastAPI or Flask app, and the UI retrieves a graph schema and renders it as an interactive flowchart. Its callback handler can broadcast execution events over WebSockets for live node highlighting. The graph preserves the documented integration and the sampled runtime/UI layers; some cross-process HTTP and WebSocket links are shown as unverified because no single excerpt establishes both ends.
Main entry points: GraphFlow.tsx Interactive Graph View · server.py Route and Socket Server · __init__.py Visualizer API · callback.py Execution Callback
Components 13
SDK Integration
- Visualizer API
sdk/python/agentlens/__init__.py - Execution Callback
sdk/python/agentlens/callback.py
Backend Runtime
- Route and Socket Server
sdk/python/agentlens/server.py - Graph Schema Parser
sdk/python/agentlens/parser.py
Web Visualizer
- UI App
web/src/App.tsx - Interactive Graph View
web/src/components/GraphFlow.tsx - UI Entry Point
web/src/main.tsx
Graph Rendering
- Graph Layout
web/src/utils/layout.ts - Custom Graph Node
web/src/components/CustomNode.tsx
Other components
- Application Developer
- Host App
- LangGraph
- Browser
Connections 16
- Application Developer → Visualizer API: attaches visualizer
README.md - Visualizer API → Route and Socket Server: delegates attachment
sdk/python/agentlens/__init__.py - Application Developer → Host App: provides app
README.md - Host App → Route and Socket Server: receives routes
sdk/python/agentlens/server.py - Route and Socket Server → Graph Schema Parser: parses schema
sdk/python/agentlens/server.py - Visualizer API → Graph Schema Parser: returns schema
sdk/python/agentlens/__init__.py - LangGraph → Graph Schema Parser: supplies graph
- Application Developer → Execution Callback: registers callback
- Execution Callback → Route and Socket Server: broadcasts events
sdk/python/agentlens/callback.py - Browser → UI Entry Point: loads UI
web/src/main.tsx - UI Entry Point → UI App: renders
web/src/main.tsx - UI App → Interactive Graph View: renders view
web/src/App.tsx - Interactive Graph View → Route and Socket Server: fetches schema and opens socket
- Interactive Graph View → Graph Layout: computes positions
web/src/components/GraphFlow.tsx - Interactive Graph View → Custom Graph Node: renders nodes
web/src/components/GraphFlow.tsx - Execution Callback → Interactive Graph View: streams execution events