LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Client
  • AsyncClient
  • Run Helpers
  • Run Trees
  • Evaluation
  • Schemas
  • Utilities
  • Wrappers
  • Anonymizer
  • Testing
  • Expect API
  • Middleware
  • Pytest Plugin
  • Deployment SDK
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewClientAsyncClientRun HelpersRun TreesEvaluationSchemasUtilitiesWrappersAnonymizerTestingExpect APIMiddlewarePytest PluginDeployment SDK
Language
Theme
PythonlangsmithclientClientcleanup
Method●Since v0.1

cleanup

Copy
cleanup(
    self,
    timeout: Optional[float] = None,
) -> None
View source on GitHub

Parameters

NameTypeDescription
timeoutOptional[float]
Default:None

Maximum seconds to wait for pending traces to flush. None (default) waits indefinitely.

Manually trigger cleanup of background threads.

Drains pending traces via flush() before stopping the background threads. Pass timeout=0 to skip the drain entirely (e.g. in error paths or signal handlers where blocking on network I/O is unacceptable).