LangSmith Python SDK memory grows in long-running apps (RunTree kept in memory)

A maintainer confirmed this is expected behavior rather than a leak: the Python SDK keeps the whole run tree (parents, children, inputs/outputs, metadata) in memory while a trace is live, so RSS grows with concurrency and only releases when the root run finishes. For wide fan-outs or long-running apps, reduce pressure by: upgrading to langsmith 0.4.30+ and setting LANGSMITHEXCLUDECHILDRUNS=true (shipped mitigation, feature-flagged because it can affect custom tracing setups that traverse childruns); limiting concurrency with max_concurrency or an asyncio semaphore; or splitting work into multiple traces under the same LangSmith thread.

Source: https://github.com/langchain-ai/langsmith-sdk/issues/2009

Source: https://github.com/langchain-ai/langsmith-sdk/issues/2009