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-coreagentsAgentFinish
    Class●Since v0.1

    AgentFinish

    Final return value of an ActionAgent.

    Agents return an AgentFinish when they have reached a stopping condition.

    Copy
    AgentFinish(
      self,
      return_values: dict,
      log: str,
      **kwargs: Any = {}
    )

    Bases

    Serializable

    Constructors

    constructor
    __init__
    NameType
    return_valuesdict
    logstr

    Attributes

    attribute
    return_values: dict

    Dictionary of return values.

    attribute
    log: str

    Additional information to log about the return value.

    This is used to pass along the full LLM prediction, not just the parsed out return value.

    For example, if the full LLM prediction was Final Answer: 2 you may want to just return 2 as a return value, but pass along the full string as a log (for debugging or observability purposes).

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

    Messages that correspond to this observation.

    Methods

    method
    is_lc_serializable

    Return True as this class 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