Trace Cursor Agents with Langfuse
This guide shows you how to trace Cursor AI agent interactions with Langfuse for monitoring, debugging, and analyzing your AI-assisted coding sessions.
What is Cursor? Cursor is an AI-powered code editor built on top of VS Code. It features AI agents that can help you write, edit, debug, and understand code through natural language interactions. Cursor agents can execute shell commands, read and edit files, and use MCP (Model Context Protocol) tools to assist developers.
What is Langfuse? Langfuse is the open-source LLM engineering platform. It helps teams collaboratively debug, analyze, and iterate on their LLM applications with features like tracing, prompt management, and evaluation.
What This Integration Does
With this integration, you can automatically trace all Cursor agent activity to Langfuse:
- User Prompts: Capture every prompt and instruction sent to the agent
- Agent Responses: Record all agent responses and reasoning
- File Operations: Track file reads and edits with detailed statistics
- Shell Commands: Monitor shell command execution and outputs
- MCP Tool Calls: Log all MCP tool invocations and results
- Session Tracking: Group traces by conversation and workspace for easy filtering
- Performance Metrics: Capture latencies, token usage, and execution times
How It Works
Source: naoufalelh/cursor-langfuse