Ripperdoc Python SDK
Python SDK for Ripperdoc AI Agent.
Overview
This SDK is a fork of Anthropic's Claude Agent SDK Python and maintains full API compatibility with it. The Ripperdoc SDK extends the original SDK with support for multiple LLM providers (not just Claude) while keeping the same interface and usage patterns.
Compatibility: If you have code using claude_agent_sdk, you can easily migrate by simply changing the imports from claude_agent_sdk to ripperdoc_agent_sdk and using RipperdocAgentOptions instead of ClaudeAgentOptions. All other API calls remain the same.
Features
- Subprocess Architecture: Clean separation between SDK and CLI via JSON Control Protocol
- Async-First: Built with
asyncioandanyiofor efficient async operations - Type Safety: Full type hints for better IDE support and type checking
- Comprehensive: Support for hooks, permissions, MCP servers, and custom tools
Installation
Install from PyPI:
pip install ripperdoc-agent-sdk
Install from GitHub:
pip install git+https://github.com/quantmew/ripperdoc-agent-sdk-python
For development:
pip install git+https://github.com/quantmew/ripperdoc-agent-sdk-python#egg=ripperdoc-agent-sdk[dev]
Quick Start
Simple Query
import asyncio
from ripperdoc_agent_sdk import query, RipperdocAgentOptions
async def main():
async for message in query(
prompt="What is the capital of France?",
options=RipperdocAgentOptions()
):
print(message)
asyncio.run(main())
Persistent Client
import asyncio
from ripperdoc_agent_sdk import RipperdocSDKClient, RipperdocAgentOptions
async def main():
async with RipperdocSDKClient(options=RipperdocAgentOptions()) as client:
await client.query("Help me understand this code")
async for message in client.receive_messages():
if isinstance(message, AssistantMessage):
for block in message.content:
if isinstance(block, TextBlock):
print(block.text)
asyncio.run(main())
Configuration
RipperdocAgentOptions
from ripperdoc_agent_sdk import RipperdocAgentOptions
options = RipperdocAgentOptions(
model="model-name",
permission_mode="default", # or "acceptEdits", "bypassPermissions", "plan"
allowed_tools=["Bash", "Read", "Write"],
max_turns=10,
system_prompt="You are a helpful coding assistant",
cli_path="/path/to/ripperdoc", # Optional: path to Ripperdoc CLI
)
Permission Modes
"default": Prompts for dangerous operations"acceptEdits": Auto-accept file edits"bypassPermissions": Allow all operations (use with caution)"plan": Planning mode with no execution
Advanced Usage
Custom Permission Checker
from ripperdoc_agent_sdk import (
RipperdocSDKClient,
RipperdocAgentOptions,
PermissionResultAllow,
PermissionResultDeny,
)
async def my_permission_checker(tool_name, tool_input, context):
# Custom permission logic
if tool_name == "Bash" and "rm -rf" in tool_input.get("command", ""):
return PermissionResultDeny(message="Dangerous command!")
return PermissionResultAllow()
options = RipperdocAgentOptions(
permission_checker=my_permission_checker,
)
Programmatic Hooks
from ripperdoc_agent_sdk import RipperdocAgentOptions, HookMatcher
async def my_hook(event_type, data):
print(f"Hook event: {event_type}")
return {"continue_": True}
options = RipperdocAgentOptions(
hooks={
"PreToolUse": [
HookMatcher(
callback=my_hook,
tool_pattern="Bash*",
)
]
},
)
MCP Servers
from ripperdoc_agent_sdk import RipperdocAgentOptions, McpServerConfig
options = RipperdocAgentOptions(
mcp_servers={
"my-server": McpServerConfig(
type="stdio",
command="node",
args=["/path/to/server.js"],
)
},
)
Custom Agents
from ripperdoc_agent_sdk import RipperdocAgentOptions, AgentConfig
options = RipperdocAgentOptions(
agents={
"code-reviewer": AgentConfig(
description="Reviews code for bugs and style issues",
prompt="You are a code reviewer. Focus on bug detection and style.",
tools=["Read", "Grep"],
)
},
)
Message Types
The SDK provides the following message types:
UserMessage: Messages from the userAssistantMessage: Responses from the AISystemMessage: System-level eventsResultMessage: Query completion with metadataStreamEvent: Raw stream events
Content Blocks
TextBlock: Plain text contentThinkingBlock: Extended thinking outputToolUseBlock: Tool invocationToolResultBlock: Tool execution result
Architecture
The SDK uses a subprocess architecture:
┌─────────────────────┐
│ Python SDK │
│ │
│ ┌───────────────┐ │
│ │ Ripperdoc │ │
│ │ SDK Client │ │
│ └───────┬───────┘ │
│ │ │
│ ┌───────▼───────┐ │
│ │ JSON Control │ │
│ │ Protocol │ │
│ └───────┬───────┘ │
└──────────┼──────────┘
│ stdio
┌──────▼─────────┐
│ Ripperdoc │
│ CLI Process │
└────────────────┘
Development
Running Tests
pytest tests/
Type Checking
mypy ripperdoc_agent_sdk
Code Formatting
black ripperdoc_agent_sdk
ruff check ripperdoc_agent_sdk
Requirements
- Python 3.10+
- anyio >= 4.0.0
- pydantic >= 2.0.0
License
Apache License 2.0
Contributing
Contributions are welcome! Please read our contributing guidelines before submitting PRs.
Related Projects
- Ripperdoc CLI - The main Ripperdoc CLI that works with multiple LLM providers
- Claude Agent SDK Python - The original Anthropic SDK that this project is based on
- Claude Code - Anthropic's official CLI tool
Migration from Claude Agent SDK
If you're already using the Claude Agent SDK, migrating is straightforward:
# Before (Claude Agent SDK)
from claude_agent_sdk import query, ClaudeAgentOptions
options = ClaudeAgentOptions(
system_prompt="You are a helpful assistant",
permission_mode='acceptEdits',
)
# After (Ripperdoc SDK)
from ripperdoc_agent_sdk import query, RipperdocAgentOptions
options = RipperdocAgentOptions(
system_prompt="You are a helpful assistant",
permission_mode='acceptEdits',
)
The rest of your code remains exactly the same. The Ripperdoc SDK provides the same API with the added benefit of supporting multiple LLM providers beyond just Claude.
Metadata
Release files for ripperdoc-agent-sdk 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ripperdoc_agent_sdk-0.0.3.tar.gz | 40.6 kB | Without provenance | Details for ripperdoc_agent_sdk-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ripperdoc_agent_sdk-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for ripperdoc_agent_sdk-0.0.3-py3-none-any.whl |
Total release size: 81.0 kB
Release files / ripperdoc_agent_sdk-0.0.3.tar.gz
| Download URL | ripperdoc_agent_sdk-0.0.3.tar.gz |
|---|---|
| Size | 40.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a91e37a26f205cf3bcbe13073b7e583fc9540cf1a40b1b6a35514b7378f5e2c7
|
|
BLAKE2b-256 checksum How to use checksums |
1ab59f3aec9a33b8438535a19e25e8270960a3ae28f2e35c4d381dc32ae1d260
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / ripperdoc_agent_sdk-0.0.3-py3-none-any.whl
| Download URL | ripperdoc_agent_sdk-0.0.3-py3-none-any.whl |
|---|---|
| Size | 40.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f7a76524cd5db1e2cc7432176198e292c6807afbe6e17ee0fdb78f432fbe6cda
|
|
BLAKE2b-256 checksum How to use checksums |
da13505f94afb665016d50a6d4f102c4544b61ba2f9357e3bb9b654c76833930
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Security for ripperdoc-agent-sdk 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.