From a0ee9d8aca30032f615025d9c365f10bdc793f6c Mon Sep 17 00:00:00 2001 From: tt-a1i <53142663+tt-a1i@users.noreply.github.com> Date: Fri, 19 Jun 2026 02:40:52 +0800 Subject: [PATCH] feat(packaging): add langfuse optional extra --- pyproject.toml | 3 ++ uv.lock | 34 ++++++++++++++++++- website/docs/getting-started/nix-setup.md | 10 ++++++ .../current/getting-started/nix-setup.md | 13 +++++-- 4 files changed, 57 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6e371126dd25..45a4926a5ae0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -154,6 +154,9 @@ edge-tts = ["edge-tts==7.2.7"] modal = ["modal==1.3.4"] daytona = ["daytona==0.155.0"] hindsight = ["hindsight-client==0.6.1"] +# Optional observability plugin dependency. Keep out of [all] so default +# installs stay unchanged; packagers can opt in with hermes-agent[langfuse]. +langfuse = ["langfuse==4.9.0"] dev = ["debugpy==1.8.20", "pytest==9.0.2", "pytest-asyncio==1.3.0", "mcp==1.26.0", "starlette==1.0.1", "ty==0.0.21", "ruff==0.15.10", "setuptools==81.0.0"] # starlette: CVE-2026-48710; setuptools: latest <82 (torch >=2.11 caps setuptools<82) messaging = ["python-telegram-bot[webhooks]==22.6", "discord.py[voice]==2.7.1", "aiohttp==3.13.4", "brotlicffi==1.2.0.1", "slack-bolt==1.27.0", "slack-sdk==3.40.1", "qrcode==7.4.2"] # aiohttp: CVE-2026-34513/34518/34519/34520/34525 cron = [] # croniter is now a core dependency; this extra kept for back-compat diff --git a/uv.lock b/uv.lock index fc340bdbe895..f42cba10a0a8 100644 --- a/uv.lock +++ b/uv.lock @@ -453,6 +453,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/49/9a/417b3a533e01953a7c618884df2cb05a71e7b68bdbce4fbdb62349d2a2e8/azure_identity-1.25.3-py3-none-any.whl", hash = "sha256:f4d0b956a8146f30333e071374171f3cfa7bdb8073adb8c3814b65567aa7447c", size = 192138, upload-time = "2026-03-13T01:12:22.951Z" }, ] +[[package]] +name = "backoff" +version = "2.2.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/47/d7/5bbeb12c44d7c4f2fb5b56abce497eb5ed9f34d85701de869acedd602619/backoff-2.2.1.tar.gz", hash = "sha256:03f829f5bb1923180821643f8753b0502c3b682293992485b0eef2807afa5cba", size = 17001, upload-time = "2022-10-05T19:19:32.061Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/df/73/b6e24bd22e6720ca8ee9a85a0c4a2971af8497d8f3193fa05390cbd46e09/backoff-2.2.1-py3-none-any.whl", hash = "sha256:63579f9a0628e06278f7e47b7d7d5b6ce20dc65c5e96a6f3ca99a6adca0396e8", size = 15148, upload-time = "2022-10-05T19:19:30.546Z" }, +] + [[package]] name = "base58" version = "2.1.1" @@ -1540,6 +1549,9 @@ homeassistant = [ honcho = [ { name = "honcho-ai" }, ] +langfuse = [ + { name = "langfuse" }, +] matrix = [ { name = "aiohttp-socks" }, { name = "aiosqlite" }, @@ -1688,6 +1700,7 @@ requires-dist = [ { name = "honcho-ai", marker = "extra == 'honcho'", specifier = "==2.0.1" }, { name = "httpx", extras = ["socks"], specifier = "==0.28.1" }, { name = "jinja2", specifier = "==3.1.6" }, + { name = "langfuse", marker = "extra == 'langfuse'", specifier = "==4.9.0" }, { name = "lark-oapi", marker = "extra == 'feishu'", specifier = "==1.5.3" }, { name = "markdown", specifier = "==3.10.2" }, { name = "mautrix", extras = ["encryption"], marker = "extra == 'matrix'", specifier = "==0.21.0" }, @@ -1745,7 +1758,7 @@ requires-dist = [ { name = "websockets", specifier = "==15.0.1" }, { name = "youtube-transcript-api", marker = "extra == 'youtube'", specifier = "==1.2.4" }, ] -provides-extras = ["anthropic", "exa", "firecrawl", "parallel-web", "fal", "edge-tts", "modal", "daytona", "hindsight", "dev", "messaging", "cron", "slack", "matrix", "wecom", "cli", "tts-premium", "voice", "pty", "honcho", "vision", "mcp", "nemo-relay", "homeassistant", "sms", "teams", "computer-use", "acp", "mistral", "bedrock", "azure-identity", "termux", "termux-all", "dingtalk", "feishu", "google", "youtube", "web", "all"] +provides-extras = ["anthropic", "exa", "firecrawl", "parallel-web", "fal", "edge-tts", "modal", "daytona", "hindsight", "langfuse", "dev", "messaging", "cron", "slack", "matrix", "wecom", "cli", "tts-premium", "voice", "pty", "honcho", "vision", "mcp", "nemo-relay", "homeassistant", "sms", "teams", "computer-use", "acp", "mistral", "bedrock", "azure-identity", "termux", "termux-all", "dingtalk", "feishu", "google", "youtube", "web", "all"] [[package]] name = "hf-xet" @@ -2071,6 +2084,25 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/41/45/1a4ed80516f02155c51f51e8cedb3c1902296743db0bbc66608a0db2814f/jsonschema_specifications-2025.9.1-py3-none-any.whl", hash = "sha256:98802fee3a11ee76ecaca44429fda8a41bff98b00a0f2838151b113f210cc6fe", size = 18437, upload-time = "2025-09-08T01:34:57.871Z" }, ] +[[package]] +name = "langfuse" +version = "4.9.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "backoff" }, + { name = "httpx" }, + { name = "opentelemetry-api" }, + { name = "opentelemetry-exporter-otlp-proto-http" }, + { name = "opentelemetry-sdk" }, + { name = "packaging" }, + { name = "pydantic" }, + { name = "wrapt" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/77/69/4c339bb7cfb4909db340c9b40852bd268fd2bfd93c526e7ac95b7dd725bb/langfuse-4.9.0.tar.gz", hash = "sha256:244d8309cd75d663f29c399f5691e3f04c4a2838e0cc947704e123bdc7233040", size = 339189, upload-time = "2026-06-16T08:44:38.744Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/ca/f0/65735b14e792007381e1e9cf17b4dbd1355be056507c06517e75040102aa/langfuse-4.9.0-py3-none-any.whl", hash = "sha256:ac03eaf7ee6f5fb18036284445833cae92248ae240f3c6068b83d408afb57fe1", size = 599170, upload-time = "2026-06-16T08:44:37.387Z" }, +] + [[package]] name = "lark-oapi" version = "1.5.3" diff --git a/website/docs/getting-started/nix-setup.md b/website/docs/getting-started/nix-setup.md index 3cfdd86fd292..b37447c12906 100644 --- a/website/docs/getting-started/nix-setup.md +++ b/website/docs/getting-started/nix-setup.md @@ -679,6 +679,15 @@ services.hermes-agent = { }; ``` +```nix +# Enable the bundled Langfuse observability plugin +services.hermes-agent = { + extraDependencyGroups = [ "langfuse" ]; + settings.plugins.enabled = [ "observability/langfuse" ]; + environmentFiles = [ "/run/secrets/hermes-langfuse.env" ]; +}; +``` + This is resolved by uv alongside core dependencies — no PYTHONPATH patching, no collision risk. Available groups: | Group | What it enables | @@ -693,6 +702,7 @@ This is resolved by uv alongside core dependencies — no PYTHONPATH patching, n | `anthropic` | Native Anthropic SDK (not needed via OpenRouter) | | `bedrock` | AWS Bedrock (boto3) | | `azure-identity` | Azure Entra ID auth | +| `langfuse` | Langfuse observability plugin SDK | | `honcho` | Honcho memory provider | | `hindsight` | Hindsight memory provider | | `modal` | Modal terminal backend | diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/getting-started/nix-setup.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/getting-started/nix-setup.md index eb003cd32597..e55a4e1bbfa5 100644 --- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/getting-started/nix-setup.md +++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/getting-started/nix-setup.md @@ -656,7 +656,16 @@ services.hermes-agent = { }; ``` -这由 uv 与核心依赖在单次解析中完成——不需要 PYTHONPATH 补丁,没有冲突风险。可用的组与 `pyproject.toml` 中 `[project.optional-dependencies]` 的键对应(例如 `"hindsight"`、`"honcho"`、`"voice"`、`"matrix"`、`"mistral"`、`"bedrock"`)。 +```nix +# 启用内置 Langfuse 可观测性插件 +services.hermes-agent = { + extraDependencyGroups = [ "langfuse" ]; + settings.plugins.enabled = [ "observability/langfuse" ]; + environmentFiles = [ "/run/secrets/hermes-langfuse.env" ]; +}; +``` + +这由 uv 与核心依赖在单次解析中完成——不需要 PYTHONPATH 补丁,没有冲突风险。可用的组与 `pyproject.toml` 中 `[project.optional-dependencies]` 的键对应(例如 `"hindsight"`、`"honcho"`、`"langfuse"`、`"voice"`、`"matrix"`、`"mistral"`、`"bedrock"`)。 **何时使用哪个:** @@ -972,4 +981,4 @@ nix-store --query --roots $(docker exec hermes-agent readlink /data/current-pack | `nix-collect-garbage` 删除了 hermes | GC root 缺失 | 重启服务(preStart 会重新创建 GC root) | | `no container with name or ID "hermes-agent"`(Podman) | Podman rootful 容器对普通用户不可见 | 为 podman 添加免密 sudo(参见[容器模式](#container-mode)章节) | | `unable to find user hermes` | 容器仍在启动中(入口点尚未创建用户) | 等待几秒后重试——CLI 会自动重试 | -| 通过 `extraPackages` 添加的工具在终端中找不到 | 需要 `nixos-rebuild switch` 更新每用户 profile | 重建并重启:`nixos-rebuild switch && systemctl restart hermes-agent` | \ No newline at end of file +| 通过 `extraPackages` 添加的工具在终端中找不到 | 需要 `nixos-rebuild switch` 更新每用户 profile | 重建并重启:`nixos-rebuild switch && systemctl restart hermes-agent` |