Home / Function/ on_chain_end() — langchain Function Reference

on_chain_end() — langchain Function Reference

Architecture documentation for the on_chain_end() function in base.py from the langchain codebase.

Function python Observability Tracers calls 3 called by 1

Entity Profile

Dependency Diagram

graph TD
  aea890c6_499d_589a_9dd7_0d29b172ee5f["on_chain_end()"]
  b3ab8001_c14c_4191_ca53_2dbabc99917f["AsyncBaseTracer"]
  aea890c6_499d_589a_9dd7_0d29b172ee5f -->|defined in| b3ab8001_c14c_4191_ca53_2dbabc99917f
  345a9c6c_5d65_81c4_da44_5f0ea61fc060["on_chain_end()"]
  345a9c6c_5d65_81c4_da44_5f0ea61fc060 -->|calls| aea890c6_499d_589a_9dd7_0d29b172ee5f
  a962822f_f5be_755c_cef6_a8eeb2b06eb5["_end_trace()"]
  aea890c6_499d_589a_9dd7_0d29b172ee5f -->|calls| a962822f_f5be_755c_cef6_a8eeb2b06eb5
  76693ba5_9082_bc25_dc8b_d223d817dd6f["_on_chain_end()"]
  aea890c6_499d_589a_9dd7_0d29b172ee5f -->|calls| 76693ba5_9082_bc25_dc8b_d223d817dd6f
  345a9c6c_5d65_81c4_da44_5f0ea61fc060["on_chain_end()"]
  aea890c6_499d_589a_9dd7_0d29b172ee5f -->|calls| 345a9c6c_5d65_81c4_da44_5f0ea61fc060
  style aea890c6_499d_589a_9dd7_0d29b172ee5f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/tracers/base.py lines 710–724

    async def on_chain_end(
        self,
        outputs: dict[str, Any],
        *,
        run_id: UUID,
        inputs: dict[str, Any] | None = None,
        **kwargs: Any,
    ) -> None:
        chain_run = self._complete_chain_run(
            outputs=outputs,
            run_id=run_id,
            inputs=inputs,
        )
        tasks = [self._end_trace(chain_run), self._on_chain_end(chain_run)]
        await asyncio.gather(*tasks)

Domain

Subdomains

Called By

Frequently Asked Questions

What does on_chain_end() do?
on_chain_end() is a function in the langchain codebase, defined in libs/core/langchain_core/tracers/base.py.
Where is on_chain_end() defined?
on_chain_end() is defined in libs/core/langchain_core/tracers/base.py at line 710.
What does on_chain_end() call?
on_chain_end() calls 3 function(s): _end_trace, _on_chain_end, on_chain_end.
What calls on_chain_end()?
on_chain_end() is called by 1 function(s): on_chain_end.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free