Skip to content

docs: add webhook implementation details for remote SDK experiments#2560

Open
daffaalex22 wants to merge 2 commits intolangfuse:mainfrom
daffaalex22:patch-1
Open

docs: add webhook implementation details for remote SDK experiments#2560
daffaalex22 wants to merge 2 commits intolangfuse:mainfrom
daffaalex22:patch-1

Conversation

@daffaalex22
Copy link

@daffaalex22 daffaalex22 commented Feb 20, 2026

Summary

This PR expands the documentation for "Trigger SDK Experiment from UI" to provide a complete guide for developers setting up remote experiment triggers. It fills the gap between configuring the UI and actually implementing the webhook receiver that processes the trigger.

Core Highlight: Webhook Payload

The most important addition is the technical specification of the webhook payload. Specifically:

  • Stringified JSON: It explicitly documents that the payload field is sent as a stringified JSON string (not a nested object). This is a critical detail for proper parsing on the receiver side (e.g., using JSON.parse or json.loads).
  • Flexible Schema: It clarifies that the contents of the payload field are entirely user-defined and optional. Langfuse does not enforce a schema; it simply passes through the JSON configuration defined in the UI.

Detailed Changes

  • Webhook Payload Section: Added a JSON example showing the raw structure, a field reference table, and a callout about the stringified payload.
  • Implementation Examples: Added minimal, functional examples in both Python (Flask) and JS/TS (Express). These show how to:
    • Parse the stringified payload.
    • Respond with 200 OK promptly (required by Langfuse).
    • Execute the experiment runner asynchronously in the background.
  • Workflow Overview: Added a step-by-step "End-to-End Workflow" to help developers visualize the data flow from the Langfuse UI to their server and back.
  • UI Step Refinements: Polished the existing instructions for setting up the trigger in the Langfuse dashboard to ensure clarity.

Rationale

While the "Custom Experiment" trigger is a powerful feature, developers often struggle with the "how-to" of the receiving end. Providing the exact payload shape makes it much easier for users to integrate their own evaluation pipelines.


Important

Enhances documentation with detailed webhook setup and implementation examples for remote SDK experiments in Langfuse.

  • Documentation Enhancements:
    • Adds detailed instructions for setting up webhook triggers in Langfuse UI in experiments-via-sdk.mdx.
    • Specifies that the webhook payload is a stringified JSON, requiring parsing on the receiver side.
    • Clarifies that the payload schema is user-defined and optional.
  • Implementation Examples:
    • Provides Python (Flask) and JS/TS (Express) examples for webhook receivers.
    • Demonstrates parsing the payload, responding with 200 OK, and running experiments asynchronously.
  • Workflow Overview:
    • Describes end-to-end workflow from Langfuse UI trigger to server processing and result tracking.

This description was created by Ellipsis for 4a6aba8. You can customize this summary. It will automatically update as commits are pushed.

Updated the documentation for triggering SDK experiments from the Langfuse UI. Added details about webhook configuration, payload structure, and provided examples for webhook receivers in Python and JavaScript.
@vercel
Copy link

vercel bot commented Feb 20, 2026

@daffaalex22 is attempting to deploy a commit to the langfuse Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant
Copy link

CLAassistant commented Feb 20, 2026

CLA assistant check
All committers have signed the CLA.

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. documentation Improvements or additions to documentation labels Feb 20, 2026
@daffaalex22
Copy link
Author

@jannikmaierhoefer @Steffen911 @felixkrrr

I was trying to implement the Webhook for Remote SDK Experiment Run and confused with the request body Langfuse sends. This will hopefully help others like me

https://langfuse.com/docs/evaluation/experiments/experiments-via-sdk#optional-trigger-sdk-experiment-from-ui

Removed optional step for computing and ingesting evaluation scores.
@Steffen911 Steffen911 requested a review from hassiebp March 7, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants