Skip to main content
Once your traces are flowing into Langfuse, two more things become useful:
  • Versioned prompts — keep the prompt text out of your code, change it without redeploying, A/B test in production.
  • Evaluation scores — record how well a run did and tie it back to the trace. Build dashboards, regression alarms, and rolling quality checks.
Both are implemented in cognis-trace and feature-gated behind langfuse.

Versioned prompts

Prompt carries: When you wire a fetched prompt into a chain, the TracingHandler automatically stamps prompt_name and prompt_version on the resulting generation span — so you can filter “all calls using prompt v3” in Langfuse.

Submitting scores

Every run gets a run_id. Score it any time — during the run (in-band) or later (out-of-band).
Submit a score directly through the handler:
Useful for synchronous eval — your eval ran, you have the answer, attach it to the trace before the user sees the response.

Score values

Bring-your-own backend

If Langfuse isn’t your eval backend, implement ScoreSink:
Pass Arc::new(MyScorer) anywhere a ScoreSink is expected. The trait is one method.

How it works

  • Prompt fetches are HTTP calls. Cache them locally if your access pattern is “fetch on every request” — client.get is fast but it’s still a round-trip.
  • Score submission is async and best-effort. The Langfuse scorer batches in the background like the trace exporter; failures are logged.
  • Run IDs link the world. A trace, its scores, the prompt version it used — all keyed on the same run_id Cognis generated for the run.

See also

Evaluation

Run evals over a dataset and feed scores back.

Trace with Langfuse

Where the runs themselves land.