LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • MCP Adapters
    • Overview
    • Agents
    • Callbacks
    • Chains
    • Chat models
    • Embeddings
    • Evaluation
    • Globals
    • Hub
    • Memory
    • Output parsers
    • Retrievers
    • Runnables
    • LangSmith
    • Storage
    Standard Tests
    Text Splitters
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    MCP Adapters
    OverviewAgentsCallbacksChainsChat modelsEmbeddingsEvaluationGlobalsHubMemoryOutput parsersRetrieversRunnablesLangSmithStorage
    Standard Tests
    Text Splitters
    Language
    Theme
    Pythonlangchain-classicagentsformat_scratchpad
    Module●Since v1.0

    format_scratchpad

    Logic for formatting intermediate steps into an agent scratchpad.

    Intermediate steps refers to the list of (AgentAction, observation) tuples that result from previous iterations of the agent. Depending on the prompting strategy you are using, you may want to format these differently before passing them into the LLM.

    Attributes

    attribute
    format_to_openai_functions: format_to_openai_function_messages

    Functions

    function
    format_log_to_str

    Construct the scratchpad that lets the agent continue its thought process.

    function
    format_log_to_messages

    Construct the scratchpad that lets the agent continue its thought process.

    function
    format_to_openai_function_messages

    Convert (AgentAction, tool output) tuples into FunctionMessages.

    function
    format_to_tool_messages

    Convert (AgentAction, tool output) tuples into ToolMessage objects.

    function
    format_xml

    Format the intermediate steps as XML.

    Modules

    module
    log_to_messages
    module
    openai_functions
    module
    openai_tools
    module
    xml
    module
    log
    module
    tools
    View source on GitHub