Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKGet startedIntroductionInstallationQuickstartLangChain Expression LanguageInterfaceHow toCookbookLangChain Expression Language (LCEL)Why use LCEL?ModulesModel I/‚ÄãORetrievalChainsMemoryAgentsAgent TypesHow-toAdd Memory to OpenAI Functions AgentRunning Agent as an IteratorReturning Structured OutputCombine agents and vector storesAsync APICreate ChatGPT cloneCustom functions with OpenAI Functions AgentCustom agentCustom agent with tool retrievalCustom LLM agentCustom LLM Agent (with a ChatModel)Custom MRKL agentCustom multi-action agentHandle parsing errorsAccess intermediate stepsCap the max number of iterationsTimeouts for agentsReplicating MRKLShared memory across agents and toolsStreaming final agent outputUse ToolKits with OpenAI FunctionsToolsToolkitsCallbacksModulesSecurityGuidesMoreModulesAgentsHow-toAsync APIOn this pageAsync APILangChain provides async support for Agents by leveraging the asyncio library.Async methods are currently supported for the following Tools: GoogleSerperAPIWrapper, SerpAPIWrapper, LLMMathChain and Qdrant. Async support for other agent tools are on the roadmap.For Tools that have a coroutine implemented (the four mentioned above), the AgentExecutor will await them directly. Otherwise, the AgentExecutor will call the Tool's func via asyncio.get_event_loop().run_in_executor to avoid blocking the main runloop.You can use arun to call an AgentExecutor asynchronously.Serial vs. concurrent execution‚ÄãIn this example, we kick off agents to answer some questions serially vs. concurrently. You can see that concurrent execution significantly speeds this up.import asyncioimport timefrom langchain.agents import initialize_agent, load_toolsfrom langchain.agents import AgentTypefrom langchain.llms import OpenAIfrom langchain.callbacks.stdout import StdOutCallbackHandlerfrom langchain.callbacks.tracers import
LangChain provides async support for Agents by leveraging the asyncio library.
LangChain provides async support for Agents by leveraging the asyncio library. ->: Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKGet startedIntroductionInstallationQuickstartLangChain Expression LanguageInterfaceHow toCookbookLangChain Expression Language (LCEL)Why use LCEL?ModulesModel I/‚ÄãORetrievalChainsMemoryAgentsAgent TypesHow-toAdd Memory to OpenAI Functions AgentRunning Agent as an IteratorReturning Structured OutputCombine agents and vector storesAsync APICreate ChatGPT cloneCustom functions with OpenAI Functions AgentCustom agentCustom agent with tool retrievalCustom LLM agentCustom LLM Agent (with a ChatModel)Custom MRKL agentCustom multi-action agentHandle parsing errorsAccess intermediate stepsCap the max number of iterationsTimeouts for agentsReplicating MRKLShared memory across agents and toolsStreaming final agent outputUse ToolKits with OpenAI FunctionsToolsToolkitsCallbacksModulesSecurityGuidesMoreModulesAgentsHow-toAsync APIOn this pageAsync APILangChain provides async support for Agents by leveraging the asyncio library.Async methods are currently supported for the following Tools: GoogleSerperAPIWrapper, SerpAPIWrapper, LLMMathChain and Qdrant. Async support for other agent tools are on the roadmap.For Tools that have a coroutine implemented (the four mentioned above), the AgentExecutor will await them directly. Otherwise, the AgentExecutor will call the Tool's func via asyncio.get_event_loop().run_in_executor to avoid blocking the main runloop.You can use arun to call an AgentExecutor asynchronously.Serial vs. concurrent execution‚ÄãIn this example, we kick off agents to answer some questions serially vs. concurrently. You can see that concurrent execution significantly speeds this up.import asyncioimport timefrom langchain.agents import initialize_agent, load_toolsfrom langchain.agents import AgentTypefrom langchain.llms import OpenAIfrom langchain.callbacks.stdout import StdOutCallbackHandlerfrom langchain.callbacks.tracers import