---
title: "Trace and evaluate Cursor agents with Langfuse, powered by ClickHouse"
description: "Langfuse is an open-source platform whose Observability plugin captures Cursor agent traces, including model calls, tool executions, and token usage, with each prompt creating a “Cursor Turn”. ClickHouse powers Langfuse v4 analytics with a wide observations table storing user, session, tags, and environment, avoiding joins for team-wide cost and latency aggregations. To set up, create a Langfuse project, install the plugin from the Cursor Marketplace, place API keys in a config file, and restart Cursor. Each trace contains LLM observations with conversation history, tool observations for Shell, Read, and MCP actions, nested subagent observations, and context compaction events, all grouped into sessions. Teams use dashboards to find expensive turns, create project rules, build datasets from real sessions, and apply evaluators (LLM-as-a-judge, human review) to compare cost and completion before deploying, with CI via a GitHub Action."
---

# Trace and evaluate Cursor agents with Langfuse, powered by ClickHouse

[Clickhouse](https://yomu.fyi/company/clickhouse) · Oct 22, 2026

**Type:** Tutorial

## Summary

Langfuse is an open-source platform whose Observability plugin captures Cursor agent traces, including model calls, tool executions, and token usage, with each prompt creating a “Cursor Turn”. ClickHouse powers Langfuse v4 analytics with a wide observations table storing user, session, tags, and environment, avoiding joins for team-wide cost and latency aggregations. To set up, create a Langfuse project, install the plugin from the Cursor Marketplace, place API keys in a config file, and restart Cursor. Each trace contains LLM observations with conversation history, tool observations for Shell, Read, and MCP actions, nested subagent observations, and context compaction events, all grouped into sessions. Teams use dashboards to find expensive turns, create project rules, build datasets from real sessions, and apply evaluators (LLM-as-a-judge, human review) to compare cost and completion before deploying, with CI via a GitHub Action.

## Approach / What changed

Install the Langfuse Observability plugin from the Cursor Marketplace, configure API keys in a config file, then use the resulting traces to inspect agent turns, build datasets from real sessions, and run evaluations to compare cost and completion before deploying changes. Optionally integrate the Langfuse skill to let Cursor search traces and set up offline evaluation.

## Takeaways

- The Langfuse Observability plugin captures Cursor agent traces including model calls, tool outputs, token usage, and nested subagent activity, grouping them into sessions by user email.
- ClickHouse in Langfuse v4 stores observations in a wide table that includes user, session, tags, and environment with each observation, avoiding joins for efficient team-wide cost and latency aggregations.
- The evaluation workflow uses dashboards to find expensive turns, creates project rules to reduce repeated failures, builds datasets from real sessions, and applies LLM-as-a-judge or human evaluators to compare cost and completion before shipping.

## FAQ

### How do I set up the Langfuse plugin in Cursor?

Create a Langfuse project, install Langfuse Observability from the Cursor Marketplace, place your public and secret keys in ~/.cursor/langfuse.json, and restart Cursor to start tracing.

### How can I find and fix expensive Cursor turns?

Use the cost dashboard to see spend by developer and model, open expensive turns to inspect repeated file reads and failed shell commands, then create a project rule and build a dataset to evaluate the fix.

### Can I automate evaluation in CI with Langfuse?

Yes, the langfuse/experiment-action GitHub Action fails a job when an evaluation score violates your threshold, integrating offline evaluation before merge.

**Tags:** [Agents](https://yomu.fyi/topic/agents), [ClickHouse](https://yomu.fyi/topic/clickhouse), [Cursor](https://yomu.fyi/topic/cursor), [Langfuse](https://yomu.fyi/topic/langfuse), [Observability](https://yomu.fyi/topic/observability)

- Source: [Clickhouse](https://clickhouse.com/blog/cursor-agents-with-langfuse)
- Source URL: https://clickhouse.com/blog/cursor-agents-with-langfuse
- Ingested by Yomu: 2026-10-21T21:00:12.736Z

[Read original post](https://clickhouse.com/blog/cursor-agents-with-langfuse)
