R-Think

API Reference

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

Runtime

The Runtime class is the primary entry point for executing reasoning protocols.

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

Runtime.create Options

Parameter Type Required Description
id string Required Unique identifier for the runtime instance.
protocol Protocol Required The protocol definition to execute.
rules Rule[] Optional Array of validation rules to apply.
artifacts Artifact[] Optional Array of artifact configurations.
retry RetryConfig Optional Retry configuration for failed steps.

Response Schema

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

Response

{
  "output": { "result": "success" },
  "validated": true,
  "trace": {
    "id": "trace-123",
    "steps": [
      { "name": "validate", "passed": true, "duration": 2 }
    ],
    "startedAt": "2026-07-21T10:00:00Z",
    "completedAt": "2026-07-21T10:00:02Z"
  },
  "artifacts": { "evidence": [], "metrics": {} }
}