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.
Code-first approach: Decorate your functions with @endpoint and they
become testable endpoints in Rhesis. No manual URL configuration, request
templates, or response mappings needed.
This page provides a summary of SDK endpoint capabilities. For the complete reference including 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, session_id (or conversation_id),
context, metadata, tool_calls
Standard response fields: output, context, metadata, tool_calls,
session_id (or conversation_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.
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 — Detailed mapping guide
- Parameter Binding — Dependency injection patterns
- Advanced Mapping — Complex type serialization
- Examples — Complete working examples