---
title: "Trace and evaluate Cursor agents with Langfuse, powered by ClickHouse"
description: "The Langfuse Observability plugin for Cursor captures each agent prompt as a `Cursor Turn` trace containing LLM observations, tool executions, subagents and token usage, stored in a wide ClickHouse observations table that avoids trace/observation joins for cost and latency aggregation."
url: "https://swe.quest/articles/trace-and-evaluate-cursor-agents-with-langfuse-powered-by-clickhouse-b04d90713d1833e1"
canonical: "https://clickhouse.com/blog/cursor-agents-with-langfuse"
source: "ClickHouse"
published: "2026-10-22"
difficulty: "medium"
kind: "How-to"
reading_minutes: 5
tags: ["ai-coding","observability","evals","ai-agents"]
---

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

A post on [ClickHouse](https://swe.quest/sources/clickhouse.md), published 2026-10-22, 5 min read, How-to. Original: [https://clickhouse.com/blog/cursor-agents-with-langfuse](https://clickhouse.com/blog/cursor-agents-with-langfuse)

## Summary

The Langfuse Observability plugin for Cursor captures each agent prompt as a \`Cursor Turn\` trace containing LLM observations, tool executions, subagents and token usage, stored in a wide ClickHouse observations table that avoids trace/observation joins for cost and latency aggregation. Setup is a Marketplace install plus a \`~/.cursor/langfuse.json\` key file. File-content capture is off by default, and because Cursor reports tokens once per turn, cost should be read from the trace total. A worked loop shows finding expensive turns caused by repeated file reads and retried shell commands, fixing them with a project rule, and validating the fix with dataset-based evaluations, which can also gate CI via a GitHub Action.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [AI for coding](https://swe.quest/tags/ai-coding.md) (AI & ML)
- [Observability](https://swe.quest/tags/observability.md) (Reliability & operations)
- [Evaluation](https://swe.quest/tags/evals.md) (AI & ML)
- [AI agents](https://swe.quest/tags/ai-agents.md) (AI & ML)

## Prerequisites

- Cursor IDE agents ([easy posts on Developer tools](https://swe.quest/tags/developer-tools.md?difficulty=easy))
- LLM tracing concepts ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))

## Keywords

Langfuse, Cursor, ClickHouse, Langfuse Metrics API v2, MCP, LLM-as-a-judge

## Related posts

- [Search agent traces by behavior with AI Search in LangSmith](https://swe.quest/articles/search-agent-traces-by-behavior-with-ai-search-in-langsmith-b56f880ffba2ede5.md): LangChain · 2026-10-13 · Medium · 7 min read · Observability, AI agents, LLMs, Search
  LangSmith's AI Search lets users find agent traces by behavior described in plain language (e.g. "did PII leak?", "did the user get frustrated?") by running a fast decision model over each candidate trace rather than relying on lossy embedding-based vector search.
- [Tracing OpenAI agents with ClickStack](https://swe.quest/articles/tracing-openai-agents-with-clickstack-27a1630cee998ca8.md): ClickHouse · 2025-10-27 · Medium · 13 min read · Observability, AI agents, Python, Analytics & OLAP
  OpenAI's agents SDK has built-in tracing that can be redirected from OpenAI's hosted product to a custom TracingExporter.
- [Trace & Evaluate your Agent with Arize Phoenix](https://swe.quest/articles/trace-evaluate-your-agent-with-arize-phoenix-ea5d226abd11d54e.md): Hugging Face · 2025-02-28 · Medium · 6 min read · AI agents, Evaluation, Observability, LLMs, Python
  A smolagents CodeAgent with DuckDuckGo search and webpage tools can be instrumented with OpenTelemetry and OpenInference so every agent call is traced in a local or hosted Arize Phoenix instance.
- [Agentic coding with ClickHouse. One person, one data stack, one full-stack application](https://swe.quest/articles/agentic-coding-with-clickhouse-one-person-one-data-stack-one-full-stack-ca4c2d9fd47cef68.md): ClickHouse · 2026-04-14 · Easy · 13 min read · AI for coding, Analytics & OLAP, Observability, AI agents
  A ClickHouse Solutions Architect with no frontend or backend background built ClickShop, a full-stack retail analytics demo, in a couple of days using Cursor.
- [Give Your Coding Agents a Memory You Own](https://swe.quest/articles/give-your-coding-agents-a-memory-you-own-a4b8ff1b9b62d4a5.md): Hugging Face · 2026-09-03 · Medium · 9 min read · AI agents, AI for coding, RAG & retrieval, Search, Developer tools
  funes is an open-source, single-binary memory layer that indexes the session traces of coding agents (Claude Code, Codex, pi, Hermes) so any agent can recall past decisions and rationale with exact provenance.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
