ChainManagerMixin#
- class langchain_core.callbacks.base.ChainManagerMixin[source]#
Mixin for chain callbacks.
Methods
on_agent_action
(action, *, run_id[, ...])Run on agent action.
on_agent_finish
(finish, *, run_id[, ...])Run on the agent end.
on_chain_end
(outputs, *, run_id[, parent_run_id])Run when chain ends running.
on_chain_error
(error, *, run_id[, parent_run_id])Run when chain errors.
- on_agent_action(
- action: AgentAction,
- *,
- run_id: UUID,
- parent_run_id: UUID | None = None,
- **kwargs: Any,
Run on agent action.
- Parameters:
action (AgentAction) – The agent action.
run_id (UUID) – The run ID. This is the ID of the current run.
parent_run_id (UUID) – The parent run ID. This is the ID of the parent run.
kwargs (Any) – Additional keyword arguments.
- Return type:
Any
- on_agent_finish(
- finish: AgentFinish,
- *,
- run_id: UUID,
- parent_run_id: UUID | None = None,
- **kwargs: Any,
Run on the agent end.
- Parameters:
finish (AgentFinish) – The agent finish.
run_id (UUID) – The run ID. This is the ID of the current run.
parent_run_id (UUID) – The parent run ID. This is the ID of the parent run.
kwargs (Any) – Additional keyword arguments.
- Return type:
Any
- on_chain_end(
- outputs: dict[str, Any],
- *,
- run_id: UUID,
- parent_run_id: UUID | None = None,
- **kwargs: Any,
Run when chain ends running.
- Parameters:
outputs (dict[str, Any]) – The outputs of the chain.
run_id (UUID) – The run ID. This is the ID of the current run.
parent_run_id (UUID) – The parent run ID. This is the ID of the parent run.
kwargs (Any) – Additional keyword arguments.
- Return type:
Any
- on_chain_error(
- error: BaseException,
- *,
- run_id: UUID,
- parent_run_id: UUID | None = None,
- **kwargs: Any,
Run when chain errors.
- Parameters:
error (BaseException) – The error that occurred.
run_id (UUID) – The run ID. This is the ID of the current run.
parent_run_id (UUID) – The parent run ID. This is the ID of the parent run.
kwargs (Any) – Additional keyword arguments.
- Return type:
Any