Parameter Injection
Experiment parameters flow through request_mapping for both REST and SDK connector endpoints. Use \{\{ experiment_parameters.model \}\} (or the deprecated alias \{\{ params.model \}\}) in your templates.
How it works
When a test run is associated with an experiment, the platform resolves the experiment’s parameter values once at queue time and stores an immutable snapshot on the test run. During execution, the snapshot is injected into the Jinja2 template context as experiment_parameters (and the deprecated alias params).
Your request mapping references individual values with dot notation:
This works identically whether the endpoint is REST (HTTP) or SDK connector (WebSocket). The template is rendered before the request is dispatched, so your API or function receives the final resolved values.
REST endpoints
For REST endpoints, the rendered request body is sent as the HTTP payload. See Using Experiment Parameters for full details, including how to use Jinja2 defaults for graceful fallback when no experiment is attached.
SDK connector endpoints
For SDK connector endpoints, the rendered request mapping becomes the function’s keyword arguments. The function signature simply declares the parameters it expects:
During a test run with an experiment, experiment_parameters.model resolves to the experiment’s value (e.g., "gpt-4o"). Without an experiment, the Jinja2 default() filter provides the fallback.
There is no distinction between “test data” and “configuration” at the request mapping level — both are template variables rendered the same way. This keeps the mental model simple: input is the test prompt, experiment_parameters.* are the experiment knobs, and any other platform variables (test_id, session_id, etc.) work as documented in Platform-Managed Variables.
Parameters.get() in production code
The experiment_parameters template variable handles test-time parameter injection. For production traffic (live requests that don’t go through the test runner), your application reads parameters using the Parameters.get() facade:
During a test run, the platform also sets an internal context variable so that Parameters.get() calls inside your function return the experiment’s values without hitting the network. This means production code that calls Parameters.get() will automatically pick up the experiment snapshot during tests — no special branching needed.
See SDK Usage for the full Parameters.get() API.
The Wire Protocol
For those debugging at the protocol level, the ExecuteTestMessage payload sent by the Rhesis platform over the connector includes the full parameter snapshot:
experiment_parameters/parameters: The resolvedDict[str, Any]of experiment parameter values. Both field names are sent;experiment_parametersis preferred.test_parameters: The test’s freeformDict[str, Any]of per-test data (see Test Parameters).parameter_version: The sequential version identifier (e.g.v3) of the version being executed.parameter_experiment_id: The UUID of the experiment.parameter_source: The resolution method used ("environment","experiment_id", or"version"). Older snapshots may still show"label"; treat it as"environment".parameter_source_environment: The environment name when resolution went through an environment (for example"default"). Legacy snapshots may useparameter_source_labelinstead.parameter_schema: The full schema, allowing the SDK to validate the payload locally.
Because the backend dispatcher copies parameter_source and parameter_source_environment from the run snapshot, the ResolvedParameters.source_environment inside your application reflects the environment (for example “via default”) that was targeted at run-queue time.
Worked Example: The Chatbot
The Rhesis chatbot demo application is the canonical reference for parameter management.
The core chat() function is decorated as an @endpoint. Parameters come through the request mapping alongside test data:
The FastAPI route serves production traffic and resolves parameters through the Parameters.get() facade, then calls the same function:
Test Parameters vs Experiment Parameters
The template context exposes two separate namespaces for injected data:
| Namespace | Source | Lifecycle |
|---|---|---|
params | Experiment parameter values, resolved and snapshotted at queue time | Typed, versioned, schema-validated |
test_parameters | Freeform JSON stored on the test object | Per-test, unversioned |
Use test_parameters for per-test data that varies across tests in the same run (e.g. a customer ID, a locale, or a scenario-specific flag). Use params for configuration that applies uniformly to every test in a run (e.g. model name, temperature, system prompt).
Both namespaces are available in the same request mapping and do not collide:
Deprecated: The parameters keyword argument on @endpoint (e.g., parameters=["model", "temperature"]) and the \{\{ params.model \}\} template alias are deprecated. Use \{\{ experiment_parameters.model \}\} in request_mapping instead. Both old paths still work but will be removed in a future release.