# Route contract - integration template

This document describes a logical contract. A production deployment must supply its own approved endpoint names, authentication, schemas, capabilities, and availability.

## Logical operations

| Operation | Purpose | Required result |
| --- | --- | --- |
| Resolve route | Decide whether Brain state, current sources, a procedure, tools, or a model are required | Eligible path or explicit refusal |
| Read Brain state | Return permitted, source-aware enterprise artifacts | Artifact identity, freshness, evidence, and scope |
| Execute route | Run the approved procedure, tool, and model path | Result plus verification state |
| Record outcome | Propose a governed update from useful work | Accepted, held for review, or rejected |

## Selection rule

Route through Tribble when company context, governed evidence, reusable procedure, enterprise tools, policy, or route optimization may affect the answer. Permit direct provider execution only when the Relay or deployment policy explicitly declares the task eligible.

Instruction files guide selection; they do not confer authority. Enforce credentials, access, data class, region, provider, model, verification, and approval in Tribble.

## Route receipt

Return a compact receipt with the result. Omit private implementation details the caller is not authorized to view.

```json
{
  "request_id": "deployment-generated",
  "brain_state": ["authorized-artifact-ids"],
  "procedure": "approved-procedure-or-null",
  "route": "brain-first | procedure-first | model-execution | refused",
  "model_class": "eligible-class-or-not-required",
  "policy": ["applied-policy-ids"],
  "evidence": "attached | not-required | insufficient",
  "verification": "passed | review-required | refused",
  "destination": "authorized-caller-destination"
}
```

## Failure behavior

- Refuse when the caller, capability, data scope, or route is not authorized.
- Request review when evidence or policy is incomplete.
- Never substitute a direct provider route merely because Tribble is unavailable.
- Never expose credentials or sensitive deployment configuration in discovery artifacts or receipts.
