Every agent turn is traced to Langfuse: the Slack
thread becomes a session, the Slack user the userId, each reply a trace
containing one generation per LLM call (with token usage and cost) and
one span per tool execution. Traces are tagged with the agent name and
trigger (slack / cron).
You have three ways to get a Langfuse:
| Setup | wrapper.yaml |
Who runs Langfuse |
|---|---|---|
| Bundled (default) | langfuse: { baseUrl: http://localhost:3010 } |
wrapper, via docker compose |
| Existing / external | langfuse: { external: true, ... } |
you (self-hosted anywhere, or Langfuse Cloud) |
| K8s target | k8s: { langfuseBaseUrl: ... } |
you (typically already in the cluster) |
An agent traces to whatever LANGFUSE_BASEURL, LANGFUSE_PUBLIC_KEY, and
LANGFUSE_SECRET_KEY resolve to in its container env. If the keys are absent
the agent runs fine with tracing disabled (a warning is logged).
wrapper init generates secrets, starts the full Langfuse v3 stack (web,
worker, postgres, clickhouse, redis, minio) inside the wrapper compose project,
and headlessly provisions an org + a shared wrapper-agents project. The
project keys land in wrapper.secrets.json, and every wrapper agent add
copies them into the agent's .env. Nothing else to do.
If you already run Langfuse (or use Langfuse Cloud), don't start a second one — point wrapper at yours:
-
Configure
wrapper.yaml:target: local langfuse: external: true # Reachable from where you run the CLI (health checks): baseUrl: https://langfuse.mycompany.com # Reachable from inside the agent containers (defaults to baseUrl). # Only needed when the two differ — e.g. Langfuse in another compose # project on the same host: http://host.docker.internal:3000 containerBaseUrl: https://langfuse.mycompany.com orgId: wrapper
With
external: truethe generated docker-compose.yml no longer includes the bundled stack (andwrapper initwon't try to start it); agents getLANGFUSE_BASEURL=<containerBaseUrl or baseUrl>. -
Create a project in your Langfuse UI (e.g.
wrapper-agents) and copy its API keys (pk-lf-…/sk-lf-…). -
Give wrapper the keys — either of:
-
Put them in
wrapper.secrets.jsonso every futurewrapper agent addwrites them into the agent's.envautomatically:{ "langfuseProjectPublicKey": "pk-lf-...", "langfuseProjectSecretKey": "sk-lf-..." } -
Or set them per agent (also how you fix up existing agents):
wrapper env set my-agent LANGFUSE_PUBLIC_KEY=pk-lf-... LANGFUSE_SECRET_KEY=sk-lf-... wrapper restart my-agent
-
-
wrapper init --team-id T0…then behaves as a pure config step: it writes configs/secrets, health-checks your Langfuse, and skips the stack.
Notes for specific hosts:
- Langfuse Cloud:
baseUrl: https://cloud.langfuse.com(or your region's URL); nocontainerBaseUrlneeded. - Langfuse on the same machine, outside wrapper's compose: containers can't
reach your host's
localhost— usecontainerBaseUrl: http://host.docker.internal:<port>(Docker Desktop) or the host's LAN IP (Linux). - Served under a basepath (e.g.
/langfuse-webbehind a shared ingress): include the basepath in the URLs.
target: k8s always brings your own Langfuse — the bundled stack is
local-mode only. Set the in-cluster (or public) endpoint:
k8s:
# As reached FROM AGENT PODS — include any basepath:
langfuseBaseUrl: http://langfuse-web.langfuse.svc.cluster.local:3000
# Optional, for humans (`wrapper status` prints it):
langfuseUiUrl: https://langfuse.mycompany.comKeys work exactly as in the external case above (wrapper.secrets.json for
new agents, wrapper env set for existing ones); wrapper restart re-syncs
each agent's k8s Secret from its .env.
Project management APIs are enterprise-only on OSS self-hosted Langfuse, so by
default all agents share one project, separated by tag (agent name) and
session. To isolate an agent into its own project: create the project in the
UI, then wrapper env set <agent> LANGFUSE_PUBLIC_KEY=… LANGFUSE_SECRET_KEY=…
and restart.
Traces contain the full prompt context, tool inputs, and tool outputs — including whatever users paste into Slack. Treat the Langfuse project like the conversations themselves: restrict who can view it, and consider a retention window on the project.