> For the complete documentation index, see [llms.txt](https://docs.trueopen.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.trueopen.ai/providers/model-integration/adapter-interface.md).

# Adapter Interface

Implement the stable capability boundary between Cortex and model compute.

Cortex talks to model compute through an adapter with six stable capabilities. The adapter may be in-process, local, or remote, but Cortex remains the only component allowed to sign protocol material.

## Operations

| Capability         | Purpose                                                                 | Task-bound |
| ------------------ | ----------------------------------------------------------------------- | ---------- |
| `Health`           | Report lightweight backend health                                       | No         |
| `ListCapabilities` | Enumerate supported Profiles and inference or verification capabilities | No         |
| `ReadinessCheck`   | Validate a Profile before support declaration                           | No         |
| `Estimate`         | Provide best-effort load and completion estimates for local policy      | Yes        |
| `Infer`            | Produce canonical Worker output and required evidence                   | Yes        |
| `Verify`           | Produce full-output verification metrics and evidence                   | Yes        |

## Bind every Task operation

Task-bound calls carry the exact context supplied by Cortex, including Task identity, order commitment, Profile version, assigned duty, verification round where applicable, and runtime-capability digest.

The adapter returns those bindings with recomputable result digests. Cortex rejects a result when any binding differs from its persisted Task lease. The adapter must never silently fall back to another Profile version or runtime.

## Implement `Infer`

`Infer` is invoked only after Cortex confirms Worker assignment and persists the Task lease. Return:

* Canonical output bytes or frames
* Material needed to calculate the output commitment
* Generated-work measurement material
* Evidence artifacts required by the Profile
* Diagnostic digests suitable for local troubleshooting

Do not return a final verdict, payout, penalty, or claimed chain state.

## Implement `Verify`

`Verify` is invoked after Cortex confirms formal Verifier assignment and validates the downloaded Task material. Return raw per-position measurement material, metric summary and root, evidence artifacts, and the candidate result. Cortex recomputes and validates them against the frozen Profile before commit or reveal.

Challenge verification uses the same boundary with an independent round identifier.

## Treat estimates as advisory

`Estimate` may be stale or unknown. It helps provider scheduling before a handraise, but must never become a signed protocol fact, candidate weight, or justification for missing an accepted duty.

## Errors and cancellation

Distinguish at least capacity exhaustion, capability mismatch, invalid Task material, backend failure, cancellation, and protocol-risk errors. Return complete material or fail; Cortex cannot sign partial output from a timed-out call.

Cancellation stops local computation. It does not cancel responsibility already accepted on-chain, so Cortex may retry, invoke fallback, or enter a deterministic failure path.

## Preserve the security boundary

The adapter and runtime must never receive operator or service private keys or connect directly to the chain or Nexus. Keep prompts, outputs, logits, and checkpoints in controlled Task and evidence stores rather than ordinary logs.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.trueopen.ai/providers/model-integration/adapter-interface.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
