A unified Python interface to interact with popular coding agents.
Project description
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
pip install blocks-control-sdk
You must also have the dependent agent packages installed to use a specific agent.
npm i -g @anthropic-ai/claude-code
npm i -g @google/gemini-cli
npm i -g @openai/codex-cli
Usage
Async Streaming
import asyncio
from blocks_control_sdk import ClaudeCode, Codex, GeminiCLI
async def main():
agent = ClaudeCode()
async for message in agent.stream("Write a python script to print 'Hello, World!'"):
print(message)
if __name__ == "__main__":
asyncio.run(main())
Sync with Callbacks
from blocks_control_sdk import Codex
agent = Codex()
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
from blocks_control_sdk import ClaudeCode, Codex, GeminiCLI
# Claude
claude = ClaudeCode()
# Gemini
gemini = GeminiCLI()
# Codex
codex = Codex()
Environment Variables
export ANTHROPIC_API_KEY="your-key" # For Claude
export GEMINI_API_KEY="your-key" # For Gemini
export OPENAI_API_KEY="your-key" # For Codex
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file blocks_control_sdk-0.1.0rc2.tar.gz.
File metadata
- Download URL: blocks_control_sdk-0.1.0rc2.tar.gz
- Upload date:
- Size: 37.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb9d70dffb5e5e8885e567966f3a420cab7b92e38165d4d86e16a40a511f00e0
|
|
| MD5 |
5f251069444b78a213663112a898fccd
|
|
| BLAKE2b-256 |
9dff78dc35097e77d146cd77677988f87655845cfc5039d45bf3f5c089f85e9f
|