{"id":50567178,"url":"https://github.com/knuckles-team/langfuse-agent","last_synced_at":"2026-06-04T16:00:23.696Z","repository":{"id":351957621,"uuid":"1195080199","full_name":"Knuckles-Team/langfuse-agent","owner":"Knuckles-Team","description":"Langfuse Agent loads Langfuse MCP and Pydantic Graph","archived":false,"fork":false,"pushed_at":"2026-06-04T13:55:44.000Z","size":1886,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-04T16:00:21.864Z","etag":null,"topics":["a2a","a2a-server","ag-ui","langfuse","mcp-server","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Knuckles-Team.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-03-29T07:29:52.000Z","updated_at":"2026-06-04T13:54:19.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/Knuckles-Team/langfuse-agent","commit_stats":null,"previous_names":["knuckles-team/langfuse-agent"],"tags_count":36,"template":false,"template_full_name":null,"purl":"pkg:github/Knuckles-Team/langfuse-agent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Knuckles-Team%2Flangfuse-agent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Knuckles-Team%2Flangfuse-agent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Knuckles-Team%2Flangfuse-agent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Knuckles-Team%2Flangfuse-agent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Knuckles-Team","download_url":"https://codeload.github.com/Knuckles-Team/langfuse-agent/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Knuckles-Team%2Flangfuse-agent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33912325,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-04T02:00:06.755Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["a2a","a2a-server","ag-ui","langfuse","mcp-server","python"],"created_at":"2026-06-04T16:00:14.667Z","updated_at":"2026-06-04T16:00:23.686Z","avatar_url":"https://github.com/Knuckles-Team.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Langfuse Agent\n## API | MCP | Agent\n\n![PyPI - Version](https://img.shields.io/pypi/v/langfuse-agent)\n![MCP Server](https://badge.mcpx.dev?type=server 'MCP Server')\n![PyPI - Downloads](https://img.shields.io/pypi/dd/langfuse-agent)\n![GitHub Repo stars](https://img.shields.io/github/stars/Knuckles-Team/langfuse-agent)\n![GitHub forks](https://img.shields.io/github/forks/Knuckles-Team/langfuse-agent)\n![GitHub contributors](https://img.shields.io/github/contributors/Knuckles-Team/langfuse-agent)\n![PyPI - License](https://img.shields.io/pypi/l/langfuse-agent)\n![GitHub](https://img.shields.io/github/license/Knuckles-Team/langfuse-agent)\n![GitHub last commit (by committer)](https://img.shields.io/github/last-commit/Knuckles-Team/langfuse-agent)\n![GitHub pull requests](https://img.shields.io/github/issues-pr/Knuckles-Team/langfuse-agent)\n![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed/Knuckles-Team/langfuse-agent)\n![GitHub issues](https://img.shields.io/github/issues/Knuckles-Team/langfuse-agent)\n![GitHub top language](https://img.shields.io/github/languages/top/Knuckles-Team/langfuse-agent)\n![GitHub language count](https://img.shields.io/github/languages/count/Knuckles-Team/langfuse-agent)\n![GitHub repo size](https://img.shields.io/github/repo-size/Knuckles-Team/langfuse-agent)\n![GitHub repo file count (file type)](https://img.shields.io/github/directory-file-count/Knuckles-Team/langfuse-agent)\n![PyPI - Wheel](https://img.shields.io/pypi/wheel/langfuse-agent)\n![PyPI - Implementation](https://img.shields.io/pypi/implementation/langfuse-agent)\n\n*Version: 0.26.0*\n\n---\n\n## Overview\n\n**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.\n\n---\n\n## Key Features\n\n- **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.\n- **Enterprise-Grade Security:** Comprehensive support for Eunomia policies, OIDC token delegation, and granular execution context tracking.\n- **Integrated Graph Agent:** Built-in Pydantic AI agent supporting the Agent Control Protocol (ACP) and standard Web interfaces (AG-UI).\n- **Native Telemetry \u0026 Tracing:** Out-of-the-box OpenTelemetry exports and native Langfuse tracing tracking every trace and span.\n\n---\n\n## CLI or API\n\nThis agent wraps the Langfuse API. You can interact with it programmatically or via its integrated execution entrypoints.\n\nDetailed instructions on how to use the underlying API wrappers, extended schema bindings, and developer SDK references are maintained in [docs/index.md](docs/index.md).\n\n---\n\n## MCP\n\nThis server utilizes dynamic Action-Routed tools to optimize token overhead and maximize IDE compatibility.\n\n### Available MCP Tools\n| Tool Module | Toggle Env Var | Enabled by Default | Description \u0026 Nested Methods |\n|-------------|----------------|--------------------|------------------------------|\n| **Langfuse Observability** | `LANGFUSE_OBSERVABILITY_TOOL` | `True` | Perform langfuse_observability operations. Action-routed methods: `ingestion_batch`, `legacy_metrics_v1_metrics`, `legacy_observations_v1_get`, `legacy_observations_v1_get_many`, `legacy_score_v1_create`, `legacy_score_v1_delete`, `metrics_metrics`, `observations_get_many`, `opentelemetry_export_traces`, `score_configs_create`, `score_configs_get`, `score_configs_get_by_id`, `score_configs_update`, `scores_get_by_id`, `scores_get_many`, `sessions_get`, `sessions_list`, `trace_delete`, `trace_delete_multiple`, `trace_get`, `trace_list`. |\n| **Langfuse Datasets** | `LANGFUSE_DATASETS_TOOL` | `True` | Perform langfuse_datasets operations. Action-routed methods: `annotation_queues_create_queue`, `annotation_queues_create_queue_assignment`, `annotation_queues_create_queue_item`, `annotation_queues_delete_queue_assignment`, `annotation_queues_delete_queue_item`, `annotation_queues_get_queue`, `annotation_queues_get_queue_item`, `annotation_queues_list_queue_items`, `annotation_queues_list_queues`, `annotation_queues_update_queue_item`, `dataset_items_create`, `dataset_items_delete`, `dataset_items_get`, `dataset_items_list`, `dataset_run_items_create`, `dataset_run_items_list`, `datasets_create`, `datasets_delete_run`, `datasets_get`, `datasets_get_run`, `datasets_get_runs`, `datasets_list`. |\n| **Langfuse Prompts Models** | `LANGFUSE_PROMPTS_MODELS_TOOL` | `True` | Perform langfuse_prompts_models operations. Action-routed methods: `llm_connections_list`, `llm_connections_upsert`, `media_get`, `media_get_upload_url`, `media_patch`, `models_create`, `models_delete`, `models_get`, `models_list`, `prompt_version_update`, `prompts_create`, `prompts_delete`, `prompts_get`, `prompts_list`. |\n| **Langfuse Management** | `LANGFUSE_MANAGEMENT_TOOL` | `True` | Perform langfuse_management operations. Action-routed methods: `blob_storage_integrations_delete_blob_storage_integration`, `blob_storage_integrations_get_blob_storage_integration_status`, `blob_storage_integrations_get_blob_storage_integrations`, `blob_storage_integrations_upsert_blob_storage_integration`, `comments_create`, `comments_get`, `comments_get_by_id`, `health_health`, `organizations_delete_organization_membership`, `organizations_delete_project_membership`, `organizations_get_organization_api_keys`, `organizations_get_organization_memberships`, `organizations_get_organization_projects`, `organizations_get_project_memberships`, `organizations_update_organization_membership`, `organizations_update_project_membership`, `projects_create`, `projects_create_api_key`, `projects_delete`, `projects_delete_api_key`, `projects_get`, `projects_get_api_keys`, `projects_update`, `scim_create_user`, `scim_delete_user`, `scim_get_resource_types`, `scim_get_schemas`, `scim_get_service_provider_config`, `scim_get_user`, `scim_list_users`. |\n\nDetailed tool schemas, parameter shapes, and validation constraints are preserved in [docs/mcp.md](docs/mcp.md).\n\n### Dynamic Tool Selection \u0026 Visibility\n\nThis 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.\n\nYou can configure tool filtering via multiple input channels:\n\n- **CLI Arguments:** Pass `--tools` or `--toolsets` (or their disabled counterparts `--disabled-tools` and `--disabled-toolsets`) during startup.\n- **Environment Variables:** Define standard environment variables:\n  - `MCP_ENABLED_TOOLS` / `MCP_DISABLED_TOOLS`\n  - `MCP_ENABLED_TAGS` / `MCP_DISABLED_TAGS`\n- **HTTP SSE Request Headers:** Pass custom headers during transport initialization:\n  - `x-mcp-enabled-tools` / `x-mcp-disabled-tools`\n  - `x-mcp-enabled-tags` / `x-mcp-disabled-tags`\n- **HTTP SSE Request Query Parameters:** Append query parameters directly to your transport connection URL:\n  - `?tools=tool1,tool2`\n  - `?tags=tag1`\n\nWhen 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.\n\n---\n\n### MCP Configuration Examples\n\n#### stdio Transport (Recommended for local IDEs e.g., Cursor, Claude Desktop)\nConfigure your IDE's `mcp.json` to launch the MCP server via `uvx`:\n\n```json\n{\n  \"mcpServers\": {\n    \"langfuse-agent\": {\n      \"command\": \"uvx\",\n      \"args\": [\n        \"--from\",\n        \"langfuse-agent\",\n        \"langfuse-mcp\"\n      ],\n      \"env\": {\n        \"LANGFUSE_BASE_URL\": \"http://localhost:8080\",\n        \"LANGFUSE_TOKEN\": \"your_token_here\"\n      }\n    }\n  }\n}\n```\n\n#### Streamable-HTTP Transport (Recommended for production deployments)\nTo run the server as a long-running Streamable-HTTP service:\n\n```json\n{\n  \"mcpServers\": {\n    \"langfuse-agent\": {\n      \"url\": \"http://localhost:8004/langfuse-agent/mcp\"\n    }\n  }\n}\n```\n\nDeploying the Streamable-HTTP server via Docker:\n\n```bash\ndocker run -d \\\n  --name langfuse-agent-mcp \\\n  -p 8004:8004 \\\n  -e TRANSPORT=streamable-http \\\n  -e PORT=8004 \\\n  -e LANGFUSE_BASE_URL=\"http://your-langfuse-instance:8080\" \\\n  -e LANGFUSE_TOKEN=\"your_token\" \\\n  knucklessg1/langfuse-agent:latest\n```\n\n---\n\n## Agent\n\nThis 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.\n\n### Running the Agent CLI\nTo start the interactive command-line agent:\n\n```bash\n# Set credentials\nexport LANGFUSE_BASE_URL=\"http://localhost:8080\"\nexport LANGFUSE_TOKEN=\"your_token\"\n\n# Run the agent server\nlangfuse-agent --provider openai --model-id gpt-4o\n```\n\n### Docker Compose Orchestration\nThe following `docker/agent.compose.yml` configures the Agent, Web UI, and Terminal Interface together:\n\n```yaml\nversion: '3.8'\n\nservices:\n  langfuse-agent-mcp:\n    image: knucklessg1/langfuse-agent:latest\n    container_name: langfuse-agent-mcp\n    hostname: langfuse-agent-mcp\n    restart: always\n    env_file:\n      - ../.env\n    environment:\n      - PYTHONUNBUFFERED=1\n      - HOST=0.0.0.0\n      - PORT=8004\n      - TRANSPORT=streamable-http\n    ports:\n      - \"8004:8004\"\n    healthcheck:\n      test: [\"CMD\", \"python3\", \"-c\", \"import urllib.request; urllib.request.urlopen('http://localhost:8004/health')\"]\n      interval: 30s\n      timeout: 10s\n      retries: 3\n      start_period: 10s\n\n  langfuse-agent-agent:\n    image: knucklessg1/langfuse-agent:latest\n    container_name: langfuse-agent-agent\n    hostname: langfuse-agent-agent\n    restart: always\n    depends_on:\n      - langfuse-agent-mcp\n    env_file:\n      - ../.env\n    command: [ \"langfuse-agent\" ]\n    environment:\n      - PYTHONUNBUFFERED=1\n      - HOST=0.0.0.0\n      - PORT=9004\n      - MCP_URL=http://langfuse-agent-mcp:8004/mcp\n      - PROVIDER=${PROVIDER:-openai}\n      - MODEL_ID=${MODEL_ID:-gpt-4o}\n      - ENABLE_WEB_UI=True\n      - ENABLE_OTEL=True\n    ports:\n      - \"9004:9004\"\n    healthcheck:\n      test: [\"CMD\", \"python3\", \"-c\", \"import urllib.request; urllib.request.urlopen('http://localhost:9004/health')\"]\n      interval: 30s\n      timeout: 10s\n      retries: 3\n      start_period: 10s\n```\n\nDetailed graph node architecture explanations, custom skill configurations, and agentic trace guides are available in [docs/agent.md](docs/agent.md).\n\n---\n\n## Security \u0026 Governance\n\nBuilt directly upon the enterprise-ready [`agent-utilities`](https://github.com/Knuckles-Team/agent-utilities) core, standard security parameters are fully supported:\n\n### Access Control \u0026 Policy Enforcement\n- **Eunomia Policies:** Fine-grained, policy-driven tool authorization. Supports `none`, local `embedded` (`mcp_policies.json`), or centralized `remote` modes.\n- **OIDC Token Delegation:** Compliant with RFC 8693 token exchange for flowing authenticating user credentials from Web UI / ACP → Agent → MCP.\n- **Scoped Credentials:** Execution context runs restricted to the specific caller identity.\n\n### Runtime Security Grid\n| Feature | Functionality | Enablement |\n|---------|---------------|------------|\n| **Tool Guard** | Sensitivity inspection with human-in-the-loop validation | Enabled by default |\n| **Prompt Injection Defense** | Input scanning, repetition monitoring, and recursive loop blocks | Enabled by default |\n| **Context Safety Guard** | Stuck-loop detectors and contextual overflow preemptive alerts | Enabled by default |\n\n---\n\n## Configuration \u0026 Environment Variables\n\nThe agent can be fully configured using environment variables or a `.env` file. Below is the list of all supported variables:\n\n### Core API \u0026 Credentials\n| Variable | Description | Default |\n|----------|-------------|---------|\n| `LANGFUSE_BASE_URL` | Langfuse instance base URL. | `https://cloud.langfuse.com` |\n| `LANGFUSE_PUBLIC_KEY` | Langfuse public API key. | `\"\"` |\n| `LANGFUSE_SECRET_KEY` | Langfuse secret API key. | `\"\"` |\n| `LANGFUSE_TOKEN` | Consolidated authentication token. | `\"\"` |\n\n### Server Configuration\n| Variable | Description | Default |\n|----------|-------------|---------|\n| `HOST` | The hostname/address the server binds to. | `0.0.0.0` |\n| `PORT` | The port the server listens on. | `8004` |\n| `TRANSPORT` | The communication protocol (`stdio`, `streamable-http`, `sse`). | `stdio` |\n| `AUTH_TYPE` | Server authentication strategy (`key`, `delegated`, `none`). | `key` |\n\n### Agent Customization\n| Variable | Description | Default |\n|----------|-------------|---------|\n| `DEFAULT_AGENT_NAME` | Custom name displayed for the Pydantic AI Graph Agent. | `\"Langfuse Agent\"` |\n| `AGENT_DESCRIPTION` | Short description of the agent's responsibilities. | `\"AI agent for Langfuse Agent operations.\"` |\n| `AGENT_SYSTEM_PROMPT` | Custom system instructions override for the agent. | `\"\"` |\n\n### Tool Toggle Switches\nIndividual tool modules can be enabled or disabled to minimize client context size:\n- `OBSERVABILITY_TOOL` (Default: `True`): Toggles observation/tracing tools.\n- `DATASETS_TOOL` (Default: `True`): Toggles datasets and annotation queue tools.\n- `PROMPTS_MODELS_TOOL` (Default: `True`): Toggles prompt template and model connectivity tools.\n- `MANAGEMENT_TOOL` (Default: `True`): Toggles comments, SCIM, and project management tools.\n\n---\n\n## Installation\n\nInstall the Python package locally:\n\n```bash\n# Using uv (highly recommended)\nuv pip install langfuse-agent[all]\n\n# Using standard pip\npython -m pip install langfuse-agent[all]\n```\n\n---\n\n## Repository Owners\n\n\u003cimg width=\"100%\" height=\"180em\" src=\"https://github-readme-stats.vercel.app/api?username=Knucklessg1\u0026show_icons=true\u0026hide_border=true\u0026\u0026count_private=true\u0026include_all_commits=true\" /\u003e\n\n![GitHub followers](https://img.shields.io/github/followers/Knucklessg1)\n![GitHub User's stars](https://img.shields.io/github/stars/Knucklessg1)\n\n---\n\n## Contribute\n\nContributions are welcome! Please ensure code quality by executing local checks before submitting pull requests:\n- Format code using `ruff format .`\n- Lint code using `ruff check .`\n- Validate type-safety with `mypy .`\n- Execute test suites using `pytest`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknuckles-team%2Flangfuse-agent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fknuckles-team%2Flangfuse-agent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknuckles-team%2Flangfuse-agent/lists"}