Setting LangGraph run_id in config does not appear to be picked up properly by LangSmith and different ID is used in the dashboard. #553

Closed
opened 2026-02-20 17:40:42 -05:00 by yindo · 3 comments
Owner

Originally created by @TimCapes on GitHub (Apr 3, 2025).

Checked other resources

  • This is a bug, not a usage question. For questions, please use GitHub Discussions.
  • I added a clear and detailed title that summarizes the issue.
  • I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example).
  • I included a self-contained, minimal example that demonstrates the issue INCLUDING all the relevant imports. The code run AS IS to reproduce the issue.

Example Code

from langsmith import traceable
import uuid
from langgraph import StateGraph, START, END

@dataclass
class OverallState:
    response: Optional[str] = None

graph_builder = StateGraph(OverallState)
graph_builder.add_edge(START, END)
compiled_graph = graph_builder.compile()

response_message_key = "4"
conversation_key = "8"
my_uuid = uuid.uuid4()
output_state = await sync_to_async(
    traceable(
        compiled_graph.invoke,
        metadata={
            "user": settings.LANGSMITH_USERNAME,
            "message_id": response_message_key,
            "conversation_id": conversation_key,
        },
   )
)(input_state, config = {"run_id": my_uuid})

Error Message and Stack Trace (if applicable)

No error message is generated but in the LangSmith Dashboard the UUID for the invoke call is different from the uuid provided to run_id.

Description

I am expecting the invoke call as traced in LangSmith to have the uuid from the run_id passed to LangGraph. It currently has a generated id instead.

System Info

I'm on Windows 11 and this was tested in a Django application using python 3.10.11

Originally created by @TimCapes on GitHub (Apr 3, 2025). ### Checked other resources - [x] This is a bug, not a usage question. For questions, please use GitHub Discussions. - [x] I added a clear and detailed title that summarizes the issue. - [x] I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example). - [x] I included a self-contained, minimal example that demonstrates the issue INCLUDING all the relevant imports. The code run AS IS to reproduce the issue. ### Example Code ```python from langsmith import traceable import uuid from langgraph import StateGraph, START, END @dataclass class OverallState: response: Optional[str] = None graph_builder = StateGraph(OverallState) graph_builder.add_edge(START, END) compiled_graph = graph_builder.compile() response_message_key = "4" conversation_key = "8" my_uuid = uuid.uuid4() output_state = await sync_to_async( traceable( compiled_graph.invoke, metadata={ "user": settings.LANGSMITH_USERNAME, "message_id": response_message_key, "conversation_id": conversation_key, }, ) )(input_state, config = {"run_id": my_uuid}) ``` ### Error Message and Stack Trace (if applicable) ```shell No error message is generated but in the LangSmith Dashboard the UUID for the invoke call is different from the uuid provided to run_id. ``` ### Description I am expecting the invoke call as traced in LangSmith to have the uuid from the run_id passed to LangGraph. It currently has a generated id instead. ### System Info I'm on Windows 11 and this was tested in a Django application using python 3.10.11
yindo closed this issue 2026-02-20 17:40:42 -05:00
Author
Owner

@hinthornw commented on GitHub (Apr 3, 2025):

Since you're wrapping everyting in traceable, you're assigning the run ID to the traceable which means it wouldn't be used for child runs, as every run has a unique ID.

Out of curiosity, why are you doing sync to async rather than just using graph.ainvoke ? And why double-trace something?

@hinthornw commented on GitHub (Apr 3, 2025): Since you're wrapping everyting in traceable, you're assigning the run ID to the traceable which means it wouldn't be used for child runs, as every run has a unique ID. Out of curiosity, why are you doing sync to async rather than just using `graph.ainvoke` ? And why double-trace something?
Author
Owner

@TimCapes commented on GitHub (Apr 3, 2025):

We haven't made the graph (not the one in the minimal example) fully async yet, although that's planned.

I don't believe we are double tracing. We only call traceable once wrapping the invoke call and don't have any other traces set explicitly.

What is the correct way to set the run_id on the traceable object if it overrides the run_id on the Graph?

@TimCapes commented on GitHub (Apr 3, 2025): We haven't made the graph (not the one in the minimal example) fully async yet, although that's planned. I don't believe we are double tracing. We only call traceable once wrapping the invoke call and don't have any other traces set explicitly. What is the correct way to set the run_id on the traceable object if it overrides the run_id on the Graph?
Author
Owner

@TimCapes commented on GitHub (Apr 3, 2025):

I confirmed the double tracing issue and that we still get full traces while removing the traceable call. The top level call is now the LangGraph object instead of the invoke so the id is set correctly. Closing.

@TimCapes commented on GitHub (Apr 3, 2025): I confirmed the double tracing issue and that we still get full traces while removing the traceable call. The top level call is now the LangGraph object instead of the invoke so the id is set correctly. Closing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#553