langchain.callbacks.manager.collect_runs¶
langchain.callbacks.manager.collect_runs() → Generator[RunCollectorCallbackHandler, None, None][source]¶
Collect all run traces in context.
Returns
The run collector callback handler.
Return type
run_collector.RunCollectorCallbackHandler
Example
>>> with collect_runs() as runs_cb:
        chain.invoke("foo")
        run_id = runs_cb.traced_runs[0].id