SDK Endpoints
Register Python functions as testable endpoints using the Rhesis SDK. Instead of configuring endpoints manually in the dashboard, you decorate your functions and the SDK handles registration, mapping, and synchronization automatically.
This page summarizes SDK endpoint capabilities. For the complete reference — advanced patterns, parameter binding, serializers, and working examples — see the SDK Connector documentation.
How It Works
The SDK connector establishes a WebSocket connection to the Rhesis backend. When your application starts, the SDK:
- Discovers all functions decorated with
@endpoint - Registers them as endpoints in your Rhesis project
- Keeps the connection alive for remote invocation during tests
When Rhesis runs tests against an SDK endpoint, it sends the test input over the WebSocket connection, the SDK calls your function locally, and returns the result to the platform for evaluation.
Quick Start
Initialize the Client
Decorate Your Function
View in Dashboard
Registered endpoints appear under Projects > Your Project > Endpoints
with connection type SDK and status Active.
Auto-Mapping
When your function uses standard field names, the SDK automatically maps them to platform variables. No manual mapping configuration is needed.
Standard request fields: input, conversation_id (or legacy session_id),
context, metadata, tool_calls
Standard response fields: output, context, metadata, tool_calls,
conversation_id (or legacy session_id)
Manual Mapping
For functions with custom parameter names or complex structures, provide explicit mappings using the same Jinja2 and JSONPath syntax as REST endpoint mappings:
Multiple Functions
Register multiple endpoints from a single application. Each decorated function becomes its own endpoint:
Parameter Binding
Inject infrastructure dependencies (database connections, configuration, auth context) without exposing them in the remote function signature:
For full details on binding patterns, see Parameter Binding.
Parameter-aware Endpoints
When your project uses Parameters & Experiments, map resolved parameter values from params into your function arguments with request_mapping. This is the same {{ params.* }} path used by REST endpoints, so SDK and REST endpoints behave consistently during test runs.
The older @endpoint(parameters=["model", "temperature"]) kwarg-merging
path is deprecated. It still works for existing applications, but new
endpoints should use {{ params.* }} in request_mapping.
For more details on request-mapping and context-resolved injection, see Connector Injection.
SDK vs. REST Endpoints
| Aspect | SDK Endpoints | REST Endpoints |
|---|---|---|
| Setup | Decorate Python functions | Configure URL, headers, templates in dashboard |
| Connection | WebSocket (bidirectional) | HTTP requests |
| Mapping | Auto-detected or via decorator | Jinja2 templates and JSONPath |
| Best for | Functions in your codebase | External APIs and third-party services |
| Dependencies | Supports parameter binding | N/A (API manages its own state) |
| Requires | Running application with SDK | Accessible API URL |
When to use which?
- Use SDK endpoints when your AI logic lives in Python functions you control and you want a code-first testing workflow.
- Use REST endpoints when testing external APIs, third-party LLM providers, or services deployed outside your codebase.
- You can use both in the same project.
Connection Management
- Auto-reconnect: The SDK reconnects automatically with exponential backoff if the connection is lost.
- Re-registration: Functions are re-registered on reconnect.
- Status sync: Adding or modifying functions updates endpoints automatically.
Removing a function marks its endpoint as
Inactive.
Disabling the Connector
To disable all connector functionality (useful for CI/CD or testing), set the environment variable:
When disabled, @endpoint decorators return functions unmodified and no
WebSocket connection is established.
Learn more
- SDK Connector — full reference with advanced patterns
- Input/Output Mapping — mapping guide
- Parameter Binding — dependency injection patterns
- Advanced Mapping — complex type serialization
- Examples — complete working examples