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

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    MCP Adapters
    Standard Tests
    Text Splitters
    OverviewAgentsCallbacksChainsChat modelsEmbeddingsEvaluationGlobalsHubMemoryOutput parsersRetrieversRunnablesLangSmithStorage
    Language
    Theme
    Pythonlangchain-classicagentsjson_chatbase
    Moduleā—Since v1.0

    base

    Attributes

    Functions

    Classes

    View source on GitHub
    attribute
    TEMPLATE_TOOL_RESPONSE: str
    function
    format_log_to_messages
    function
    create_json_chat_agent
    class
    JSONAgentOutputParser

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

    Create an agent that uses JSON to format its logic, build for Chat Models.

    Parses tool invocations and final answers in JSON format.

    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.

    {"action": "search", "action_input": "2+2"}
    

    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.

    {"action": "Final Answer", "action_input": "4"}