Skip to content
Discussion options

You must be logged in to vote

There is no langfuse_trace_id metadata field — metadata only supports langfuse_user_id, langfuse_session_id, and langfuse_tags for setting trace attributes dynamically (1). To use a custom trace ID, wrap the LangChain execution in a span that sets the predefined trace ID via trace_context (1):

from langfuse import get_client, Langfuse
from langfuse.langchain import CallbackHandler

langfuse = get_client()

# Generate deterministic trace ID from external system
external_request_id = "req_12345"
predefined_trace_id = Langfuse.create_trace_id(seed=external_request_id)

langfuse_handler = CallbackHandler()

# Use the predefined trace ID with trace_context
with langfuse.start_as_current_observ…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by fer-prieto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant