--- id: langchain-azure-dynamic-sessions version: "1.0.3" license: MIT License Copyright (c) 2023 LangChain, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) license_treatment: permissive maintenance: active --- # langchain-azure-dynamic-sessions — An integration package connecting Azure Container Apps dynamic sessions and LangChain License: permissive · Maintenance: active · Downloads: 107.7K/mo ## What it is and what it does This package bridges LangChain agents and Azure Container Apps dynamic sessions, providing two tools—SessionsPythonREPLTool and SessionsBashTool—that let agents execute Python code and bash commands in isolated, managed containers. Rather than running code locally or in-process, the tools send execution requests to a session pool you provision in Azure, which spins up lightweight containers and returns results. This isolation is useful for safety and scalability: agents can run untrusted or resource-intensive code without affecting the host process. The package handles authentication via DefaultAzureCredential, manages session lifecycle (including automatic cleanup via context managers or explicit close/delete calls), and supports file operations—uploading, listing, and downloading files within the session. Version 1.0.3 added automatic session deletion after each invocation and asynchronous cleanup for concurrent workloads. It depends on azure-core, azure-identity, langchain-core, and requests, all standard Azure and LangChain libraries. Use it for: - Give a LangChain agent the ability to execute Python code (e.g., data analysis, math) without running it in your process. - Allow agents to run bash commands and shell scripts in a sandboxed Azure container for system-level tasks. - Upload local files to a session, process them with Python or bash, and download results—useful for batch data pipelines. - Build multi-turn agent workflows where each turn can execute code and persist files across invocations within the same session. - Isolate untrusted or user-provided code execution in a managed Azure environment rather than locally. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides LangChain integration tools to execute Python code and bash commands securely within Azure Container Apps dynamic sessions, enabling agents to run arbitrary code in isolated environments. Yes. The package is actively maintained, has no known vulnerabilities, and low installation friction. Install it if you are building LangChain agents on Azure and need to execute code (Python or bash) in isolated, managed containers. If you do not use Azure Container Apps or do not need agent code execution, it is not relevant. ## Install pip install langchain-azure-dynamic-sessions uv add langchain-azure-dynamic-sessions poetry add langchain-azure-dynamic-sessions ## Installing langchain-azure-dynamic-sessions Before you install: Low friction installation with a pure-Python wheel. Actively maintained with recent security patches and dependency refreshes; last release 52 days ago with no known vulnerabilities. License in practice: MIT License (permissive). You may use, modify, and distribute this package freely, including in proprietary applications, provided you retain the copyright notice and license text. Quickstart: from langchain_azure_dynamic_sessions.tools import SessionsPythonREPLTool tool = SessionsPythonREPLTool(pool_management_endpoint=POOL_MANAGEMENT_ENDPOINT) result = tool.run("print('hello')") tool.close() Requires an Azure Container Apps session pool and its management endpoint. Authentication uses DefaultAzureCredential; for user-assigned managed identity, set AZURE_CLIENT_ID environment variable. Principal must have Azure ContainerApps Session Executor role on the session pool. Verify before relying: - Whether the package supports async/await patterns for concurrent session management beyond the delete_session_after_invocation parameter mentioned in 1.0.3. - Performance characteristics and latency when executing code across the network to Azure Container Apps. - File upload/download size limits and bandwidth constraints for the SessionsBashTool file operations. ## Package facts - License: MIT License Copyright (c) 2023 LangChain, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 107.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags langchain azure code execution, azure container apps session pool, agent python repl tool, secure code interpreter azure, bash command execution agent, azure dynamic sessions langchain, agent code sandbox, langchain-integration, azure-container-apps, agent-tools [View on SkillFed](https://skillfed.io/packages/langchain-azure-dynamic-sessions) · [View on PyPI](https://pypi.org/project/langchain-azure-dynamic-sessions/)