LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
    • Overview
    • Caches
    • Callbacks
    • Documents
    • Document loaders
    • Embeddings
    • Exceptions
    • Language models
    • Serialization
    • Output parsers
    • Prompts
    • Rate limiters
    • Retrievers
    • Runnables
    • Utilities
    • Vector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    OverviewCachesCallbacksDocumentsDocument loadersEmbeddingsExceptionsLanguage modelsSerializationOutput parsersPromptsRate limitersRetrieversRunnablesUtilitiesVector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    Language
    Theme
    Pythonlangchain-coreagentsAgentAction
    Class●Since v0.1

    AgentAction

    Copy
    AgentAction(
      self,
      tool: str,
      tool_input: str | dict,
      log: str

    Bases

    Serializable

    Constructors

    Attributes

    Methods

    Inherited fromSerializable

    Attributes

    Alc_secrets: dict[str, str]
    —

    A map of constructor argument names to secret ids.

    Alc_attributes: dict
    —

    List of attribute names that should be included in the serialized kwargs.

    Amodel_config

    Methods

    View source on GitHub
    ,
    **
    kwargs
    :
    Any
    =
    {
    }
    )
    M
    lc_id
    —

    Return a unique identifier for this class for serialization purposes.

    Mto_json
    —

    Serialize the object to JSON.

    Mto_json_not_implemented
    —

    Serialize a "not implemented" object.

    Parameters

    NameTypeDescription
    tool*str
    tool_input*str | dict
    log*str
    constructor
    __init__
    NameType
    toolstr
    tool_inputstr | dict
    logstr
    attribute
    tool: str
    attribute
    tool_input: str | dict
    attribute
    log: str
    attribute
    type: Literal['AgentAction']
    attribute
    messages: Sequence[BaseMessage]
    method
    is_lc_serializable
    method
    get_lc_namespace

    Represents a request to execute an action by an agent.

    The action consists of the name of the tool to execute and the input to pass to the tool. The log is used to pass along extra information about the action.

    The name of the tool to execute.

    The input to pass in to the Tool.

    Additional information to log about the action.

    The name of the Tool to execute.

    The input to pass in to the Tool.

    Additional information to log about the action.

    This log can be used in a few ways. First, it can be used to audit what exactly the LLM predicted to lead to this (tool, tool_input).

    Second, it can be used in future iterations to show the LLMs prior thoughts. This is useful when (tool, tool_input) does not contain full information about the LLM prediction (for example, any thought before the tool/tool_input).

    Return the messages that correspond to this action.

    AgentAction is serializable.

    Get the namespace of the LangChain object.