-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Client SDK Python
Dmitrii Karataev edited this page Feb 26, 2026
·
3 revisions
The rocketride Python SDK provides an async client for connecting to RocketRide Engine, executing pipelines, sending data, and chatting with AI.
From PyPI:
pip install rocketrideOr download directly from a running engine:
GET http://<engine-host>:<port>/client/python
websockets >= 11.0.0aiofiles >= 23.0.0pydantic >= 2.0.0- Python 3.9+
from rocketride import RocketRideClient, Question
async with RocketRideClient(uri='http://localhost:5565', auth='your-api-key') as client:
result = await client.use(filepath='pipeline.json')
question = Question()
question.addQuestion('Summarize this document')
answer = await client.chat(token=result['token'], question=question)
print(answer)RocketRideClient(uri='', auth='', **kwargs)| Parameter | Type | Default | Description |
|---|---|---|---|
uri |
str |
ROCKETRIDE_URI env |
Server URI (http/https/ws/wss) |
auth |
str |
ROCKETRIDE_APIKEY env |
API key for authentication |
env |
dict |
.env file |
Environment variables for config and pipeline substitution |
persist |
bool |
False |
Enable automatic reconnection with exponential backoff |
request_timeout |
int |
None | Default timeout (ms) for individual requests |
max_retry_time |
int |
None | Max total time (ms) to keep retrying connections |
module |
str |
None | Custom module name for client identification |
HTTP/HTTPS URIs are automatically upgraded to WebSocket (ws/wss).
The recommended pattern uses async with for automatic connection management:
async with RocketRideClient(uri='http://localhost:5565', auth='key') as client:
# client is connected here
pass
# client is automatically disconnectedOr manage the connection manually:
client = RocketRideClient(uri='http://localhost:5565', auth='key')
await client.connect()
try:
# your operations
pass
finally:
await client.disconnect()await client.connect(timeout=None)
await client.disconnect()
await client.ping(token=None)# Load and start a pipeline
result = await client.use(
filepath='pipeline.json', # Path to pipeline JSON
# OR
pipeline={...}, # Inline pipeline definition
env={...}, # Optional environment variables
)
# Check pipeline status
status = await client.get_task_status(token)
# Stop a running pipeline
await client.terminate(token)# Send text data
result = await client.send(token, data, mime_type=None, provider=None)
# Send files
result = await client.send_files(token, files=['/path/to/file.pdf'], provider=None)
# Stream data via a pipe (for large datasets)
pipe = await client.pipe(token, objinfo={}, mime_type=None, provider=None)
await pipe.open()
await pipe.write(b'raw bytes here')
result = await pipe.close()from rocketride import Question
question = Question()
question.addQuestion('What are the key findings?')
answer = await client.chat(token=result['token'], question=question)With conversation history:
question = Question()
question.addQuestion('Follow up on the previous answer')
question.addHistory({'role': 'user', 'content': 'Previous question'})
question.addHistory({'role': 'assistant', 'content': 'Previous answer'})
answer = await client.chat(token=token, question=question)# Subscribe to event types
await client.set_events(token, event_types=['status', 'task'])# List available services on the server
services = await client.get_services()The package exports the following from its top-level namespace:
Client:
-
RocketRideClient-- main client class -
RocketRideException-- base exception -
AuthenticationException-- authentication failure
Schema:
-
Question,QuestionText,QuestionType,QuestionExample,QuestionHistory Answer-
Doc,DocFilter,DocMetadata,DocGroup
Types:
-
RocketRideClientConfig,ConnectionInfo,DAPMessage -
ConnectCallback,DisconnectCallback,ConnectErrorCallback,EventCallback -
PIPELINE_RESULT,UPLOAD_RESULT,TASK_STATUS,TASK_STATE -
PipelineComponent,PipelineConfig,TraceInfo
| Variable | Purpose |
|---|---|
ROCKETRIDE_URI |
Default server URI |
ROCKETRIDE_APIKEY |
Default API key |
These are loaded from the process environment or a .env file in the current directory. Constructor parameters override environment variables.
The package includes a rocketride command-line tool:
rocketride --help- Client SDK (TypeScript) -- TypeScript SDK reference
- Pipeline API -- pipeline JSON structure
- Quickstart -- quick start guide
Getting Started
Architecture
API Reference
Contributing
Governance