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-classicagentsstructured_chatbase
    Moduleā—Since v1.0

    base

    Attributes

    Functions

    Classes

    View source on GitHub
    attribute
    FORMAT_INSTRUCTIONS: str
    attribute
    PREFIX: str
    attribute
    SUFFIX: str
    attribute
    HUMAN_MESSAGE_TEMPLATE: str
    function
    format_log_to_str
    function
    create_structured_chat_agent
    class
    AgentOutputParser
    class
    JSONAgentOutputParser
    class
    StructuredChatOutputParserWithRetries
    deprecatedclass
    Agent
    deprecatedclass
    LLMChain
    deprecatedclass
    StructuredChatAgent

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

    Create an agent aimed at supporting tools with multiple inputs.

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

    Output parser with retries for the structured chat agent.

    Agent that calls the language model and deciding the action.

    This is driven by a LLMChain. The prompt in the LLMChain MUST include a variable called "agent_scratchpad" where the agent can put its intermediary work.

    Structured Chat Agent.

    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"}
    

    Chain to run queries against LLMs.

    This class is deprecated. See below for an example implementation using LangChain runnables:

    from langchain_core.output_parsers import StrOutputParser
    from langchain_core.prompts import PromptTemplate
    from langchain_openai import OpenAI
    
    prompt_template = "Tell me a {adjective} joke"
    prompt = PromptTemplate(input_variables=["adjective"], template=prompt_template)
    model = OpenAI()
    chain = prompt | model | StrOutputParser()
    
    chain.invoke("your adjective here")