# Langfuse MCP for AI Agents AI Agent Connect

> Langfuse (LLM Tracing & Evals) lets you monitor your AI apps in real-time. It connects your AI client to your Langfuse project so you can track traces, manage prompt versions, and audit evaluation scores without jumping between tabs.

## Overview
- **Category:** friends-mcp
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_sTXOynCd5hRTA7WbjY0nBUsTjmjwRIVY989VA7VU/ai-agent-connect
- **Tags:** llm-tracing, prompt-management, evaluation-metrics, token-tracking, ai-analytics, llm-ops

## Description

Connect your Langfuse account to any AI agent and take full control of your LLM observability, prompt management, and quality evaluation through natural conversation. Instead of digging through dashboards to see why a specific AI response failed, you can just ask your agent to find the trace. This Connector bridges the gap between your production logs and your daily workflow. You can pull up the exact payload of a failed chain, check the current version of a prompt template, or see how much your USD spend is spiking today. It turns Langfuse from a passive dashboard into an active workspace. When you find it in the Vinkius catalog, you're getting a way to make LLM observability part of your actual conversation. You can audit scores, find bottlenecks in your spans, and pull session data to see how users are actually interacting with your agents. It moves the heavy lifting of data retrieval into the chat window.

## Tools

### create_score
Attach a 1-5 star rating or automated metric to a trace or observation. This helps you track model quality.

### list_sessions
List high-level user sessions that group multiple traces. This helps you see multi-turn user interactions.

### list_traces
List all traces tracking your LLM API sessions. This gives you a quick overview of all recent AI activity.

### get_trace
Pull the complete telemetry and nested graph for a single trace. This helps you see the exact flow of an AI request.

### get_daily_metrics
Get rolled-up USD costs and aggregated latency statistics. Use this to monitor your daily infrastructure spend.

### create_observation
Add a new LLM observation like a span or event to a trace. This helps you record specific events during a run.

### get_observation
Retrieve specific span or generation context from a trace. It lets you see exactly what happened at a specific step.

### list_observations
List all raw observation objects across different traces. Use this to gather data from multiple runs at once.

### list_prompts
Extract all actively managed prompt templates and versions. This lets you audit your production instructions.

### list_scores
List all explicit scores mapped to quality or cost algorithms. Use this to see how your models are performing over time.

## Prompt Examples

**Prompt:** 
```
Show me the last 3 traces and tell me if any had high latency.
```

**Response:** 
```
I've checked the last 3 traces for you. Here is the summary:

| Trace ID | Status | Latency | Tokens |
| --- | --- | --- | --- |
| `tr_882` | Success | 1.2s | 450 |
| `tr_883` | Success | 2.8s | 1,200 |
| `tr_884` | Error | 0.5s | 120 |

**Note:** Trace `tr_883` shows a latency spike of 2.8s. Would you like me to pull the full telemetry for that one?
```

**Prompt:** 
```
What's our total spend so far today?
```

**Response:** 
```
Your LLM spending for today is currently **$12.45**.

* **Total Tokens:** 45,200
* **Average Latency:** 1.8s
* **Most Expensive Model:** `gpt-4-turbo` ($8.20)

I can provide a breakdown by provider if you need more detail.
```

**Prompt:** 
```
What are the system instructions for the customer support prompt?
```

**Response:** 
```
I've retrieved the instructions for `customer-support-v3`:

> "You are a helpful support agent for TechCorp. Answer queries based on the provided documentation. Be concise and polite."

**Expected Variables:**
* `customer_name`
* `query_text`

Would you like to see the previous versions of this prompt?
```

## Capabilities

### Trace Orchestration
Pull full telemetry and nested graphs for specific AI sessions.

### Prompt Vault Access
Query active prompt templates and their specific versions.

### Observation Analysis
Drill down into individual spans and events within a trace.

### Evaluation & Scoring
Attach human feedback or automated scores to specific traces.

### Usage Metrics
Get rolled-up daily reports on costs and latency.

### Session Monitoring
Extract correlated user sessions to see multi-turn boundaries.

## Use Cases

### Debugging a failed chain
An engineer asks for the last failed trace to see the exact payload and where the logic broke using `get_trace`.

### Cost auditing
A product owner asks for today's total spend and the most expensive model using `get_daily_metrics`.

### Prompt versioning
A data scientist wants to see the system instructions for a specific support prompt using `list_prompts`.

### Quality monitoring
A team wants to see the average score for a specific user interaction using `list_scores`.

## Benefits

- Stop hunting through dashboards by using `list_traces` to find specific AI session data instantly.
- Control your budget with `get_daily_metrics` to see real-time USD costs and latency spikes.
- Improve model accuracy by attaching human feedback via `create_score` to specific traces.
- Manage your prompt library more effectively by querying versions with `list_prompts`.
- Debug complex agentic workflows by inspecting nested graphs with `get_trace`.
- Understand user behavior better by pulling multi-turn boundaries with `list_sessions`.

## How It Works

The bottom line is you get a direct line to your LLM production data without leaving your workspace.

1. Subscribe to the Langfuse MCP on Vinkius.
2. Input your Langfuse API URL, Public Key, and Secret Key.
3. Ask your AI client to pull traces, check costs, or manage prompts.

## Frequently Asked Questions

**How does Langfuse MCP help with LLM costs?**
It lets you query your real-time spending and daily metrics through your AI client. You can see your total USD costs and average latency spikes without having to log into a separate dashboard.

**Can I use Langfuse MCP to see my prompt versions?**
Yes, you can query your prompt vault to see active templates, system instructions, and specific versions. This makes it much easier to audit how your agent's instructions are changing.

**How do I find why my AI agent is hallucinating with Langfuse MCP?**
You can ask your agent to pull the telemetry for a specific failed trace. This shows you the exact payload and nested graph, helping you pinpoint exactly where the logic went off track.

**Does Langfuse MCP track my token usage?**
Yes, it pulls token counts and usage metrics from your traces. You can ask your agent to summarize your token usage or check the costs of specific sessions.

**Can I add human feedback to traces using Langfuse MCP?**
You can attach scores or human feedback to specific traces or observations. This allows you to monitor model grounding and accuracy directly through your AI client.

**What is the best way to monitor multi-turn user sessions with Langfuse MCP?**
You can use the session monitoring tools to extract correlated user sessions. This helps you see the boundaries of multi-turn interactions and understand how users are actually using your agent.

**Can I see the exact system instruction for a specific prompt version?**
Yes. Use the `list_prompts` tool to browse your managed templates. Your agent can retrieve the exact text and variables for any deployed prompt version, making it easy to audit AI logic through natural conversation.

**How do I log human feedback for a specific trace?**
Use the `create_score` tool by providing the Trace ID and a JSON payload defining the score name (e.g. 'user-satisfaction') and value. Your agent will attach this structured data directly to the Langfuse record.

**Can my agent report on my LLM spending for the current day?**
Absolutely. The `get_daily_metrics` tool retrieves aggregated USD costs and average latency metrics from Langfuse. Your agent can summarize these statistics to help you monitor your infrastructure budget in real-time.