Skip to content

Conversation

@nagkumar91
Copy link
Collaborator

@nagkumar91 nagkumar91 commented Nov 19, 2025

On drop_use_span we ripped out the tracer’s use_span()/ContextVar handling that caused async FastAPI calls to crash, then taught the tracer to rebuild LangGraph parent-child relationships explicitly: _start_span now accepts thread metadata, records a
per-thread agent stack, and falls back to that stack (or thread root) when LangChain omits parent_run_id, ensuring nested agents, chats, and tools attach correctly. We added new tests to cover thread-root fallback plus stack behavior, reproduced the
ContextVar and hierarchy issues via local FastAPI/LangGraph samples, then reran the tracer unit suite and key samples after each change.

Addresses #212

@nagkumar91 nagkumar91 changed the title Propogated context and remove use_span Propagated context and remove use_span Nov 19, 2025
@nagkumar91 nagkumar91 requested a review from marlenezw November 26, 2025 17:15
@marlenezw
Copy link
Collaborator

LGTM and user validated the fix so going to merge!

@marlenezw marlenezw merged commit dc2c216 into langchain-ai:main Nov 27, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants