Langfuse icon

Langfuse

Log LLM traces, spans, generations, and scores to Langfuse, or query traces, prompts, datasets, sessions, and more via the Public API.

Ingestion → Score Create

AI-generated

Summary

Create a new score observation in Langfuse with a specified name and value, optionally attaching it to a trace, providing advanced metadata, and controlling idempotency via optional IDs.

Inputs

  • Score Name (required) — Name of the score to store in Langfuse.
  • Score Value (required) — Value of the score; can be a JSON-compatible number, boolean, string, or text.
  • Score Data Type — Data type of the score, such as Numeric, Boolean, Categorical, or Text.
  • Trace ID — Trace ID to which this score observation attaches. Auto-filled from previous step if left blank.
  • Score ID — Optional score ID for idempotent create/update behavior.
  • Score Comment — Optional human-readable comment for the score.
  • Score Config ID — Optional score configuration ID.
  • Score Environment — Optional environment label for the score.
  • Score Dataset Run ID — Optional dataset run ID attached to the score.
  • Score Session ID — Optional session ID attached to the score.
  • Score Trace ID — Optional trace ID override for the score.
  • Score Observation ID — Optional observation ID override for the score.
  • Observation ID — Optional observation ID; leave blank to auto-generate for create operations.
  • Timestamp — Optional ISO 8601 timestamp for the event; defaults to current time if blank.
  • Name — Optional human-readable name for the score observation.
  • Session ID — Optional session this score belongs to; defaults to the trace ID if not set.
  • Metadata JSON — Additional JSON metadata stored with the score.
  • Event ID — Optional event ID for idempotency and deduplication.
  • Fail On Batch Errors — Whether to fail the item if Langfuse returns partial ingestion errors.

Output shape

a single record representing the created score observation with IDs and fields assigned by Langfuse

The operation returns the main data about the created score. IDs such as traceId or observationId are auto-generated if not provided, and are surfaced to enable linking future observations to the same trace. Partial ingestion errors may return HTTP 207 with details; setting 'Fail On Batch Errors' controls failure behavior.

Examples

Example 1: Create a numeric score named 'accuracy' with value 0.95 attached to the last trace

Fill 'Score Name' as 'accuracy', 'Score Value' as '0.95', set 'Score Data Type' to 'Numeric', leave 'Trace ID' blank to auto-fill from previous step.

Links

Discussion