LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • LangGraph Checkpoint
    LangGraph Store
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    LangGraph Checkpoint
    LangGraph Store
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    Language
    Theme
    Pythonlanggraph-supervisoragent_namewith_agent_name
    Function●Since v0.0

    with_agent_name

    Copy
    with_agent_name(
      model: LanguageModelLike,
      agent_name_mode: AgentNameMode
    ) -> LanguageModelLike
    View source on GitHub

    Parameters

    NameTypeDescription
    model*LanguageModelLike

    Language model to add agent name formatting to.

    agent_name_mode*AgentNameMode

    Use to specify how to expose the agent name to the LLM.

    • "inline": Add the agent name directly into the content field of the AI message using XML-style tags. Example: "How can I help you" -> "agent_nameHow can I help you?".

    Attach formatted agent names to the messages passed to and from a language model.

    This is useful for making a message history with multiple agents more coherent.

    agent name is consumed from the message.name field.:

    If you're using an agent built with create_react_agent, name is automatically set. If you're building a custom agent, make sure to set the name on the AI message returned by the LLM.