langchain-azure-dynamic-sessions
An integration package connecting Azure Container Apps dynamic sessions and LangChain
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 on this page — 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
langchain-azure-dynamic-sessions on PyPI
pip
pip install langchain-azure-dynamic-sessionsuv
uv add langchain-azure-dynamic-sessionspoetry
poetry add langchain-azure-dynamic-sessionsInstalling 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 the current Python release (<4.0,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — azure-core, azure-identity, langchain-core, requests |
| Maintenance | actively maintained — 52 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 107,704/month — #12,602 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: langchain_azure_dynamic_sessions-1.0.3-py3-none-any.whl
Tags
More Application Frameworks packages
FastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
textualTextual is a Python framework for building…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
mcpBuild and connect to Model Context Protocol…
permissive · top 1,000 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
langchain-azure-aiIntegrates Microsoft Foundry (Azure AI)…
permissive · top 5,000 on PyPI
langchain-modalIntegrates Modal serverless compute sandboxes…
permissive · top 15,000 on PyPI
langchain-daytonaIntegrates Daytona sandboxes with LangChain's…
permissive · top 15,000 on PyPI
composio-langchainBridges Composio's 1000+ app integrations into…
permissive · top 15,000 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
langchain-cliCommand-line interface for building, testing,…
permissive · top 15,000 on PyPI
langchain-coreLangChain Core provides the foundational…
permissive · top 1,000 on PyPI
langchain-exaIntegrates Exa's web search API with LangChain,…
permissive · top 15,000 on PyPI
langchain-awsConnects LangChain applications to AWS services…
permissive · top 5,000 on PyPI
langchain-communityProvides third-party integrations for LangChain…
permissive · top 1,000 on PyPI