azure-storage-queue-py

Azure Queue Storage SDK for Python. Use for reliable message queuing, task distribution, and asynchronous processing.

31,392 stars
Complexity: easy

About this skill

This skill equips AI agents with the ability to interact directly with Azure Queue Storage using the Python SDK. It provides a robust, scalable, and cost-effective mechanism for reliable message queuing, enabling agents to decouple tasks, distribute workloads across multiple processes, and facilitate asynchronous communication between different components or services. It's ideal for building resilient applications where messages need to be persisted and processed reliably, even if components are temporarily unavailable. The skill leverages `azure.identity.DefaultAzureCredential` for secure and flexible authentication with Azure.

Best use case

Decoupling microservices or components that don't need to communicate in real-time. Distributing computationally intensive tasks or background jobs to worker processes. Buffering requests to handle traffic spikes and ensure eventual processing. Implementing long-running workflows where intermediate states or messages need to be reliably stored. Integrating with other Azure services that leverage queues for event-driven architectures.

Azure Queue Storage SDK for Python. Use for reliable message queuing, task distribution, and asynchronous processing.

Successful queuing of messages for later processing, reliable retrieval of messages by worker agents, and the enabling of asynchronous, scalable workflows within an agent-driven application.

Practical example

Example input

Create a queue named 'my-agent-tasks'. Then, add a message '{"task_id": "report_gen_001", "priority": "high"}' to it. After that, retrieve the next available message from the 'my-agent-tasks' queue and tell me its content.

Example output

{"status": "success", "actions_taken": [{"action": "create_queue", "queue_name": "my-agent-tasks", "result": "Queue 'my-agent-tasks' created successfully."}, {"action": "add_message", "queue_name": "my-agent-tasks", "message_content": "{\"task_id\": \"report_gen_001\", \"priority\": \"high\"}", "result": "Message added to queue 'my-agent-tasks'. Message ID: a1b2c3d4e5f6..."}, {"action": "retrieve_message", "queue_name": "my-agent-tasks", "result": {"message_content": "{\"task_id\": \"report_gen_001\", \"priority\": \"high\"}", "message_id": "a1b2c3d4e5f6...", "pop_receipt": "g7h8i9j0k1l2..."}}]}

When to use this skill

  • When your agent needs to reliably hand off tasks or data to another system for asynchronous processing.
  • When you need to build fault-tolerant systems where messages are persisted even if consumers are down.
  • When scaling background work across multiple instances or workers.
  • When integrating with existing Azure-based systems that use queues for communication.

When not to use this skill

  • For real-time, synchronous request-response communication where immediate feedback is required.
  • For complex event streaming or high-throughput data pipelines that might be better suited for Azure Event Hubs or Kafka.
  • When advanced message routing, topic-based publishing, or complex transactional guarantees are needed (consider Azure Service Bus).
  • For very small-scale, in-memory queuing where persistence and cloud integration are unnecessary.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/azure-storage-queue-py/SKILL.md --create-dirs "https://raw.githubusercontent.com/sickn33/antigravity-awesome-skills/main/plugins/antigravity-awesome-skills-claude/skills/azure-storage-queue-py/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/azure-storage-queue-py/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How azure-storage-queue-py Compares

Feature / Agentazure-storage-queue-pyStandard Approach
Platform SupportClaudeLimited / Varies
Context Awareness High Baseline
Installation ComplexityeasyN/A

Frequently Asked Questions

What does this skill do?

Azure Queue Storage SDK for Python. Use for reliable message queuing, task distribution, and asynchronous processing.

Which AI agents support this skill?

This skill is designed for Claude.

How difficult is it to install?

The installation complexity is rated as easy. You can find the installation instructions above.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Azure Queue Storage SDK for Python

Simple, cost-effective message queuing for asynchronous communication.

## Installation

```bash
pip install azure-storage-queue azure-identity
```

## Environment Variables

```bash
AZURE_STORAGE_ACCOUNT_URL=https://<account>.queue.core.windows.net
```

## Authentication

```python
from azure.identity import DefaultAzureCredential
from azure.storage.queue import QueueServiceClient, QueueClient

credential = DefaultAzureCredential()
account_url = "https://<account>.queue.core.windows.net"

# Service client
service_client = QueueServiceClient(account_url=account_url, credential=credential)

# Queue client
queue_client = QueueClient(account_url=account_url, queue_name="myqueue", credential=credential)
```

## Queue Operations

```python
# Create queue
service_client.create_queue("myqueue")

# Get queue client
queue_client = service_client.get_queue_client("myqueue")

# Delete queue
service_client.delete_queue("myqueue")

# List queues
for queue in service_client.list_queues():
    print(queue.name)
```

## Send Messages

```python
# Send message (string)
queue_client.send_message("Hello, Queue!")

# Send with options
queue_client.send_message(
    content="Delayed message",
    visibility_timeout=60,  # Hidden for 60 seconds
    time_to_live=3600       # Expires in 1 hour
)

# Send JSON
import json
data = {"task": "process", "id": 123}
queue_client.send_message(json.dumps(data))
```

## Receive Messages

```python
# Receive messages (makes them invisible temporarily)
messages = queue_client.receive_messages(
    messages_per_page=10,
    visibility_timeout=30  # 30 seconds to process
)

for message in messages:
    print(f"ID: {message.id}")
    print(f"Content: {message.content}")
    print(f"Dequeue count: {message.dequeue_count}")
    
    # Process message...
    
    # Delete after processing
    queue_client.delete_message(message)
```

## Peek Messages

