LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • LangGraph Checkpoint
    LangGraph Store
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    LangGraph Checkpoint
    LangGraph Store
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    Language
    Theme
    Pythonlanggraph.prebuilt_tool_call_transformerToolCallTransformer
    Class●Since v1.1

    ToolCallTransformer

    Copy
    ToolCallTransformer(
        self,
        scope: tuple[str, ...] = (),
    )

    Bases

    StreamTransformer

    Used in Docs

    • Event streaming

    Constructors

    Attributes

    Methods

    View source on GitHub
    constructor
    __init__
    NameType
    scopetuple[str, ...]
    attribute
    required_stream_modes
    method
    init
    method
    process
    method
    finalize

    Close any still-active tool streams left open at run end.

    method
    fail

    Fail any still-active tool streams when the run errors.

    Project tools channel events into ToolCallStream handles.

    Each tool-started event spawns a ToolCallStream, pushed onto run.tool_calls. Subsequent tool-output-delta events append to that stream's deltas log; tool-finished and tool-error close it.

    Native transformer — the tool_calls projection is exposed as a direct attribute on the run stream.

    A nameless StreamChannel[ToolCallStream] is used (no protocol auto-forwarding) because the live handles are not serializable and should not be injected into the main event log. Wire consumers subscribe to the tools channel instead, where the raw protocol events flow through untouched by this transformer (process returns True).

    Registered explicitly by users at compile time via builder.compile(transformers=[ToolCallTransformer]) — not a default built-in, so the tools channel is user-opt-in.