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

    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.

    Copy
    AgentAction(
      self,
      tool: str,
      tool_input: str | dict,
      log: str,
      **kwargs: Any = {}
    )

    Bases

    Serializable

    Parameters

    NameTypeDescription
    tool*str

    The name of the tool to execute.

    tool_input*str | dict

    The input to pass in to the Tool.

    log*str

    Additional information to log about the action.

    Constructors

    constructor
    __init__
    NameType
    toolstr
    tool_inputstr | dict
    logstr

    Attributes

    attribute
    tool: str

    The name of the Tool to execute.

    attribute
    tool_input: str | dict

    The input to pass in to the Tool.

    attribute
    log: str

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

    attribute
    type: Literal['AgentAction']
    attribute
    messages: Sequence[BaseMessage]

    Return the messages that correspond to this action.

    Methods

    method
    is_lc_serializable

    AgentAction is serializable.

    method
    get_lc_namespace

    Get the namespace of the LangChain object.

    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

    Mlc_id
    —

    Return a unique identifier for this class for serialization purposes.

    Mto_json
    —

    Convert the graph to a JSON-serializable format.

    Mto_json_not_implemented
    —

    Serialize a "not implemented" object.

    View source on GitHub