Modal Claude Agent Sdk Python banner
sshh12 sshh12

Modal Claude Agent Sdk Python

AI community

Description

This package wraps the Claude Agent SDK to execute AI agents in secure, scalable Modal containers. It provides progressive complexity—simple usage mirrors the original Agent SDK, while advanced features expose Modal's full capabilities (GPU, volumes, image customization, etc.).

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

Modal Agents SDK

**Disclaimer**: This is an unofficial community package. It is not affiliated with, endorsed by, or associated with Anthropic or Modal in any way.

Run [Claude Agent SDK](https://github.com/anthropics/claude-agent-sdk-python) agents in [Modal](https://modal.com) sandboxes.

This package wraps the Claude Agent SDK to execute AI agents in secure, scalable Modal containers. It provides progressive complexity—simple usage mirrors the original Agent SDK, while advanced features expose Modal's full capabilities (GPU, volumes, image customization, etc.).

Features

Feature modal-agents-sdk claude-agent-sdk
Sandboxed execution ✅ Modal containers ❌ Local only
GPU support ✅ A10G, H100, A100, etc.
Persistent storage ✅ Modal Volumes
Custom images ✅ Docker/Dockerfile
Network isolation ✅ Configurable
Auto-scaling ✅ Built-in
Built-in tools ✅ Read, Write, Bash, etc.
MCP servers
Host-side hooks ✅ Intercept tool calls
Host-side tools ✅ Run on local machine
Multi-turn conversations

Installation

pip install modal-agents-sdk

Prerequisites

  1. Modal account: Sign up at modal.com
  2. Modal CLI: Install and authenticate
    pip install modal
    modal setup
  3. Anthropic API key: Create a Modal secret
    modal secret create anthropic-key ANTHROPIC_API_KEY=sk-ant-...

Quick Start

import asyncio
from modal_agents_sdk import query

async def main():
    async for message in query("What is 2 + 2?"):
        print(message)

asyncio.run(main())

Basic Usage: `query()`

`query()` is an async function for querying Claude in a Modal sandbox. It returns an `AsyncIterator` of response messages.

from modal_agents_sdk import query, ModalAgentOptions, AssistantMessage, TextBlock
import modal

# S