🔧

Ripperdoc

SDK Client Reference

Detailed API reference for the Ripperdoc SDK

RipperdocClient

The main class for session-based interactions.

Constructor

from ripperdoc.sdk import RipperdocClient

client = RipperdocClient(
    model: str = "main",
    yolo_mode: bool = False,
    max_thinking_tokens: int = 0,
    tools: Optional[List[str]] = None,
    system_prompt: Optional[str] = None,
)

Parameters

ParameterTypeDefaultDescription
modelstr"main"Model profile to use
yolo_modeboolFalseSkip permission prompts
max_thinking_tokensint0Max tokens for thinking mode
toolsList[str]NoneTools to enable (all if None)
system_promptstrNoneCustom system prompt

Methods

query

Send a message and get a response.

async def query(
    self,
    message: str,
    stream: bool = False,
) -> QueryResult

Parameters:

  • message: The user message
  • stream: Enable streaming responses

Returns: QueryResult object

close

Clean up resources.

async def close(self) -> None

Context Manager

Use as an async context manager:

async with RipperdocClient() as client:
    result = await client.query("Hello")

query Function

For one-shot queries without session management.

from ripperdoc.sdk import query

async def query(
    message: str,
    system_prompt: str = "",
    model: str = "main",
    tools: Optional[List[str]] = None,
    max_thinking_tokens: int = 0,
) -> QueryResult

Parameters

ParameterTypeDefaultDescription
messagestrrequiredThe query message
system_promptstr""System prompt
modelstr"main"Model profile
toolsList[str]NoneEnabled tools
max_thinking_tokensint0Thinking mode tokens

QueryResult

Result object returned from queries.

Properties

PropertyTypeDescription
contentstrResponse text
tool_callsList[ToolCall]Tools that were called
input_tokensintInput token count
output_tokensintOutput token count
cost_usdfloatEstimated cost
duration_msfloatResponse time

Examples

Basic Query

from ripperdoc.sdk import query

result = await query("What is 2 + 2?")
print(result.content)  # "4"

With Tools

from ripperdoc.sdk import RipperdocClient

client = RipperdocClient(
    tools=["Read", "Glob"],
    yolo_mode=True
)

result = await client.query("List all Python files")
print(result.content)

Thinking Mode

from ripperdoc.sdk import query

result = await query(
    "Solve this complex problem step by step...",
    max_thinking_tokens=8000,
    model="reasoning"
)

Streaming

from ripperdoc.sdk import RipperdocClient

client = RipperdocClient()

async for chunk in client.query("Write a long story", stream=True):
    print(chunk, end="", flush=True)

Error Handling

from ripperdoc.sdk import RipperdocClient, RipperdocError

try:
    client = RipperdocClient()
    result = await client.query("Do something")
except RipperdocError as e:
    print(f"Error: {e}")
finally:
    await client.close()

Tool Access

Control which tools are available:

# Only file reading tools
client = RipperdocClient(tools=["Read", "Glob", "Grep"])

# All tools except shell
all_tools = get_all_tool_names()
safe_tools = [t for t in all_tools if t != "Bash"]
client = RipperdocClient(tools=safe_tools)

Custom System Prompts

client = RipperdocClient(
    system_prompt="""You are a code reviewer.
    Focus on:
    - Security issues
    - Performance problems
    - Code style
    """
)

result = await client.query("Review the changes in src/")