Skip to main content

Azure Blob Storage filesystem backend for LangChain Deep Agents

Project description

deepagents-azure-blob-backend

CI codecov PyPI Version PyPI Downloads Supported Python Versions API Docs autofix.ci

Azure Blob Storage filesystem backend for LangChain Deep Agents.

Deep Agents exposes a BackendProtocol — a pluggable interface for file operations (read, write, edit, ls, glob, grep) that the agent uses as its virtual filesystem. This package provides an Azure Blob Storage implementation of that interface.

Installation

pip install deepagents-azure-blob-backend

Or with uv:

uv add deepagents-azure-blob-backend

This package requires deepagents>=0.6.1, where BackendProtocol exposes structured ls, glob, and grep result types.

Quick Start

import asyncio
from deepagents import create_deep_agent
from deepagents_azure_blob_backend import AzureBlobBackend, AzureBlobConfig

async def main():
    config = AzureBlobConfig(
        account_url="https://<your-account>.blob.core.windows.net",
        container_name="agent-workspace",
        prefix="session-001/",
    )
    backend = AzureBlobBackend(config)

    agent = create_deep_agent(backend=backend)

    result = await agent.ainvoke(
        {"messages": [{"role": "user", "content": "Create a hello world script at /hello.py"}]},
    )
    print(result["messages"][-1].content)
    await backend.close()

asyncio.run(main())

Configuration

from deepagents_azure_blob_backend import AzureBlobConfig

config = AzureBlobConfig(
    account_url="https://<account>.blob.core.windows.net",
    container_name="my-container",
    prefix="agent-workspace/",     # Namespace isolation for multi-agent setups
    max_concurrency=8,             # Parallel blob ops for grep/glob
    encoding="utf-8",
)

Authentication

AzureBlobConfig supports five mutually exclusive authentication methods. Set at most one credential source — if none is provided, DefaultAzureCredential is used automatically. account_url is required for all methods except connection string:

# 1. Connection string (e.g., Azurite or Azure Portal)
config = AzureBlobConfig(
    container_name="test",
    connection_string="UseDevelopmentStorage=true",
)

# 2. Account key
config = AzureBlobConfig(
    account_url="https://<account>.blob.core.windows.net",
    container_name="my-container",
    account_key="your-storage-account-key",
)

# 3. SAS token
config = AzureBlobConfig(
    account_url="https://<account>.blob.core.windows.net",
    container_name="my-container",
    sas_token="sv=2021-06-08&ss=b&srt=co&sp=rwdlacitfx&se=...",
)

# 4. Credential object (any Azure credential)
from azure.identity.aio import ClientSecretCredential
config = AzureBlobConfig(
    account_url="https://<account>.blob.core.windows.net",
    container_name="my-container",
    credential=ClientSecretCredential(tenant_id, client_id, client_secret),
)

# 5. Default (AAD) — omit all credential fields
config = AzureBlobConfig(
    account_url="https://<account>.blob.core.windows.net",
    container_name="my-container",
)

The default path uses DefaultAzureCredential, which supports az login, managed identity, workload identity federation (OIDC), and environment variables.

Supported Operations

All methods from BackendProtocol:

Method Async Description
ls(path) als List directory with synthesized subdirectories
read(path, offset, limit) aread Read file with line numbers
write(path, content) awrite Create new file (errors if exists)
edit(path, old, new) aedit String replacement editing
glob(pattern, path) aglob Glob pattern file matching
grep(pattern, path, glob) agrep Literal text search across files
upload_files(files) aupload_files Batch binary upload
download_files(paths) adownload_files Batch binary download

Development

# Install dev dependencies
uv sync --group dev

# Run unit tests
uv run pytest tests/unit_tests -v

# Run integration tests (requires Azurite)
docker run -p 10000:10000 mcr.microsoft.com/azure-storage/azurite azurite-blob --skipApiVersionCheck --blobHost 0.0.0.0
uv run pytest tests/integration_tests -v

# Lint and format
uv run ruff check .
uv run ruff format .

# Type check
uv run ty check

See the examples/ folder for runnable scripts with setup instructions.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deepagents_azure_blob_backend-0.4.1.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deepagents_azure_blob_backend-0.4.1-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file deepagents_azure_blob_backend-0.4.1.tar.gz.

File metadata

  • Download URL: deepagents_azure_blob_backend-0.4.1.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for deepagents_azure_blob_backend-0.4.1.tar.gz
Algorithm Hash digest
SHA256 b03edfa41c05336a338bdaad5b90410d7e24ab157ec695709f1d04f01e1473b8
MD5 ca47addf35a9f1301feb030018678391
BLAKE2b-256 fa2e51333c8eb6d64427102ec2c2b1be8b66fe48720ca39ffe54ef54899cdc13

See more details on using hashes here.

File details

Details for the file deepagents_azure_blob_backend-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: deepagents_azure_blob_backend-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for deepagents_azure_blob_backend-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cdf6b45342b418ce9669e8225db3ba4fb2819d14f13e12c6e0c6f4b231e3bd3d
MD5 a70994accb36a8c0e90112bb1058e32a
BLAKE2b-256 c734ee28e0facd131364bed78f6a54d9b76b6cd9904b60b3bf76367957703009

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page