Home / Class/ AgentActionMessageLog Class — langchain Architecture

AgentActionMessageLog Class — langchain Architecture

Architecture documentation for the AgentActionMessageLog class in agents.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  4d5d5c85_96de_d44d_3e27_3d7bb6857295["AgentActionMessageLog"]
  a835cf98_21c1_0dc9_4dd3_8934600e2826["AgentAction"]
  4d5d5c85_96de_d44d_3e27_3d7bb6857295 -->|extends| a835cf98_21c1_0dc9_4dd3_8934600e2826
  81828515_0fcd_6cb4_96b8_62d4fca3e4ff["agents.py"]
  4d5d5c85_96de_d44d_3e27_3d7bb6857295 -->|defined in| 81828515_0fcd_6cb4_96b8_62d4fca3e4ff

Relationship Graph

Source Code

libs/core/langchain_core/agents.py lines 105–128

class AgentActionMessageLog(AgentAction):
    """Representation of an action to be executed by an agent.

    This is similar to `AgentAction`, but includes a message log consisting of
    chat messages.

    This is useful when working with `ChatModels`, and is used to reconstruct
    conversation history from the agent's perspective.
    """

    message_log: Sequence[BaseMessage]
    """Similar to log, this can be used to pass along extra information about what exact
    messages were predicted by the LLM before parsing out the `(tool, tool_input)`.

    This is again useful if `(tool, tool_input)` cannot be used to fully recreate the
    LLM prediction, and you need that LLM prediction (for future agent iteration).

    Compared to `log`, this is useful when the underlying LLM is a chat model (and
    therefore returns messages rather than a string).
    """
    # Ignoring type because we're overriding the type from AgentAction.
    # And this is the correct thing to do in this case.
    # The type literal is used for serialization purposes.
    type: Literal["AgentActionMessageLog"] = "AgentActionMessageLog"  # type: ignore[assignment]

Extends

Frequently Asked Questions

What is the AgentActionMessageLog class?
AgentActionMessageLog is a class in the langchain codebase, defined in libs/core/langchain_core/agents.py.
Where is AgentActionMessageLog defined?
AgentActionMessageLog is defined in libs/core/langchain_core/agents.py at line 105.
What does AgentActionMessageLog extend?
AgentActionMessageLog extends AgentAction.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free