RhesisClient
The RhesisClient is the central entry point for the Rhesis SDK. It initializes telemetry, manages the connector for remote testing, and provides access to the Rhesis API.
Initialization
Parameters
| Parameter | Required | Description |
|---|---|---|
api_key | No | API key for authentication. Falls back to RHESIS_API_KEY env var. |
base_url | No | API base URL. Falls back to RHESIS_BASE_URL env var. Default: https://api.rhesis.ai |
project_id | No | Project ID for endpoint registration and tracing. Falls back to RHESIS_PROJECT_ID env var. |
environment | No | Environment name. Falls back to RHESIS_ENVIRONMENT env var. Default: development |
What It Does
When you create a RhesisClient, it:
- Initializes telemetry - Sets up OpenTelemetry for tracing
- Registers as default - Becomes the default client for
@endpointand@observedecorators - Lazy-loads connector - WebSocket connector is initialized only when
@endpointis used
The RhesisClient must be initialized before using @observe or @endpoint decorators. Without it, a RuntimeError is raised.
Environment Variables
Configure the client entirely through environment variables:
Environment Values
The environment parameter determines where your endpoints and traces are registered:
| Value | Use Case |
|---|---|
development | Local development and testing |
staging | Pre-production validation |
production | Live systems |
Changes in production take effect immediately. Always test in development or staging first.
Disabling the Client
To disable all SDK functionality (useful for CI/CD or testing):
Accepted values: true, 1, yes, on (case-insensitive)
When disabled:
@endpointand@observedecorators return functions unmodified- No telemetry initialization occurs
- No WebSocket connection is established
- All SDK method calls become no-ops
Usage Patterns
Tracing Only
For observability without remote testing:
Remote Testing
For registering functions as testable endpoints: