Skip to main content

Agent for interacting with Langfuse Observability API

Project description

Langfuse Agent - A2A | AG-UI | MCP

PyPI - Version MCP Server PyPI - Downloads GitHub Repo stars GitHub forks GitHub contributors PyPI - License GitHub

GitHub last commit (by committer) GitHub pull requests GitHub closed pull requests GitHub issues

GitHub top language GitHub language count GitHub repo size GitHub repo file count (file type) PyPI - Wheel PyPI - Implementation

Version: 0.9.0

Overview

Langfuse Agent MCP Server + A2A Agent

Agent for interacting with Langfuse Observability API

This repository is actively maintained - Contributions are welcome!

MCP

Available MCP Tools

The MCP server provides 87 tools across 26 categories:

  • Annotation Queues: List, create, get, update, delete queues and items
  • Blob Storage Integrations: Get, upsert, check status, delete integrations
  • Comments: Create, get comments
  • Dataset Items: Create, list, get, delete dataset items
  • Dataset Run Items: Create, list dataset run items
  • Datasets: List, create, get, delete runs, get runs
  • Health: Health check
  • Ingestion: Batch ingestion
  • Legacy Metrics: V1 metrics
  • Legacy Observations: V1 get observations
  • Legacy Score: V1 create/delete scores
  • LLM Connections: List, upsert connections
  • Media: Get, patch, get upload URL
  • Metrics: Metrics query
  • Models: Create, list, get, delete models
  • Observations: Get many observations
  • OpenTelemetry: Export traces
  • Organizations: Manage organization and project memberships
  • Projects: Get, create, update, delete projects and API keys
  • Prompts: Version update, get, delete, list, create prompts
  • SCIM: Service provider config, resource types, schemas, user management
  • Score Configs: Create, get, update score configs
  • Scores: Get many scores, get by ID
  • Sessions: List, get sessions
  • Traces: Get, delete, list, delete multiple traces

Using as an MCP Server

The MCP Server can be run in two modes: stdio (for local testing) or http (for networked access).

Environment Variables

  • LANGFUSE_URL: The URL of the target service.
  • LANGFUSE_TOKEN: The API token or access token.

Run in stdio mode (default):

export LANGFUSE_URL="http://localhost:8080"
export LANGFUSE_TOKEN="your_token"
langfuse-mcp --transport "stdio"

Run in HTTP mode:

export LANGFUSE_URL="http://localhost:8080"
export LANGFUSE_TOKEN="your_token"
langfuse-mcp --transport "http" --host "0.0.0.0" --port "8000"

A2A Agent

Run A2A Server

export LANGFUSE_URL="http://localhost:8080"
export LANGFUSE_TOKEN="your_token"
langfuse-agent --provider openai --model-id gpt-4o --api-key sk-...

The A2A agent uses agent-utilities for:

  • Auto-discovery of MCP tools from mcp_config.json
  • Pydantic AI agent with graph-based routing
  • Web UI support
  • OpenTelemetry integration
  • Custom skills support

Docker

Build

docker build -t langfuse-agent .

Run MCP Server

docker run -d \
  --name langfuse-agent \
  -p 8000:8000 \
  -e TRANSPORT=http \
  -e LANGFUSE_URL="http://your-service:8080" \
  -e LANGFUSE_TOKEN="your_token" \
  knucklessg1/langfuse-agent:latest

Deploy with Docker Compose

services:
  langfuse-agent:
    image: knucklessg1/langfuse-agent:latest
    environment:
      - HOST=0.0.0.0
      - PORT=8000
      - TRANSPORT=http
      - LANGFUSE_URL=http://your-service:8080
      - LANGFUSE_TOKEN=your_token
    ports:
      - 8000:8000

Configure mcp.json for AI Integration (e.g. Claude Desktop)

{
  "mcpServers": {
    "langfuse": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "langfuse-agent",
        "langfuse-mcp"
      ],
      "env": {
        "LANGFUSE_URL": "http://your-service:8080",
        "LANGFUSE_TOKEN": "your_token"
      }
    }
  }
}

Install Python Package

python -m pip install langfuse-agent
uv pip install langfuse-agent

Repository Owners

GitHub followers GitHub User's stars

MCP Configuration Examples

1. Standard IO (stdio) Deployment

