SessionsBashTool()Azure Dynamic Sessions Bash tool for executing shell commands.
Setup:
pip install -U langchain-azure-dynamic-sessions
import getpass
POOL_MANAGEMENT_ENDPOINT = getpass.getpass("Enter the management endpoint of the session pool: ")
Instantiation:
from langchain_azure_dynamic_sessions import SessionsBashTool
tool = SessionsBashTool(
pool_management_endpoint=POOL_MANAGEMENT_ENDPOINT
)
Invocation with args:
tool.invoke("echo hello")
'{\\n "stdout": "hello\\n",\\n "stderr": "",\\n "exitCode": 0\\n}'
Invocation with ToolCall:
tool.invoke({"args": {"input":"echo hello"}, "id": "1", "name": tool.name, "type": "tool_call"})
'{\\n "stdout": "hello\\n",\\n "stderr": "",\\n "exitCode": 0\\n}'