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.7.1

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.7.1.tar.gz (41.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.7.1-py3-none-any.whl (44.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langfuse_agent-0.7.1.tar.gz
  • Upload date:
  • Size: 41.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.7.1.tar.gz
Algorithm Hash digest
SHA256 e39b8cf5faacc8ed08799c0dc3580fa70494925563b8cc1afffd250adb991674
MD5 3e067c002f0277969f774eedff45ab09
BLAKE2b-256 5e530bfd27b3ecad4adc6f9b4f14a8ce881812c0391a9d1203ede5cd6b43e26f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: langfuse_agent-0.7.1-py3-none-any.whl
  • Upload date:
  • Size: 44.8 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.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8abebd4ae7e6479b442ece0ebf3a547492ba5597bebef58c652e39d9377dc2a2
MD5 30e3ddc69f110d124390ba16dc37849b
BLAKE2b-256 9700788226ffcdc248b6ce7e59b00191c852a5e63c7e195473981b6b713a6f2b

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