Agent for interacting with Langfuse Observability API
Project description
Langfuse Agent
API | MCP | Agent
Version: 1.0.1
Documentation — Installation, deployment, usage across the API, CLI, and MCP interfaces, and guidance for provisioning the Langfuse platform are maintained in the official documentation.
Overview
Langfuse Agent is a production-grade Agent and Model Context Protocol (MCP) server designed to interface directly with the Langfuse LLM Engineering and Observability platform. It enables agentic models to query, create, and manage observability traces, datasets, prompt templates, and system configurations.
Key Features
- Consolidated Action-Routed MCP Tools: Minimizes token overhead and eliminates tool bloat in LLM contexts by grouping 80+ methods into 4 optimized, togglable tool modules.
- Enterprise-Grade Security: Comprehensive support for Eunomia policies, OIDC token delegation, and granular execution context tracking.
- Integrated Graph Agent: Built-in Pydantic AI agent supporting the Agent Control Protocol (ACP) and standard Web interfaces (AG-UI).
- Native Telemetry & Tracing: Out-of-the-box OpenTelemetry exports and native Langfuse tracing tracking every trace and span.
CLI or API
This agent wraps the Langfuse API. You can interact with it programmatically or via its integrated execution entrypoints.
Detailed instructions on how to use the underlying API wrappers, extended schema bindings, and developer SDK references are maintained in docs/index.md.
MCP
This server utilizes dynamic Action-Routed tools to optimize token overhead and maximize IDE compatibility.
Available MCP Tools
Auto-generated — do not edit between the markers below.
Condensed action-routed tools (default — MCP_TOOL_MODE=condensed)
| MCP Tool | Toggle Env Var | Description |
|---|---|---|
langfuse_datasets |
LANGFUSE_DATASETSTOOL |
Perform langfuse_datasets operations. |
langfuse_management |
LANGFUSE_MANAGEMENTTOOL |
Perform langfuse_management operations. |
langfuse_observability |
LANGFUSE_OBSERVABILITYTOOL |
Perform langfuse_observability operations. |
langfuse_prompts_models |
LANGFUSE_PROMPTS_MODELSTOOL |
Perform langfuse_prompts_models operations. |
Verbose 1:1 API-mapped tools (MCP_TOOL_MODE=verbose or both)
87 per-operation tools — one per public API method (click to expand)
| MCP Tool | Toggle Env Var | Description |
|---|---|---|
langfuse_annotation_queues_create_queue |
APITOOL |
Create an annotation queue |
langfuse_annotation_queues_create_queue_assignment |
APITOOL |
Create an assignment for a user to an annotation queue |
langfuse_annotation_queues_create_queue_item |
APITOOL |
Add an item to an annotation queue |
langfuse_annotation_queues_delete_queue_assignment |
APITOOL |
Delete an assignment for a user to an annotation queue |
langfuse_annotation_queues_delete_queue_item |
APITOOL |
Remove an item from an annotation queue |
langfuse_annotation_queues_get_queue |
APITOOL |
Get an annotation queue by ID |
langfuse_annotation_queues_get_queue_item |
APITOOL |
Get a specific item from an annotation queue |
langfuse_annotation_queues_list_queue_items |
APITOOL |
Get items for a specific annotation queue |
langfuse_annotation_queues_list_queues |
APITOOL |
Get all annotation queues |
langfuse_annotation_queues_update_queue_item |
APITOOL |
Update an annotation queue item |
langfuse_blob_storage_integrations_delete_blob_storage_integration |
APITOOL |
Delete a blob storage integration by ID (requires organization-scoped API key) |
langfuse_blob_storage_integrations_get_blob_storage_integration_status |
APITOOL |
Get the sync status of a blob storage integration by integration ID (requires organization-scoped API key) |
langfuse_blob_storage_integrations_get_blob_storage_integrations |
APITOOL |
Get all blob storage integrations for the organization (requires organization-scoped API key) |
langfuse_blob_storage_integrations_upsert_blob_storage_integration |
APITOOL |
Create or update a blob storage integration for a specific project (requires organization-scoped API key). The configuration is validated by performing a test upload to the bucket. |
langfuse_comments_create |
APITOOL |
Create a comment. Comments may be attached to different object types (trace, observation, session, prompt). |
langfuse_comments_get |
APITOOL |
Get all comments |
langfuse_comments_get_by_id |
APITOOL |
Get a comment by id |
langfuse_dataset_items_create |
APITOOL |
Create a dataset item |
langfuse_dataset_items_delete |
APITOOL |
Delete a dataset item and all its run items. This action is irreversible. |
langfuse_dataset_items_get |
APITOOL |
Get a dataset item |
langfuse_dataset_items_list |
APITOOL |
Get dataset items. Optionally specify a version to get the items as they existed at that point in time. Note: If version parameter is provided, datasetName must also be provided. |
langfuse_dataset_run_items_create |
APITOOL |
Create a dataset run item |
langfuse_dataset_run_items_list |
APITOOL |
List dataset run items |
langfuse_datasets_create |
APITOOL |
Create a dataset |
langfuse_datasets_delete_run |
APITOOL |
Delete a dataset run and all its run items. This action is irreversible. |
langfuse_datasets_get |
APITOOL |
Get a dataset |
langfuse_datasets_get_run |
APITOOL |
Get a dataset run and its items |
langfuse_datasets_get_runs |
APITOOL |
Get dataset runs |
langfuse_datasets_list |
APITOOL |
Get all datasets |
langfuse_health_health |
APITOOL |
Check health of API and database |
langfuse_ingestion_batch |
APITOOL |
Legacy endpoint for batch ingestion for Langfuse Observability. -> Please use the OpenTelemetry endpoint (/api/public/otel/v1/traces). Learn more: https://langfuse.com/integrations/native/opentelemetry Within each batch, there can be multiple events. Each event has a type, an id, a timestamp, metadata and a body. Internally, we refer to this as the "event envelope" as it tells us something about the event but not the trace. We use the event id within this envelope to deduplicate messages to avoid processing the same event twice, i.e. the event id should be unique per request. The event.body.id is the ID of the actual trace and will be used for updates and will be visible within the Langfuse App. I.e. if you want to update a trace, you'd use the same body id, but separate event IDs. Notes: - Introduction to data model: https://langfuse.com/docs/observability/data-model - Batch sizes are limited to 3.5 MB in total. You need to adjust the number of events per batch accordingly. - The API does not return a 4xx status code for input errors. Instead, it responds with a 207 status code, which includes a list of the encountered errors. |
langfuse_legacy_metrics_v1_metrics |
APITOOL |
Get metrics from the Langfuse project using a query object. Consider using the v2 metrics endpoint for better performance. For more details, see the Metrics API documentation. |
langfuse_legacy_observations_v1_get |
APITOOL |
Get a observation |
langfuse_legacy_observations_v1_get_many |
APITOOL |
Get a list of observations. Consider using the v2 observations endpoint for cursor-based pagination and field selection. |
langfuse_legacy_score_v1_create |
APITOOL |
Create a score (supports both trace and session scores) |
langfuse_legacy_score_v1_delete |
APITOOL |
Delete a score (supports both trace and session scores) |
langfuse_llm_connections_list |
APITOOL |
Get all LLM connections in a project |
langfuse_llm_connections_upsert |
APITOOL |
Create or update an LLM connection. The connection is upserted on provider. |
langfuse_media_get |
APITOOL |
Get a media record |
langfuse_media_get_upload_url |
APITOOL |
Get a presigned upload URL for a media record |
langfuse_media_patch |
APITOOL |
Patch a media record |
langfuse_metrics_metrics |
APITOOL |
Get metrics from the Langfuse project using a query object. V2 endpoint with optimized performance. ## V2 Differences - Supports observations, scores-numeric, and scores-categorical views only (traces view not supported) - Direct access to tags and release fields on observations - Backwards-compatible: traceName, traceRelease, traceVersion dimensions are still available on observations view - High cardinality dimensions are not supported and will return a 400 error (see below) For more details, see the Metrics API documentation. ## Available Views ### observations Query observation-level data (spans, generations, events). Dimensions: - environment - Deployment environment (e.g., production, staging) - type - Type of observation (SPAN, GENERATION, EVENT) - name - Name of the observation - level - Logging level of the observation - version - Version of the observation - tags - User-defined tags - release - Release version - traceName - Name of the parent trace (backwards-compatible) - traceRelease - Release version of the parent trace (backwards-compatible, maps to release) - traceVersion - Version of the parent trace (backwards-compatible, maps to version) - providedModelName - Name of the model used - promptName - Name of the prompt used - promptVersion - Version of the prompt used - startTimeMonth - Month of start_time in YYYY-MM format Measures: - count - Total number of observations - latency - Observation latency (milliseconds) - streamingLatency - Generation latency from completion start to end (milliseconds) - inputTokens - Sum of input tokens consumed - outputTokens - Sum of output tokens produced - totalTokens - Sum of all tokens consumed - outputTokensPerSecond - Output tokens per second - tokensPerSecond - Total tokens per second - inputCost - Input cost (USD) - outputCost - Output cost (USD) - totalCost - Total cost (USD) - timeToFirstToken - Time to first token (milliseconds) - countScores - Number of scores attached to the observation ### scores-numeric Query numeric and boolean score data. Dimensions: - environment - Deployment environment - name - Name of the score (e.g., accuracy, toxicity) - source - Origin of the score (API, ANNOTATION, EVAL) - dataType - Data type (NUMERIC, BOOLEAN) - configId - Identifier of the score config - timestampMonth - Month in YYYY-MM format - timestampDay - Day in YYYY-MM-DD format - value - Numeric value of the score - traceName - Name of the parent trace - tags - Tags - traceRelease - Release version - traceVersion - Version - observationName - Name of the associated observation - observationModelName - Model name of the associated observation - observationPromptName - Prompt name of the associated observation - observationPromptVersion - Prompt version of the associated observation Measures: - count - Total number of scores - value - Score value (for aggregations) ### scores-categorical Query categorical score data. Same dimensions as scores-numeric except uses stringValue instead of value. Measures: - count - Total number of scores ## High Cardinality Dimensions The following dimensions cannot be used as grouping dimensions in v2 metrics API as they can cause performance issues. Use them in filters instead. observations view: - id - Use traceId filter to narrow down results - traceId - Use traceId filter instead - userId - Use userId filter instead - sessionId - Use sessionId filter instead - parentObservationId - Use parentObservationId filter instead scores-numeric / scores-categorical views: - id - Use specific filters to narrow down results - traceId - Use traceId filter instead - userId - Use userId filter instead - sessionId - Use sessionId filter instead - observationId - Use observationId filter instead ## Aggregations Available aggregation functions: sum, avg, count, max, min, p50, p75, p90, p95, p99, histogram ## Time Granularities Available granularities for timeDimension: auto, minute, hour, day, week, month - auto bins the data into approximately 50 buckets based on the time range |
langfuse_models_create |
APITOOL |
Create a model |
langfuse_models_delete |
APITOOL |
Delete a model. Cannot delete models managed by Langfuse. You can create your own definition with the same modelName to override the definition though. |
langfuse_models_get |
APITOOL |
Get a model |
langfuse_models_list |
APITOOL |
Get all models |
langfuse_observations_get_many |
APITOOL |
Get a list of observations with cursor-based pagination and flexible field selection. ## Cursor-based Pagination This endpoint uses cursor-based pagination for efficient traversal of large datasets. The cursor is returned in the response metadata and should be passed in subsequent requests to retrieve the next page of results. ## Field Selection Use the fields parameter to control which observation fields are returned: - core - Always included: id, traceId, startTime, endTime, projectId, parentObservationId, type - basic - name, level, statusMessage, version, environment, bookmarked, public, userId, sessionId - time - completionStartTime, createdAt, updatedAt - io - input, output - metadata - metadata (truncated to 200 chars by default, use expandMetadata to get full values) - model - providedModelName, internalModelId, modelParameters - usage - usageDetails, costDetails, totalCost - prompt - promptId, promptName, promptVersion - metrics - latency, timeToFirstToken If not specified, core and basic field groups are returned. ## Filters Multiple filtering options are available via query parameters or the structured filter parameter. When using the filter parameter, it takes precedence over individual query parameter filters. |
langfuse_opentelemetry_export_traces |
APITOOL |
OpenTelemetry Traces Ingestion Endpoint This endpoint implements the OTLP/HTTP specification for trace ingestion, providing native OpenTelemetry integration for Langfuse Observability. Supported Formats: - Binary Protobuf: Content-Type: application/x-protobuf - JSON Protobuf: Content-Type: application/json - Supports gzip compression via Content-Encoding: gzip header Specification Compliance: - Conforms to OTLP/HTTP Trace Export - Implements ExportTraceServiceRequest message format Documentation: - Integration guide: https://langfuse.com/integrations/native/opentelemetry - Data model: https://langfuse.com/docs/observability/data-model |
langfuse_organizations_delete_organization_membership |
APITOOL |
Delete a membership from the organization associated with the API key (requires organization-scoped API key) |
langfuse_organizations_delete_project_membership |
APITOOL |
Delete a membership from a specific project (requires organization-scoped API key). The user must be a member of the organization. |
langfuse_organizations_get_organization_api_keys |
APITOOL |
Get all API keys for the organization associated with the API key (requires organization-scoped API key) |
langfuse_organizations_get_organization_memberships |
APITOOL |
Get all memberships for the organization associated with the API key (requires organization-scoped API key) |
langfuse_organizations_get_organization_projects |
APITOOL |
Get all projects for the organization associated with the API key (requires organization-scoped API key) |
langfuse_organizations_get_project_memberships |
APITOOL |
Get all memberships for a specific project (requires organization-scoped API key) |
langfuse_organizations_update_organization_membership |
APITOOL |
Create or update a membership for the organization associated with the API key (requires organization-scoped API key) |
langfuse_organizations_update_project_membership |
APITOOL |
Create or update a membership for a specific project (requires organization-scoped API key). The user must already be a member of the organization. |
langfuse_projects_create |
APITOOL |
Create a new project (requires organization-scoped API key) |
langfuse_projects_create_api_key |
APITOOL |
Create a new API key for a project (requires organization-scoped API key) |
langfuse_projects_delete |
APITOOL |
Delete a project by ID (requires organization-scoped API key). Project deletion is processed asynchronously. |
langfuse_projects_delete_api_key |
APITOOL |
Delete an API key for a project (requires organization-scoped API key) |
langfuse_projects_get |
APITOOL |
Get Project associated with API key (requires project-scoped API key). You can use GET /api/public/organizations/projects to get all projects with an organization-scoped key. |
langfuse_projects_get_api_keys |
APITOOL |
Get all API keys for a project (requires organization-scoped API key) |
langfuse_projects_update |
APITOOL |
Update a project by ID (requires organization-scoped API key). |
langfuse_prompt_version_update |
APITOOL |
Update labels for a specific prompt version |
langfuse_prompts_create |
APITOOL |
Create a new version for the prompt with the given name |
langfuse_prompts_delete |
APITOOL |
Delete prompt versions. If neither version nor label is specified, all versions of the prompt are deleted. |
langfuse_prompts_get |
APITOOL |
Get a prompt |
langfuse_prompts_list |
APITOOL |
Get a list of prompt names with versions and labels |
langfuse_scim_create_user |
APITOOL |
Create a new user in the organization (requires organization-scoped API key) |
langfuse_scim_delete_user |
APITOOL |
Remove a user from the organization (requires organization-scoped API key). Note that this only removes the user from the organization but does not delete the user entity itself. |
langfuse_scim_get_resource_types |
APITOOL |
Get SCIM Resource Types (requires organization-scoped API key) |
langfuse_scim_get_schemas |
APITOOL |
Get SCIM Schemas (requires organization-scoped API key) |
langfuse_scim_get_service_provider_config |
APITOOL |
Get SCIM Service Provider Configuration (requires organization-scoped API key) |
langfuse_scim_get_user |
APITOOL |
Get a specific user by ID (requires organization-scoped API key) |
langfuse_scim_list_users |
APITOOL |
List users in the organization (requires organization-scoped API key) |
langfuse_score_configs_create |
APITOOL |
Create a score configuration (config). Score configs are used to define the structure of scores |
langfuse_score_configs_get |
APITOOL |
Get all score configs |
langfuse_score_configs_get_by_id |
APITOOL |
Get a score config |
langfuse_score_configs_update |
APITOOL |
Update a score config |
langfuse_scores_get_by_id |
APITOOL |
Get a score (supports both trace and session scores) |
langfuse_scores_get_many |
APITOOL |
Get a list of scores (supports both trace and session scores) |
langfuse_sessions_get |
APITOOL |
Get a session. Please note that traces on this endpoint are not paginated, if you plan to fetch large sessions, consider GET /api/public/traces?sessionId=<sessionId> |
langfuse_sessions_list |
APITOOL |
Get sessions |
langfuse_trace_delete |
APITOOL |
Delete a specific trace |
langfuse_trace_delete_multiple |
APITOOL |
Delete multiple traces |
langfuse_trace_get |
APITOOL |
Get a specific trace |
langfuse_trace_list |
APITOOL |
Get list of traces |
4 action-routed tool(s) (default) · 87 verbose 1:1 tool(s). Each is enabled unless its <DOMAIN>TOOL toggle is set false; MCP_TOOL_MODE selects the surface (condensed default · verbose 1:1 · both). Auto-generated — do not edit.
Detailed tool schemas, parameter shapes, and validation constraints are preserved in docs/mcp.md.
Dynamic Tool Selection & Visibility
This MCP server supports dynamic toolset selection and visibility filtering at runtime. This allows you to restrict the set of exposed tools in order to prevent blowing up the LLM's context window.
You can configure tool filtering via multiple input channels:
- CLI Arguments: Pass
--toolsor--toolsets(or their disabled counterparts--disabled-toolsand--disabled-toolsets) during startup. - Environment Variables: Define standard environment variables:
MCP_ENABLED_TOOLS/MCP_DISABLED_TOOLSMCP_ENABLED_TAGS/MCP_DISABLED_TAGS
- HTTP SSE Request Headers: Pass custom headers during transport initialization:
x-mcp-enabled-tools/x-mcp-disabled-toolsx-mcp-enabled-tags/x-mcp-disabled-tags
- HTTP SSE Request Query Parameters: Append query parameters directly to your transport connection URL:
?tools=tool1,tool2?tags=tag1
When query strings or parameters are supplied, an LLM-free Knowledge Graph resolution layer (using DynamicToolOrchestrator) matches query intents against known tool tags, names, or descriptions, with safe fallback and automated 24-hour background cache refreshing.
MCP Configuration Examples
Install the slim
[mcp]extra. All examples installlangfuse-agent[mcp]— the MCP-server extra that pulls only the FastMCP / FastAPI tooling (agent-utilities[mcp]). It deliberately excludes the heavy agent runtime (pydantic-ai, the epistemic-graph engine,dspy,llama-index), souvx/ container installs are far smaller. Use the full[agent]extra only when you need the integrated Pydantic AI agent.
stdio Transport (local IDEs — Cursor, Claude Desktop, VS Code)
{
"mcpServers": {
"langfuse-mcp": {
"command": "uvx",
"args": [
"--from",
"langfuse-agent[mcp]",
"langfuse-mcp"
],
"env": {
"MCP_TOOL_MODE": "condensed",
"LANGFUSE_BASE_URL": "http://localhost:8080",
"LANGFUSE_DATASETSTOOL": "True",
"LANGFUSE_MANAGEMENTTOOL": "True",
"LANGFUSE_OBSERVABILITYTOOL": "True",
"LANGFUSE_PROMPTS_MODELSTOOL": "True",
"LANGFUSE_PUBLIC_KEY": "your_public_key_here",
"LANGFUSE_SECRET_KEY": "your_secret_key_here"
}
}
}
}
Streamable-HTTP Transport (networked / production)
{
"mcpServers": {
"langfuse-mcp": {
"command": "uvx",
"args": [
"--from",
"langfuse-agent[mcp]",
"langfuse-mcp",
"--transport",
"streamable-http",
"--port",
"8000"
],
"env": {
"TRANSPORT": "streamable-http",
"HOST": "0.0.0.0",
"PORT": "8000",
"MCP_TOOL_MODE": "condensed",
"LANGFUSE_BASE_URL": "http://localhost:8080",
"LANGFUSE_DATASETSTOOL": "True",
"LANGFUSE_MANAGEMENTTOOL": "True",
"LANGFUSE_OBSERVABILITYTOOL": "True",
"LANGFUSE_PROMPTS_MODELSTOOL": "True",
"LANGFUSE_PUBLIC_KEY": "your_public_key_here",
"LANGFUSE_SECRET_KEY": "your_secret_key_here"
}
}
}
}
Alternatively, connect to a pre-deployed Streamable-HTTP instance by url:
{
"mcpServers": {
"langfuse-mcp": {
"url": "http://localhost:8000/langfuse-mcp/mcp"
}
}
}
Deploying the Streamable-HTTP server via Docker:
docker run -d \
--name langfuse-mcp-mcp \
-p 8000:8000 \
-e TRANSPORT=streamable-http \
-e HOST=0.0.0.0 \
-e PORT=8000 \
-e MCP_TOOL_MODE=condensed \
-e LANGFUSE_BASE_URL=http://localhost:8080 \
-e LANGFUSE_DATASETSTOOL=True \
-e LANGFUSE_MANAGEMENTTOOL=True \
-e LANGFUSE_OBSERVABILITYTOOL=True \
-e LANGFUSE_PROMPTS_MODELSTOOL=True \
-e LANGFUSE_PUBLIC_KEY=your_public_key_here \
-e LANGFUSE_SECRET_KEY=your_secret_key_here \
knucklessg1/langfuse-agent:mcp
Auto-generated from the code-read env surface (MCP_TOOL_MODE + package vars) — do not edit.
Additional Deployment Options
langfuse-agent can also run as a local container (Docker / Podman / uv) or be
consumed from a remote deployment. The
Deployment guide has full, copy-paste
mcp_config.json for all four transports — stdio, streamable-http,
local container / uv, and remote URL:
- Local container / uv — launch the server from
mcp_config.jsonviauvx,docker run, orpodman run, or point at a local streamable-http container byurl. - Remote URL — connect to a server deployed behind Caddy at
http://langfuse-mcp.arpa/mcpusing the"url"key.
Agent
This repository features a fully integrated Pydantic AI Graph Agent. It communicates over the Agent Control Protocol (ACP) and interacts seamlessly with the Agent Web UI (AG-UI) and Terminal interface.
Running the Agent CLI
To start the interactive command-line agent:
# Set credentials
export LANGFUSE_BASE_URL="http://localhost:8080"
export LANGFUSE_PUBLIC_KEY="pk-lf-..."
export LANGFUSE_SECRET_KEY="sk-lf-..."
# Run the agent server
langfuse-agent --provider openai --model-id gpt-4o
Docker Compose Orchestration
The following docker/agent.compose.yml configures the Agent, Web UI, and Terminal Interface together:
version: '3.8'
services:
langfuse-agent-mcp:
image: knucklessg1/langfuse-agent:mcp
container_name: langfuse-agent-mcp
hostname: langfuse-agent-mcp
restart: always
env_file:
- ../.env
environment:
- PYTHONUNBUFFERED=1
- HOST=0.0.0.0
- PORT=8004
- TRANSPORT=streamable-http
ports:
- "8004:8004"
healthcheck:
test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8004/health')"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
langfuse-agent-agent:
image: knucklessg1/langfuse-agent:latest
container_name: langfuse-agent-agent
hostname: langfuse-agent-agent
restart: always
depends_on:
- langfuse-agent-mcp
env_file:
- ../.env
command: [ "langfuse-agent" ]
environment:
- PYTHONUNBUFFERED=1
- HOST=0.0.0.0
- PORT=9004
- MCP_URL=http://langfuse-agent-mcp:8004/mcp
- PROVIDER=${PROVIDER:-openai}
- MODEL_ID=${MODEL_ID:-gpt-4o}
- ENABLE_WEB_UI=True
- ENABLE_OTEL=True
ports:
- "9004:9004"
healthcheck:
test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:9004/health')"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
Detailed graph node architecture explanations, custom skill configurations, and agentic trace guides are available in docs/agent.md.
Security & Governance
Built directly upon the enterprise-ready agent-utilities core, standard security parameters are fully supported:
Access Control & Policy Enforcement
- Eunomia Policies: Fine-grained, policy-driven tool authorization. Supports
none, localembedded(mcp_policies.json), or centralizedremotemodes. - OIDC Token Delegation: Compliant with RFC 8693 token exchange for flowing authenticating user credentials from Web UI / ACP → Agent → MCP.
- Scoped Credentials: Execution context runs restricted to the specific caller identity.
Runtime Security Grid
| Feature | Functionality | Enablement |
|---|---|---|
| Tool Guard | Sensitivity inspection with human-in-the-loop validation | Enabled by default |
| Prompt Injection Defense | Input scanning, repetition monitoring, and recursive loop blocks | Enabled by default |
| Context Safety Guard | Stuck-loop detectors and contextual overflow preemptive alerts | Enabled by default |
Configuration & Environment Variables
The agent can be fully configured using environment variables or a .env file. Below is the list of all supported variables:
Core API & Credentials
| Variable | Description | Default |
|---|---|---|
LANGFUSE_BASE_URL |
Langfuse instance base URL (legacy alias: LANGFUSE_HOST). |
https://cloud.langfuse.com |
LANGFUSE_PUBLIC_KEY |
Langfuse public API key. | "" |
LANGFUSE_SECRET_KEY |
Langfuse secret API key. | "" |
Server Configuration
| Variable | Description | Default |
|---|---|---|
HOST |
The hostname/address the server binds to. | 0.0.0.0 |
PORT |
The port the server listens on. | 8004 |
TRANSPORT |
The communication protocol (stdio, streamable-http, sse). |
stdio |
AUTH_TYPE |
Server authentication strategy (key, delegated, none). |
key |
Agent Customization
| Variable | Description | Default |
|---|---|---|
DEFAULT_AGENT_NAME |
Custom name displayed for the Pydantic AI Graph Agent. | "Langfuse Agent" |
AGENT_DESCRIPTION |
Short description of the agent's responsibilities. | "AI agent for Langfuse Agent operations." |
AGENT_SYSTEM_PROMPT |
Custom system instructions override for the agent. | "" |
Tool Toggle Switches
Individual tool modules can be enabled or disabled to minimize client context size. These names match the authoritative "Toggle Env Var" column in the Available MCP Tools table above:
LANGFUSE_OBSERVABILITYTOOL(Default:True): Toggles observation/tracing tools.LANGFUSE_DATASETSTOOL(Default:True): Toggles datasets and annotation queue tools.LANGFUSE_PROMPTS_MODELSTOOL(Default:True): Toggles prompt template and model connectivity tools.LANGFUSE_MANAGEMENTTOOL(Default:True): Toggles comments, SCIM, and project management tools.
Installation
Pick the extra that matches what you want to run:
| Extra | Installs | Use when |
|---|---|---|
langfuse-agent[mcp] |
Slim MCP server only (agent-utilities[mcp] — FastMCP/FastAPI) |
You only run the MCP server (smallest install / image) |
langfuse-agent[agent] |
Full agent runtime (agent-utilities[agent,logfire] — Pydantic AI + the epistemic-graph engine) |
You run the integrated agent |
langfuse-agent[all] |
Everything (mcp + agent + logfire) |
Development / both surfaces |
# MCP server only (recommended for tool hosting — slim deps)
uv pip install "langfuse-agent[mcp]"
# Full agent runtime (Pydantic AI + epistemic-graph engine)
uv pip install "langfuse-agent[agent]"
# Everything (development)
uv pip install "langfuse-agent[all]" # or: python -m pip install "langfuse-agent[all]"
Container images (:mcp vs :agent)
One multi-stage docker/Dockerfile builds two right-sized images, selected by --target:
| Image tag | Build target | Contents | Entrypoint |
|---|---|---|---|
knucklessg1/langfuse-agent:mcp |
--target mcp |
langfuse-agent[mcp] — slim, no engine/pydantic-ai/dspy/llama-index/tree-sitter |
langfuse-mcp |
knucklessg1/langfuse-agent:latest |
--target agent (default) |
langfuse-agent[agent] — full agent runtime + epistemic-graph engine |
langfuse-agent |
docker build --target mcp -t knucklessg1/langfuse-agent:mcp docker/ # slim MCP server
docker build --target agent -t knucklessg1/langfuse-agent:latest docker/ # full agent
Knowledge-graph database (epistemic-graph)
The full agent ([agent] / :latest) embeds the epistemic-graph engine (pulled in
transitively via agent-utilities[agent]). For production — or to share one knowledge graph
across multiple agents — run epistemic-graph as its own database container and point the
agent at it instead of embedding it. Deployment recipes (single-node + Raft HA), connection
config, and the full database architecture (with diagrams) are documented in the
epistemic-graph deployment guide.
The slim [mcp] server does not require the database.
Documentation
The complete documentation is published as the official documentation site and is the recommended reference for installation, deployment, and day-to-day operation.
| Page | Contents |
|---|---|
| Installation | pip, source, extras, prebuilt Docker image |
| Deployment | run the MCP and agent servers, Compose, Caddy + Technitium, env config |
| Usage | the MCP tools, the LangfuseApi client, the CLI |
| Backing Platform | deploy Langfuse with Docker |
| Overview | the full tool surface and ecosystem role |
| Concepts | concept registry (CONCEPT:LF-*) |
Repository Owners
Contribute
Contributions are welcome! Please ensure code quality by executing local checks before submitting pull requests:
- Format code using
ruff format . - Lint code using
ruff check . - Validate type-safety with
mypy . - Execute test suites using
pytest
Deploy with agent-os-genesis
This package can be provisioned for you — skill-guided — by the agent-os-genesis
universal skill (its single-package deploy mode): it picks your install method, seeds
secrets to OpenBao/Vault (or .env), trusts your enterprise CA, registers the MCP
server, and verifies it — the same machinery that stands up the whole Agent OS, narrowed
to just this package. Ask your agent to "deploy langfuse-agent with agent-os-genesis".
| Install mode | Command |
|---|---|
| Bare-metal, prod (PyPI) | uvx langfuse-mcp · or uv tool install langfuse-agent |
| Bare-metal, dev (editable) | uv pip install -e ".[all]" · or pip install -e ".[all]" |
| Container, prod | deploy knucklessg1/langfuse-agent:latest via docker-compose / swarm / podman / podman-compose / kubernetes |
| Container, dev (editable) | deploy docker/compose.dev.yml (source-mounted at /src; edits live on restart) |
Secrets are read-existing + seeded via vault_sync — you are only prompted for what's missing.
Environment Variables
Package environment variables
| Variable | Example | Description |
|---|---|---|
HOST |
0.0.0.0 |
|
PORT |
8004 |
|
TRANSPORT |
stdio |
options: stdio, streamable-http, sse |
ENABLE_OTEL |
True |
|
OTEL_EXPORTER_OTLP_ENDPOINT |
http://localhost:8080/api/public/otel |
|
OTEL_EXPORTER_OTLP_PUBLIC_KEY |
pk-... |
|
OTEL_EXPORTER_OTLP_SECRET_KEY |
sk-... |
|
OTEL_EXPORTER_OTLP_PROTOCOL |
http/protobuf |
|
EUNOMIA_TYPE |
none |
options: none, embedded, remote |
EUNOMIA_POLICY_FILE |
mcp_policies.json |
|
EUNOMIA_REMOTE_URL |
http://eunomia-server:8000 |
|
LANGFUSE_BASE_URL |
http://localhost:8080 |
|
LANGFUSE_PUBLIC_KEY |
your_public_key_here |
|
LANGFUSE_SECRET_KEY |
your_secret_key_here |
|
AUTH_TYPE |
key |
options: key, delegated, none |
DEFAULT_AGENT_NAME |
"Langfuse Agent" |
|
AGENT_DESCRIPTION |
"AI agent for Langfuse Agent operations." |
|
AGENT_SYSTEM_PROMPT |
"" |
|
MCP_TOOL_MODE |
condensed |
action-routed tools) |
LANGFUSE_OBSERVABILITYTOOL |
True |
MCP tools table (condensed action-routed surface). |
LANGFUSE_DATASETSTOOL |
True |
|
LANGFUSE_PROMPTS_MODELSTOOL |
True |
|
LANGFUSE_MANAGEMENTTOOL |
True |
Inherited agent-utilities variables (apply to every connector)
| Variable | Example | Description |
|---|---|---|
MCP_ENABLED_TOOLS |
— | Comma-separated tool allow-list |
MCP_DISABLED_TOOLS |
— | Comma-separated tool deny-list |
MCP_ENABLED_TAGS |
— | Comma-separated tag allow-list |
MCP_DISABLED_TAGS |
— | Comma-separated tag deny-list |
MCP_CLIENT_AUTH |
— | Outbound MCP auth (oidc-client-credentials for fleet calls) |
OIDC_CLIENT_ID |
— | OIDC client id (service-account auth) |
OIDC_CLIENT_SECRET |
— | OIDC client secret (service-account auth) |
DEBUG |
False |
Verbose logging |
PYTHONUNBUFFERED |
1 |
Unbuffered stdout (recommended in containers) |
MCP_URL |
http://localhost:8000/mcp |
URL of the MCP server the agent connects to |
PROVIDER |
openai |
LLM provider for the agent |
MODEL_ID |
gpt-4o |
Model id for the agent |
ENABLE_WEB_UI |
True |
Serve the AG-UI web interface |
23 package + 13 inherited variable(s). Auto-generated from .env.example + the shared agent-utilities set — do not edit.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langfuse_agent-1.0.1.tar.gz.
File metadata
- Download URL: langfuse_agent-1.0.1.tar.gz
- Upload date:
- Size: 78.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04e930a6c81fd30e3d17e06c27ebf77bd2491313fb7a78f084fbe2f4419223c7
|
|
| MD5 |
792e7319988dd1ddb045f7a290c9244e
|
|
| BLAKE2b-256 |
210ac1f21bb3204906e2caf84191f7e703f50aa77d0891e24c2d3eaf28b938bc
|
File details
Details for the file langfuse_agent-1.0.1-py3-none-any.whl.
File metadata
- Download URL: langfuse_agent-1.0.1-py3-none-any.whl
- Upload date:
- Size: 69.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0181ddf5359722c4f5bde21600d592b17b753887face2895f9e75b9cec9ffbdb
|
|
| MD5 |
40222c939c37773a9f5922f3eebe31b9
|
|
| BLAKE2b-256 |
b87083c03522fdada121d0996569d2060528220ccf7382890cbbcef4e9d5d9f4
|