R-Think

API Reference

This section provides a complete reference for the R-Think public API. All interfaces, methods, and types are documented below.

Runtime

The Runtime class is the primary entry point for creating and executing cognitive missions.

Method Path Description
Static Runtime.create(options) Create a new mission instance with protocol, rules, and artifact configuration.
Instance runtime.execute(input) Execute the mission with the given input. Returns validated output with trace and artifacts.
Instance runtime.validate(input) Validate input against mission rules without executing the protocol.
Instance runtime.trace() Get the execution trace of the last mission run.
Instance runtime.stop() Stop a running mission execution.

Runtime.create Options

Parameter Type Required Description
id string Required Unique identifier for the mission instance.
protocol ProtocolDefinition Required The protocol definition to execute.
rules Rule[] Optional Array of validation rules to apply at runtime.
artifacts ArtifactConfig[] Optional Array of artifact capture configurations.
adaptiveDepth AdaptiveDepth Optional Mission risk level L0 through L3. Defaults to L1.
retry RetryConfig Optional Retry configuration for failed steps.

Response Schema

The execute method returns a MissionResult object with the following structure:

Response

{
  "output": { "result": "decision-ready" },
  "validated": true,
  "trace": {
    "id": "trace-001",
    "missionId": "mission-001",
    "steps": [
      { "name": "observe", "passed": true, "durationMs": 12 }
    ],
    "startedAt": "2026-07-22T10:00:00Z",
    "completedAt": "2026-07-22T10:00:02Z"
  },
  "artifacts": { "evidence": [], "metrics": {} },
  "evidenceGraph": { "nodes": [], "edges": [] }
}