Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKProvidersAnthropicAWSGoogleMicrosoftOpenAIMoreComponentsLLMsChat modelsDocument loadersDocument transformersText embedding modelsVector storesRetrieversToolsAlpha VantageApifyArXivAWS LambdaShell (bash)Bearly Code InterpreterBing SearchBrave SearchChatGPT PluginsDall-E Image GeneratorDataForSeoDuckDuckGo SearchEden AIEleven Labs Text2SpeechFile SystemGolden QueryGoogle DriveGoogle PlacesGoogle SearchGoogle SerperGradioGraphQLHuggingFace Hub ToolsHuman as a toolIFTTT WebHooksLemon AgentMetaphor SearchNuclia UnderstandingOpenWeatherMapPubMedRequestsSceneXplainSearch ToolsSearchApiSearxNG SearchSerpAPITwilioWikipediaWolfram AlphaYahoo Finance NewsYouTubeZapier Natural Language ActionsAgents and toolkitsMemoryCallbacksChat loadersComponentsToolsShell (bash)On this pageShell (bash)Giving agents access to the shell is powerful (though risky outside a sandboxed environment).The LLM can use it to execute any shell commands. A common use case for this is letting the LLM interact with your local file system.Note: Shell tool does not work with Windows OS.from langchain.tools import ShellToolshell_tool = ShellTool()print(shell_tool.run({"commands": ["echo 'Hello World!'", "time"]}))    Hello World!        real    0m0.000s    user    0m0.000s    sys 0m0.000s        /Users/wfh/code/lc/lckg/langchain/tools/shell/tool.py:34: UserWarning: The shell tool has no safeguards by default. Use at your own risk.      warnings.warn(Use with Agents‚ÄãAs with all tools, these can be given to an agent to accomplish more complex tasks. Let's have the agent fetch some links from a web page.from langchain.chat_models import ChatOpenAIfrom langchain.agents import initialize_agentfrom langchain.agents import AgentTypellm = ChatOpenAI(temperature=0)shell_tool.description = shell_tool.description + f"args {shell_tool.args}".replace(    "{", "{{").replace("}",
Giving agents access to the shell is powerful (though risky outside a sandboxed environment).
Giving agents access to the shell is powerful (though risky outside a sandboxed environment). ->: Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKProvidersAnthropicAWSGoogleMicrosoftOpenAIMoreComponentsLLMsChat modelsDocument loadersDocument transformersText embedding modelsVector storesRetrieversToolsAlpha VantageApifyArXivAWS LambdaShell (bash)Bearly Code InterpreterBing SearchBrave SearchChatGPT PluginsDall-E Image GeneratorDataForSeoDuckDuckGo SearchEden AIEleven Labs Text2SpeechFile SystemGolden QueryGoogle DriveGoogle PlacesGoogle SearchGoogle SerperGradioGraphQLHuggingFace Hub ToolsHuman as a toolIFTTT WebHooksLemon AgentMetaphor SearchNuclia UnderstandingOpenWeatherMapPubMedRequestsSceneXplainSearch ToolsSearchApiSearxNG SearchSerpAPITwilioWikipediaWolfram AlphaYahoo Finance NewsYouTubeZapier Natural Language ActionsAgents and toolkitsMemoryCallbacksChat loadersComponentsToolsShell (bash)On this pageShell (bash)Giving agents access to the shell is powerful (though risky outside a sandboxed environment).The LLM can use it to execute any shell commands. A common use case for this is letting the LLM interact with your local file system.Note: Shell tool does not work with Windows OS.from langchain.tools import ShellToolshell_tool = ShellTool()print(shell_tool.run({"commands": ["echo 'Hello World!'", "time"]}))    Hello World!        real    0m0.000s    user    0m0.000s    sys 0m0.000s        /Users/wfh/code/lc/lckg/langchain/tools/shell/tool.py:34: UserWarning: The shell tool has no safeguards by default. Use at your own risk.      warnings.warn(Use with Agents‚ÄãAs with all tools, these can be given to an agent to accomplish more complex tasks. Let's have the agent fetch some links from a web page.from langchain.chat_models import ChatOpenAIfrom langchain.agents import initialize_agentfrom langchain.agents import AgentTypellm = ChatOpenAI(temperature=0)shell_tool.description = shell_tool.description + f"args {shell_tool.args}".replace(    "{", "{{").replace("}",