LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • MCP Adapters
    Standard Tests
    Text Splitters
    • Overview
    • Agents
    • Callbacks
    • Chains
    • Chat models
    • Embeddings
    • Evaluation
    • Globals
    • Hub
    • Memory
    • Output parsers
    • Retrievers
    • Runnables
    • LangSmith
    • Storage
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    MCP Adapters
    Standard Tests
    Text Splitters
    OverviewAgentsCallbacksChainsChat modelsEmbeddingsEvaluationGlobalsHubMemoryOutput parsersRetrieversRunnablesLangSmithStorage
    Language
    Theme
    Pythonlangchain-classicagentsopenai_functions_agentbaseOpenAIFunctionsAgent
    Class●Since v1.0Deprecated

    OpenAIFunctionsAgent

    Copy
    OpenAIFunctionsAgent()

    Bases

    BaseSingleActionAgent

    Used in Docs

    • Robocorp toolkit integration

    Attributes

    Methods

    Inherited fromBaseSingleActionAgent

    Attributes

    Areturn_values: list[str]
    —

    Return values of the agent.

    Methods

    Mdict
    —

    Return dictionary representation of agent.

    Msave
    —

    Save the agent.

    View source on GitHub
    M
    tool_run_logging_kwargs
    —

    Return logging kwargs for tool run.

    Parameters

    NameTypeDescription
    llm*unknown
    tools*unknown
    prompt*unknown
    output_parser*unknown
    attribute
    llm: BaseLanguageModel
    attribute
    tools: Sequence[BaseTool]
    attribute
    prompt: BasePromptTemplate
    attribute
    output_parser: type[OpenAIFunctionsAgentOutputParser]
    attribute
    input_keys: list[str]
    attribute
    functions: list[dict]
    method
    get_allowed_tools
    method
    validate_prompt
    method
    plan
    method
    aplan
    method
    return_stopped_response
    method
    create_prompt
    method
    from_llm_and_tools

    An Agent driven by OpenAIs function powered API.

    This should be an instance of ChatOpenAI, specifically a model that supports using functions.

    The tools this agent has access to.

    The prompt for this agent, should support agent_scratchpad as one of the variables. For an easy way to construct this prompt, use OpenAIFunctionsAgent.create_prompt(...)

    The output parser for this agent. Should be an instance of OpenAIFunctionsAgentOutputParser.

    Get input keys. Input refers to user input here.

    Get functions.

    Get allowed tools.

    Validate prompt.

    Given input, decided what to do.

    Async given input, decided what to do.

    Return response when agent has been stopped due to max iterations.

    Create prompt for this agent.

    Construct an agent from an LLM and tools.