text: Skip to main contentğŸ¦œï¸�ğŸ”— LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKUse casesQA and Chat over DocumentsAnalyzing structured dataExtractionInteracting with APIsChatbotsSummarizationCode UnderstandingAgent simulationsAgentsBabyAGI User GuideBabyAGI with ToolsCAMEL Role-Playing Autonomous Cooperative AgentsCustom Agent with PlugIn RetrievalPlug-and-Plaimulti_modal_output_agentSalesGPT - Your Context-Aware AI Sales Assistant With Knowledge BaseWikibase AgentAutonomous (long-running) agentsMulti-modalUse casesAgentsCustom Agent with PlugIn RetrievalOn this pageCustom Agent with PlugIn RetrievalThis notebook combines two concepts in order to build a custom agent that can interact with AI Plugins:Custom Agent with Tool Retrieval: This introduces the concept of retrieving many tools, which is useful when trying to work with arbitrarily many plugins.Natural Language API Chains: This creates Natural Language wrappers around OpenAPI endpoints. This is useful because (1) plugins use OpenAPI endpoints under the hood, (2) wrapping them in an NLAChain allows the router agent to call it more easily.The novel idea introduced in this notebook is the idea of using retrieval to select not the tools explicitly, but the set of OpenAPI specs to use. We can then generate tools from those OpenAPI specs. The use case for this is when trying to get agents to use plugins. It may be more efficient to choose plugins first, then the endpoints, rather than the endpoints directly. This is because the plugins may contain more useful information for selection.Set up environmentâ€‹Do necessary imports, etc.from langchain.agents import (    Tool,    AgentExecutor,    LLMSingleActionAgent,    AgentOutputParser,)from langchain.prompts import StringPromptTemplatefrom langchain import OpenAI, SerpAPIWrapper, LLMChainfrom