Langfuse Evaluation Harness#

This page is published from the blueprint’s source repository. Code paths mentioned here refer to files in that repository — see Clinical Diagnostic Assistant on GitHub to browse them.

What this is#

An optional, off-by-default capability that runs this blueprint’s own pipeline against a labeled benchmark dataset of clinical notes, scores the results, and reports everything through a self-hosted Langfuse instance — traces, the dataset itself, and each scored run. It’s for anyone iterating on the pipeline’s diagnostic accuracy (prompt changes, model swaps, threshold tuning) who wants a repeatable, measurable benchmark rather than eyeballing a handful of manual test notes.

It’s entirely independent of the core pipeline — evaluator.enabled: false (the default) deploys none of it, and every other capability in this blueprint works identically either way.

This page covers deploying the harness. For why it exists, what the benchmark dataset is, and how each metric is computed, see EVALUATION.md.

Components#

Deploying with evaluator.enabled: true adds:

Component

Role

evaluator

Runs the pipeline against the benchmark dataset, scores results

eval-nginx

Fronts evaluator on port 80 so Langfuse’s webhook SSRF guard (ports 80/443 only) can reach it

langfuse-web / langfuse-worker

The Langfuse application itself — UI, API, trace/dataset storage

langfuse-postgres / langfuse-clickhouse / langfuse-redis (Valkey)

Langfuse’s own backing stores — no manual setup

Langfuse also needs an S3-compatible object store, which the chart does not bundle. Provide your own, see step 1.

On Kubernetes only the evaluator reports to Langfuse; the chart does not wire per-request orchestrator tracing (that is available in the docker compose setup only).

Langfuse auto-provisions its organization, project, admin user, and API keys on first boot from values you set (langfuse.initOrgName, initProjectName, initUserEmail, etc. in values.yaml) plus the secret below — you don’t create any of this by hand inside the Langfuse UI.

1. Enable it#

Add this to your my-values.yaml:

evaluator:
  enabled: true
langfuse:
  s3:
    endpoint: "http://<s3-service>.<s3-namespace>.svc:9000"   # your S3-compatible store
    bucket: "langfuse"                                        # must already exist

Create the bucket in your object store first: Langfuse does not create it. See Evaluation harness (optional) and the langfuse.s3.* values in values.yaml for the remaining options. With that in place, the harness brings up one additional service from this blueprint (evaluator) plus the self-hosted Langfuse stack — all from published images, so nothing needs to be built.

2. Create the langfuse-secret#

kubectl create secret generic langfuse-secret \
  --from-literal=LANGFUSE_PUBLIC_KEY=pk-lf-<your-value> \
  --from-literal=LANGFUSE_SECRET_KEY=sk-lf-<your-value> \
  --from-literal=LANGFUSE_INIT_USER_PASSWORD=<your-value> \
  --from-literal=SALT=<your-value> \
  --from-literal=ENCRYPTION_KEY=<64-hex-chars> \
  --from-literal=NEXTAUTH_SECRET=<your-value> \
  --from-literal=POSTGRES_PASSWORD=<your-value> \
  --from-literal=CLICKHOUSE_PASSWORD=<your-value> \
  --from-literal=REDIS_PASSWORD=<your-value> \
  --from-literal=S3_ACCESS_KEY=<your-s3-access-key> \
  --from-literal=S3_SECRET_KEY=<your-s3-secret-key> \
  --from-literal=LANGFUSE_WEBHOOK_SECRET=<your-value> \
  -n $namespace

LANGFUSE_PUBLIC_KEY/SECRET_KEY must start with pk-lf-/sk-lf- respectively (Langfuse’s own format requirement) — these become this deployment’s actual Langfuse project API keys via headless initialization, not placeholders to replace afterward. Generate the random values with e.g. openssl rand -hex 32 (ENCRYPTION_KEY: exactly 64 hex characters). S3_ACCESS_KEY/ S3_SECRET_KEY are your object store’s credentials.

LANGFUSE_WEBHOOK_SECRET here is a placeholder you’ll overwrite in step 5 — Langfuse generates its own webhook signing secret when you create the trigger (see below), so any value works here for now; just don’t skip the key entirely, since the evaluator requires it to be set.

3. Deploy, then complete the two-phase webhook IP allow-list#

Deploy normally with evaluator.enabled: true set. Langfuse’s webhook SSRF guard only permits calling out to private-range IPs that are explicitly allow-listed, and eval-nginx’s ClusterIP isn’t known until after the first deploy — so this is unavoidably a two-step process:

