skillfed

langchain-azure-dynamic-sessions

An integration package connecting Azure Container Apps dynamic sessions and LangChain

langchain-azure-dynamic-sessions v1.0.3 107.7K downloads/30d#12,602 on PyPI142
Permissive 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) Active released

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-sessions

uv

uv add langchain-azure-dynamic-sessions

poetry

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 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

License :: Other/Proprietary LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

langchain azure code executionazure container apps session poolagent python repl toolsecure code interpreter azurebash command execution agentazure dynamic sessions langchainagent code sandbox
langchain-integrationazure-container-appsagent-tools

More Application Frameworks packages