{
  "mcpServers": {
    "langfuse-agent": {
      "command": "uv",
      "args": [
        "run",
        "langfuse-mcp"
      ],
      "env": {
        "AGENT_DESCRIPTION": "<YOUR_AGENT_DESCRIPTION>",
        "AGENT_SYSTEM_PROMPT": "<YOUR_AGENT_SYSTEM_PROMPT>",
        "ANNOTATION_QUEUES_TOOL": "True",
        "BLOB_STORAGE_INTEGRATIONS_TOOL": "True",
        "COMMENTS_TOOL": "True",
        "DATASETS_TOOL": "True",
        "DATASET_ITEMS_TOOL": "True",
        "DATASET_RUN_ITEMS_TOOL": "True",
        "DEFAULT_AGENT_NAME": "<YOUR_DEFAULT_AGENT_NAME>",
        "HEALTH_TOOL": "True",
        "INGESTION_TOOL": "True",
        "LANGFUSE_HOST": "<YOUR_LANGFUSE_HOST>",
        "LANGFUSE_PUBLIC_KEY": "<YOUR_LANGFUSE_PUBLIC_KEY>",
        "LANGFUSE_SECRET_KEY": "<YOUR_LANGFUSE_SECRET_KEY>",
        "LEGACY_METRICS_V1_TOOL": "True",
        "LEGACY_OBSERVATIONS_V1_TOOL": "True",
        "LEGACY_SCORE_V1_TOOL": "True",
        "LLM_CONNECTIONS_TOOL": "True",
        "MEDIA_TOOL": "True",
        "METRICS_TOOL": "True",
        "MODELS_TOOL": "True",
        "OBSERVATIONS_TOOL": "True",
        "OPENTELEMETRY_TOOL": "True",
        "ORGANIZATIONS_TOOL": "True",
        "PROJECTS_TOOL": "True",
        "PROMPTS_TOOL": "True",
        "PROMPT_VERSION_TOOL": "True",
        "SCIM_TOOL": "True",
        "SCORES_TOOL": "True",
        "SCORE_CONFIGS_TOOL": "True",
        "SESSIONS_TOOL": "True",
        "TRACE_TOOL": "True"
      }
    }
  }
}

2. Streamable HTTP (SSE) Deployment

{
  "mcpServers": {
    "langfuse-agent": {
      "command": "uv",
      "args": [
        "run",
        "langfuse-mcp",
        "--transport",
        "http",
        "--host",
        "0.0.0.0",
        "--port",
        "8000"
      ],
      "env": {
        "AGENT_DESCRIPTION": "<YOUR_AGENT_DESCRIPTION>",
        "AGENT_SYSTEM_PROMPT": "<YOUR_AGENT_SYSTEM_PROMPT>",
        "ANNOTATION_QUEUES_TOOL": "True",
        "BLOB_STORAGE_INTEGRATIONS_TOOL": "True",
        "COMMENTS_TOOL": "True",
        "DATASETS_TOOL": "True",
        "DATASET_ITEMS_TOOL": "True",
        "DATASET_RUN_ITEMS_TOOL": "True",
        "DEFAULT_AGENT_NAME": "<YOUR_DEFAULT_AGENT_NAME>",
        "HEALTH_TOOL": "True",
        "INGESTION_TOOL": "True",
        "LANGFUSE_HOST": "<YOUR_LANGFUSE_HOST>",
        "LANGFUSE_PUBLIC_KEY": "<YOUR_LANGFUSE_PUBLIC_KEY>",
        "LANGFUSE_SECRET_KEY": "<YOUR_LANGFUSE_SECRET_KEY>",
        "LEGACY_METRICS_V1_TOOL": "True",
        "LEGACY_OBSERVATIONS_V1_TOOL": "True",
        "LEGACY_SCORE_V1_TOOL": "True",
        "LLM_CONNECTIONS_TOOL": "True",
        "MEDIA_TOOL": "True",
        "METRICS_TOOL": "True",
        "MODELS_TOOL": "True",
        "OBSERVATIONS_TOOL": "True",
        "OPENTELEMETRY_TOOL": "True",
        "ORGANIZATIONS_TOOL": "True",
        "PROJECTS_TOOL": "True",
        "PROMPTS_TOOL": "True",
        "PROMPT_VERSION_TOOL": "True",
        "SCIM_TOOL": "True",
        "SCORES_TOOL": "True",
        "SCORE_CONFIGS_TOOL": "True",
        "SESSIONS_TOOL": "True",
        "TRACE_TOOL": "True"
      }
    }
  }
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langfuse_agent-0.9.0.tar.gz (42.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langfuse_agent-0.9.0-py3-none-any.whl (46.1 kB view details)

Uploaded Python 3

File details

Details for the file langfuse_agent-0.9.0.tar.gz.

File metadata

  • Download URL: langfuse_agent-0.9.0.tar.gz
  • Upload date:
  • Size: 42.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for langfuse_agent-0.9.0.tar.gz
Algorithm Hash digest
SHA256 ff7e357a3ad7180a115c9609d3765f72f2da8f366c5bfdf1e540a28d3bb7268e
MD5 7d2571d85c271f43204a708d425a1ed7
BLAKE2b-256 31ec3136eb0bee927b393d4ea43662287439ca5b5cafcae773959a2b8758cf91

See more details on using hashes here.

File details

Details for the file langfuse_agent-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: langfuse_agent-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 46.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for langfuse_agent-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e855649f4a6ccfb1a8d16c1f7c0cf06de951af8b143009df95662f9c2d6f987a
MD5 1d3675e2a97a26332c4ad65537f6eb6c
BLAKE2b-256 deea018a76bbaa5ca5f53ec454fe5f2c10aac37225ce9c70f109d1d4465e54d4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page