Skip to main content

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

Usage

Async Streaming

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

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

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

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

Download files

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

Source Distribution

blocks_control_sdk-0.1.0rc0.tar.gz (18.3 kB view details)

Uploaded Source

File details

Details for the file blocks_control_sdk-0.1.0rc0.tar.gz.

File metadata

  • Download URL: blocks_control_sdk-0.1.0rc0.tar.gz
  • Upload date:
  • Size: 18.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for blocks_control_sdk-0.1.0rc0.tar.gz
Algorithm Hash digest
SHA256 fd82bd49473a43ced7a17a0abb6da33cdfbede03c3076ddf77abe7ace2f259ee
MD5 d799f25042be3ea607c25f2fc97174f7
BLAKE2b-256 840fe553f513a23700b6003775922e4ad706270645a127d028dc52ee2febeb1c

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