← recommendAItion

AUTOPILOT BETA · SERVER INTEGRATION

Connect once.
Let AutoPilot learn.

AutoPilot selects an approved model; your application executes it. No prompts, generated text or provider credentials reach recommendAItion.

1. Connect existing usage

AutoPilot learns from your tracked workflows. Your developer supplies measured costs and an outcome evaluator appropriate to the task. Missing quality evidence keeps the original model in use; it does not become an invented quality score. JSON validity alone is not proof of semantic correctness.

2. Start your workflow

In AutoPilot, click Start AutoPilot beside a discovered workflow. Initial quality, response-time and spend safeguards are inferred from observed usage. The most-used model becomes the baseline. These defaults remain fixed until you edit them in Advanced controls; monthly capacity starts at observed 30-day spend, with at least one call reservation. Check the inferred baseline if your historical traffic includes experiments. Generate a routing token in Advanced controls and store it on your server.

Automatic switches require at least 20 distinct matched tasks in the last seven days, using the same rubric within 24 hours of each other, with equal-or-better evaluated quality on every pair. Both models must pass recent measurement, quality and response-time checks; the alternative must cost at least 10% less on average. The engine evaluates imported and routed observations; it does not run paid background trials.

3. Connect the executor

Download the dependency-free JavaScript SDK. It runs server-side with Node 22+. The two functions below—executeApprovedModel and evaluateWithYourRubric—are your application’s integration points, not built-in SDK functions.

import { AutoPilot } from './autopilot-sdk.mjs';

const pilot = new AutoPilot({
  url: 'https://recommendaition.io',
  token: process.env.RAI_AUTOPILOT_TOKEN
});

const { result, receipt, accepted } = await pilot.runTask({
  id: crypto.randomUUID(), // retain for reconciliation; never reuse to rerun AI
  workflow: 'Support triage',
  taskKey: 'opaque-ticket-123',
  availableModels, // explicit [{provider,model}] allowlist supported by YOUR adapters
  context: { goal: prompt, constraints, checkpoints }, // local only; supply these from your app
  maxCostMicros: 100000, // $0.10 worst-case bound; calculate for YOUR request
  execute: async ({ provider, model, maxCostMicros, maxLatencyMs, context, attempt }) => {
    // YOUR adapter: keep the prompt and keys here. Enforce token/tool/retry caps.
    const response = await executeApprovedModel({
      provider, model, context, attempt, maxCostMicros, maxLatencyMs
    });
    const quality = await evaluateWithYourRubric(response.output);
    return {
      result: response.output,
      usage: {
        inputTokens: response.inputTokens,
        outputTokens: response.outputTokens,
        cachedTokens: response.cachedTokens,
        costMicros: response.measuredCostMicros,
        overheadMicros: response.retryAndEvaluationCostMicros,
        costSource: 'measured',
        costReference: response.costReference,
        quality, success: response.success
      }
    };
  }
});
// Use the returned accepted flag before showing the result.
// A second failed check requires review. Never blindly retry.

4. Learn, optimise, recover

Pass availableModels to declare exactly which interchangeable models your local adapters support. AutoPilot retains the baseline while learning; it selects the lowest observed-cost qualifying model when enough evidence exists. Each request reserves its worst-case cost before execution. Insufficient capacity blocks the call; use optional overrides when your traffic grows.

runTask snapshots the supplied context locally and preserves that original goal, constraints and checkpoints for one recovery attempt. A completed alternative that fails only its quality check may recover with the baseline within 60 seconds. Recovery requires a qualified available baseline and remaining budget. Provider failures, ambiguous network failures, latency overruns and cost overruns do not trigger a retry. A second failed result stops. The workflow remains paused for review after a breach; recovery does not silently re-enable it.

Context that was never supplied cannot be recovered. Your adapter is responsible for fitting the preserved context into the model’s context window. run remains available for a single attempt; runTask adds bounded recovery. Neither method automatically judges arbitrary text.

Budget and failure handling

The monthly budget is per workflow, in USD and UTC, and applies only to calls routed through this SDK. It is a reservation control, not a provider billing cap. Your adapter must correctly bound input, maximum output, retries, tools and evaluation overhead. Underreported or underestimated costs can exceed the declared ceiling; reporting an overrun pauses routing.

If execution or reporting fails, the SDK does not rerun the provider. It attempts to pause the workflow and retains the reservation. Its error includes requestId, any local result, and usage when available. If completion reporting failed, retry pilot.settle(error.usage) with the exact same measured event. Unknown-cost reservations remain committed for their original UTC month; do not release them by inventing zero-cost records. A lost routing response may leave a reservation although no provider call ran; review before enabling again.

Keep the savings honest

Routing activity compares actual cost with a historical baseline average and labels the difference estimated. Both attempts count toward spend; recovery costs reduce the estimated saving. It is not a matched counterfactual. Verified savings still require accepted recommendations, paired measured trials, quality acceptance and duplicate-free evidence in Savings. The first beta does not automatically perform baseline trials or bill routing estimates.

Open AutoPilot →