Skip to main content
Create a Domain that learns a bounded sequence of numeric controls. This guide defines the interface once; the following guides use it to acquire a sequence, test revisions, and reuse a context-dependent correction. You need a Unit API Key and an application that can reset or observe an environment, execute bounded controls, and measure what happened. Start with execution patterns if you are still choosing the control interface.

Choose the API surface

Creating a Domain does not configure its trajectory learner. For the numeric pipeline, the mechanism lives inside the config object sent to /trajectory/configure. It does not belong inside DomainCreateRequest.learning, query_templates, or a generic /schemas request.

Connect to the API

Send Authorization: Bearer <Unit API Key> and Content-Type: application/json. Keep the key server-side. The bearer token determines the owner; omit body session_id and never send a trusted owner header to select a tenant.

Define the vector schema

Consider a planar platform with two continuous control coordinates. This small example has four state coordinates and up to eight commands. Replace these choices with your own measured interface. The goal is a desired state, not a successful control sequence. goal_indices: [0, 1] maps the two goal coordinates into the state vector. Every index must be smaller than state_dimensions; the goal length must equal the number of goal indices. Keep names, units, ordering, scaling, and invalid-measurement rules in an application-owned manifest. The trajectory API receives numeric arrays; it cannot infer the physical meaning of an array position. action_dimensions is the number of values applied together in one command. horizon limits the ordered command count. Their product is the maximum number of scalar outputs in a proposal, not the number of inputs or physical joints. A later retained sequence may be shorter than the acquisition horizon.

Separate API configuration from executor configuration

For this example, the application holds each command for 0.5 seconds and uses a fixed eight-slot execution window. If structural deletion shortens the logical sequence, it appends neutral commands to the unused slots. That preserves the physical duration while the logical command list changes. command_duration, action_bounds, and padding are not fields in the referenced trajectory configuration schema. Do not insert them into the API body. Implement and version them in your executor. A neutral command means the declared neutral actuator input; it does not imply that the moving platform stops immediately. For a concrete outcome contract, define completion as finishing within 0.05 metres of the goal with speed at most 0.1 metres/second. Assess it after the eight-slot window, or at a declared earlier task-terminal state. A safety stop does not count as completion. The acquisition reward and structural completion objective both use float(completed). These tolerances are example application settings; choose and keep fixed the values appropriate to your task.

Create and configure the Domain

Choose a fresh run-specific Domain ID. POST to https://rei-neuroadapt-api.reilabs.org/api/v1/domains:
Then POST {} to /domains/control-example-UNIQUE-acquisition/trajectory/state. The reference client requires status: "not_configured" before configuring a fresh trajectory learner. This check concerns trajectory state; it does not assert that every possible Domain subsystem is empty. POST to /domains/control-example-UNIQUE-acquisition/trajectory/configure, relative to the production base:
The dimensions and resource settings above are an example profile, not universal tuning recommendations.

Acquisition fields

These limits come from the reference request schema. A deployed service can impose lower account or runtime limits. Read and save the resolved configuration; do not assume schema maxima are available capacity. For reward, explicitly return the application’s measured outcome after execution. Keep its direction and scale fixed. Use goal_error only with an adapter that implements the deployed goal-error contract; changing the string does not change your scorer automatically.

Optional acquisition profile

The reference sequence client explicitly enables the following options. They are supported field names from that configuration, not settings required for every task:
This is a configuration fragment to merge into config before initial configuration, not a separate endpoint or a live patch request. The minimal example leaves native defaults in place. Enable progress-related options only with a defined, measured per-command outcome stream; do not manufacture intermediate outcomes from the terminal value. Save the full resolved settings with the run.

Choose the feedback granularity

The example uses outcome_mode: "reward" and a binary completion measurement. You can define a more informative measured reward for your own task while keeping the same proposal and observation shapes. Keep the completion test separate from the learning score. Preserve score direction, scale, and assessment time within a learning run. If you change this example’s binary scorer, also change the binary validation in the acquisition loop. Supply step_outcomes only when you measure outcomes at each executed command.

Request helper

The following helper uses the Python standard library. Set ADAPT1_API_KEY in the server process environment. All later snippets use these functions and the same PREFIX.
Generate PREFIX once, then persist and reload it to resume. Regenerating it creates a new lineage. The helper performs HTTP requests; it is not a simulator, scheduler, durable journal, or retry manager. Add request-intent and response recording before using it for a long run, as described in Retained use and recovery.

Check the configured interface

Read /trajectory/state and save the resolved mechanism and configuration with your executor manifest. Then make one measured attempt and confirm its observation acknowledgement before increasing the run budget.
These production-address examples are adapted from the available trajectory request schemas and exercised client workflow. They have not been executed against production as part of this documentation update.

Choose the next guide

Acquire a sequence

Propose, execute, validate, and return actual trajectory observations.

Structural stages

Export acquired records and run selection, deletion, and ordering.

Contextual refinement

Configure contexts and evaluate candidate offsets around a retained base.

Retained use and recovery

Use learned state without writes and reconcile interrupted operations.