on_chain_end() — langchain Function Reference
Architecture documentation for the on_chain_end() function in event_stream.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD d38cbd4d_fc35_d53c_9d4f_e6a10db4ea23["on_chain_end()"] 33d093c4_1ed0_fc6a_17c6_762d4c5cfa04["_AstreamEventsCallbackHandler"] d38cbd4d_fc35_d53c_9d4f_e6a10db4ea23 -->|defined in| 33d093c4_1ed0_fc6a_17c6_762d4c5cfa04 87f79bee_f9c5_8262_1829_62f633c4f870["_send()"] d38cbd4d_fc35_d53c_9d4f_e6a10db4ea23 -->|calls| 87f79bee_f9c5_8262_1829_62f633c4f870 9aed8e4f_9d4c_016f_aa43_c5908015cf8d["_get_parent_ids()"] d38cbd4d_fc35_d53c_9d4f_e6a10db4ea23 -->|calls| 9aed8e4f_9d4c_016f_aa43_c5908015cf8d style d38cbd4d_fc35_d53c_9d4f_e6a10db4ea23 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/tracers/event_stream.py lines 598–630
async def on_chain_end(
self,
outputs: dict[str, Any],
*,
run_id: UUID,
inputs: dict[str, Any] | None = None,
**kwargs: Any,
) -> None:
"""End a trace for a chain run."""
run_info = self.run_map.pop(run_id)
run_type = run_info["run_type"]
event = f"on_{run_type}_end"
inputs = inputs or run_info.get("inputs") or {}
data: EventData = {
"output": outputs,
"input": inputs,
}
self._send(
{
"event": event,
"data": data,
"run_id": str(run_id),
"name": run_info["name"],
"tags": run_info["tags"],
"metadata": run_info["metadata"],
"parent_ids": self._get_parent_ids(run_id),
},
run_type,
)
Domain
Subdomains
Calls
Source
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/event_stream.py.
Where is on_chain_end() defined?
on_chain_end() is defined in libs/core/langchain_core/tracers/event_stream.py at line 598.
What does on_chain_end() call?
on_chain_end() calls 2 function(s): _get_parent_ids, _send.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free