# Blocks Control SDK

A unified Python interface to interact with popular coding agents.

> Think of it like litellm, but for coding agents

## Supported Agents

- **Claude Code** - Anthropic's Claude
- **Gemini CLI** - Google's Gemini
- **Codex CLI** - OpenAI's Codex

## Installation

```bash
pip install blocks-control-sdk
```

## Usage

### Async Streaming

```python
from control.agent_claude_exp import ClaudeCodeCLIExp

agent = ClaudeCodeCLIExp()

async for message in agent.stream("Write a python script to print 'Hello, World!'"):
    print(message.content)
```

### Sync with Callbacks

```python
from control.agent_claude_exp import ClaudeCodeCLIExp

agent = ClaudeCodeCLIExp()

def on_message(notification):
    print(notification.message.content)

agent.register_notification(agent.notifications.NOTIFY_MESSAGE_V2, on_message)

agent.query("Write a python script to print 'Hello, World!'")
```

### All Agents

```python
from control.agent_claude_exp import ClaudeCodeCLIExp
from control.agent_gemini_exp import GeminiAgentCLIExp
from control.agent_codex import CodexAgentCLI

# Claude
claude = ClaudeCodeCLIExp()

# Gemini
gemini = GeminiAgentCLIExp()

# Codex
codex = CodexAgentCLI()
```

## Environment Variables

```bash
export ANTHROPIC_API_KEY="your-key"  # For Claude
export GEMINI_API_KEY="your-key"     # For Gemini
export OPENAI_API_KEY="your-key"     # For Codex
```