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

    agent

    Chain that takes in an input and produces an action and action input.

    Attributes

    Classes

    Type Aliases

    View source on GitHub
    attribute
    AGENT_DEPRECATION_WARNING: str
    attribute
    logger
    attribute
    NextStepOutput: list[AgentFinish | AgentAction | AgentStep]
    class
    AgentExecutorIterator
    class
    InvalidTool
    class
    Chain
    class
    BaseSingleActionAgent
    class
    BaseMultiActionAgent
    class
    AgentOutputParser
    class
    MultiActionAgentOutputParser
    class
    RunnableAgent
    class
    RunnableMultiActionAgent
    class
    ExceptionTool
    class
    AgentExecutor
    deprecatedclass
    AgentType
    deprecatedclass
    LLMChain
    deprecatedclass
    LLMSingleActionAgent
    deprecatedclass
    Agent
    typeAlias
    RunnableAgentType

    Iterator for AgentExecutor.

    Tool that is run when invalid tool name is encountered by agent.

    Abstract base class for creating structured sequences of calls to components.

    Chains should be used to encode a sequence of calls to components like models, document retrievers, other chains, etc., and provide a simple interface to this sequence.

    Base Single Action Agent class.

    Base Multi Action Agent class.

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

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

    This is used for agents that can return multiple actions.

    Agent powered by Runnables.

    Agent powered by Runnables.

    Tool that just returns the query.

    Agent that is using tools.

    An enum for agent types.

    Base class for single action agents.

    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.

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