kubectl get svc aimsb-cda-$name-eval-nginx -n $namespace -o jsonpath='{.spec.clusterIP}'

Set that address as langfuse.webhookWhitelistedIps in your values override, then redeploy (helm template ... | kubectl apply -f -). If eval-nginx’s Service is ever deleted and recreated (not just its pod), its ClusterIP can change and this step needs repeating.

4. Log in to Langfuse#

Reach the langfuse-web Service using any of the methods in docs/DEPLOYMENT.md’s “Connecting” section (port-forward, HTTPRoute, or langfuse.web.serviceType: LoadBalancer), then sign in with:

  • Email: the value of langfuse.initUserEmail in your values override (default admin@example.com — a plain config value, not a secret)

  • Password: the LANGFUSE_INIT_USER_PASSWORD value you chose in step 2

You should land in the langfuse.initProjectName project (default DDx Evaluation), with a dataset named ddx-benchmark already seeded by the langfuse-dataset-seed Job.

5. Configure the webhook trigger (manual — no API exists for this)#

Langfuse exposes no API, SDK method, or config-as-code path for creating this trigger — its Dataset endpoints have no PATCH or PUT. This is the one setup step in the whole harness that stays manual, done once per environment.

  1. Open the ddx-benchmark dataset (inside the project from step 4) and go to its trigger/webhook settings (in the dataset’s own settings/overflow menu, look for Triggers — Langfuse’s UI labels this a “Remote Experiment” trigger).

  2. Create a new trigger pointing at the following URL, with <name> replaced by your release name:

    http://aimsb-cda-<name>-eval-nginx/webhook/langfuse-run
    

    This must be the internal Service address (plain HTTP, port 80, no port-forward or external hostname) — the call is made by Langfuse itself, from inside the cluster. Two constraints force this: the webhook SSRF guard only permits calling out to ports 80/443 on private-range targets (the entire reason eval-nginx exists, rather than pointing the trigger at evaluator’s own port directly), and it only permits private-range targets whose address is in LANGFUSE_WEBHOOK_WHITELISTED_IPS (set in step 3).

  3. When you save the trigger, Langfuse generates its own signing secret and displays it once — it does not let you choose or type your own. Copy that generated value immediately (these are typically shown only once), then update your langfuse-secret’s LANGFUSE_WEBHOOK_SECRET key to match it exactly:

    kubectl patch secret langfuse-secret -n $namespace --type merge \
      -p "{\"data\":{\"LANGFUSE_WEBHOOK_SECRET\":\"$(echo -n '<the-generated-secret>' | base64 -w0)\"}}"
    kubectl rollout restart deployment -n $namespace aimsb-cda-$name-evaluator
    

    The evaluator only reads this Secret at pod startup, so it needs the restart to pick up the new value. The evaluator rejects every webhook request until these match exactly.

6. Trigger a test run and confirm it actually worked#

From the Langfuse UI, open the ddx-benchmark dataset and press Run (or whatever the trigger UI calls starting the remote experiment). Then check the evaluator actually received and processed it:

kubectl logs -n $namespace -l app=aimsb-cda-$name-evaluator --tail=100

A successful run shows the evaluator picking up the webhook call and working through the benchmark cases; results and scores appear back in the Langfuse UI against the dataset run.

Troubleshooting#

Webhook call never reaches evaluator / trigger shows a failure in the Langfuse UI

  • Confirm langfuse.webhookWhitelistedIps is set to eval-nginx’s current ClusterIP (step 3) — this silently goes stale if the Service was ever recreated.

  • Confirm the trigger URL is the internal http://aimsb-cda-<name>-eval-nginx/webhook/langfuse-run form, not an external/port-forwarded address.

Evaluator logs show a signature-verification failure

  • The trigger’s generated secret (step 5) and langfuse-secret’s LANGFUSE_WEBHOOK_SECRET don’t match — re-copy the value Langfuse generated, exactly, and don’t forget the evaluator restart.

langfuse-web/langfuse-worker won’t start, or crash-loop

kubectl logs -n $namespace -l app=aimsb-cda-$name-langfuse-web
kubectl logs -n $namespace -l app=aimsb-cda-$name-langfuse-worker

Common causes: langfuse-secret missing a required key (see the full key list in step 2), Postgres/ClickHouse/Redis (Valkey) pods not yet ready (langfuse-web/-worker wait on them at startup), or the S3 store unreachable / the bucket not created (see step 1).

langfuse-web container OOMKilled shortly after starting Its default memory limit already accounts for this (Next.js needs real headroom to build and serve), so if you have overridden langfuse.web.resources downward, raise the memory limit back up.