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-classicagentsreactagent
    Module●Since v1.0

    agent

    Functions

    function
    format_log_to_str

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

    function
    create_react_agent

    Create an agent that uses ReAct prompting.

    Based on paper "ReAct: Synergizing Reasoning and Acting in Language Models" (https://arxiv.org/abs/2210.03629)

    Warning

    This implementation is based on the foundational ReAct paper but is older and not well-suited for production applications.

    For a more robust and feature-rich implementation, we recommend using the create_agent function from the langchain library.

    See the reference doc for more information.

    Classes

    class
    AgentOutputParser

    Base class for parsing agent output into agent action/finish.

    class
    ReActSingleInputOutputParser

    Parses ReAct-style LLM calls that have a single tool input.

    Expects output to be in one of two formats.

    If the output signals that an action should be taken, should be in the below format. This will result in an AgentAction being returned.

    Thought: agent thought here
    Action: search
    Action Input: what is the temperature in SF?
    

    If the output signals that a final answer should be given, should be in the below format. This will result in an AgentFinish being returned.

    Thought: agent thought here
    Final Answer: The temperature is 100 degrees
    
    View source on GitHub