• Asynchronous function that creates a conversational retrieval agent using a language model, tools, and options. It initializes the buffer memory based on the provided options and initializes the AgentExecutor with the tools, language model, and memory.

    Parameters

    • llm: ChatOpenAI<ChatOpenAICallOptions>

      Instance of ChatOpenAI used as the language model for the agent.

    • tools: StructuredToolInterface<ZodObjectAny>[]

      Array of StructuredTool instances used by the agent.

    • Optionaloptions: ConversationalRetrievalAgentOptions

      Optional ConversationalRetrievalAgentOptions to customize the agent.

    Returns Promise<AgentExecutor>

    A Promise that resolves to an initialized AgentExecutor.