```python
# Peek without hiding (doesn't affect visibility)
messages = queue_client.peek_messages(max_messages=5)

for message in messages:
    print(message.content)
```

## Update Message

```python
# Extend visibility or update content
messages = queue_client.receive_messages()
for message in messages:
    # Extend timeout (need more time)
    queue_client.update_message(
        message,
        visibility_timeout=60
    )
    
    # Update content and timeout
    queue_client.update_message(
        message,
        content="Updated content",
        visibility_timeout=60
    )
```

## Delete Message

```python
# Delete after successful processing
messages = queue_client.receive_messages()
for message in messages:
    try:
        # Process...
        queue_client.delete_message(message)
    except Exception:
        # Message becomes visible again after timeout
        pass
```

## Clear Queue

```python
# Delete all messages
queue_client.clear_messages()
```

## Queue Properties

```python
# Get queue properties
properties = queue_client.get_queue_properties()
print(f"Approximate message count: {properties.approximate_message_count}")

# Set/get metadata
queue_client.set_queue_metadata(metadata={"environment": "production"})
properties = queue_client.get_queue_properties()
print(properties.metadata)
```

## Async Client

```python
from azure.storage.queue.aio import QueueServiceClient, QueueClient
from azure.identity.aio import DefaultAzureCredential

async def queue_operations():
    credential = DefaultAzureCredential()
    
    async with QueueClient(
        account_url="https://<account>.queue.core.windows.net",
        queue_name="myqueue",
        credential=credential
    ) as client:
        # Send
        await client.send_message("Async message")
        
        # Receive
        async for message in client.receive_messages():
            print(message.content)
            await client.delete_message(message)

import asyncio
asyncio.run(queue_operations())
```

## Base64 Encoding

```python
from azure.storage.queue import QueueClient, BinaryBase64EncodePolicy, BinaryBase64DecodePolicy

# For binary data
queue_client = QueueClient(
    account_url=account_url,
    queue_name="myqueue",
    credential=credential,
    message_encode_policy=BinaryBase64EncodePolicy(),
    message_decode_policy=BinaryBase64DecodePolicy()
)

# Send bytes
queue_client.send_message(b"Binary content")
```

## Best Practices

1. **Delete messages after processing** to prevent reprocessing
2. **Set appropriate visibility timeout** based on processing time
3. **Handle `dequeue_count`** for poison message detection
4. **Use async client** for high-throughput scenarios
5. **Use `peek_messages`** for monitoring without affecting queue
6. **Set `time_to_live`** to prevent stale messages
7. **Consider Service Bus** for advanced features (sessions, topics)

## When to Use
This skill is applicable to execute the workflow or actions described in the overview.

Related Skills

azure-storage-queue-ts

31392
from sickn33/antigravity-awesome-skills

Azure Queue Storage JavaScript/TypeScript SDK (@azure/storage-queue) for message queue operations. Use for sending, receiving, peeking, and deleting messages in queues.

Cloud IntegrationClaude

azure-servicebus-dotnet

31392
from sickn33/antigravity-awesome-skills

Azure Service Bus SDK for .NET. Enterprise messaging with queues, topics, subscriptions, and sessions.

Cloud IntegrationClaudeChatGPTGemini

azure-monitor-ingestion-java

31392
from sickn33/antigravity-awesome-skills

Azure Monitor Ingestion SDK for Java. Send custom logs to Azure Monitor via Data Collection Rules (DCR) and Data Collection Endpoints (DCE).

Cloud IntegrationClaude

azure-identity-py

31392
from sickn33/antigravity-awesome-skills

Azure Identity SDK for Python authentication. Use for DefaultAzureCredential, managed identity, service principals, and token caching.

Cloud IntegrationClaude

azure-eventgrid-py

31392
from sickn33/antigravity-awesome-skills

Azure Event Grid SDK for Python. Use for publishing events, handling CloudEvents, and event-driven architectures.

Cloud IntegrationClaude

azure-eventgrid-java

31392
from sickn33/antigravity-awesome-skills

Build event-driven applications with Azure Event Grid SDK for Java. Use when publishing events, implementing pub/sub patterns, or integrating with Azure services via events.

Cloud IntegrationClaudeChatGPTGemini

azure-eventgrid-dotnet

31392
from sickn33/antigravity-awesome-skills

Azure Event Grid SDK for .NET. Client library for publishing and consuming events with Azure Event Grid. Use for event-driven architectures, pub/sub messaging, CloudEvents, and EventGridEvents.

Cloud IntegrationClaude

microsoft-azure-webjobs-extensions-authentication-events-dotnet

31392
from sickn33/antigravity-awesome-skills

Microsoft Entra Authentication Events SDK for .NET. Azure Functions triggers for custom authentication extensions.

Identity Management / Authentication & AuthorizationClaude

azure-web-pubsub-ts

31392
from sickn33/antigravity-awesome-skills

Real-time messaging with WebSocket connections and pub/sub patterns.

Messaging & CommunicationClaude

azure-storage-file-share-ts

31392
from sickn33/antigravity-awesome-skills

Azure File Share JavaScript/TypeScript SDK (@azure/storage-file-share) for SMB file share operations.

Cloud Storage ManagementClaude

azure-storage-file-share-py

31392
from sickn33/antigravity-awesome-skills

Azure Storage File Share SDK for Python. Use for SMB file shares, directories, and file operations in the cloud.

Cloud Storage ManagementClaude

azure-storage-file-datalake-py

31392
from sickn33/antigravity-awesome-skills

Azure Data Lake Storage Gen2 SDK for Python. Use for hierarchical file systems, big data analytics, and file/directory operations.

Cloud Storage ManagementClaude