$ fssg build --deterministic --validate |

Where FACET Stops: Five Responsibilities the Host Runtime Must Keep

FACET

A contract layer becomes dangerous when it tries to become the whole system.

I built FACET to make AI request construction explicit: types, tool interfaces, policy checks, context allocation, execution phases, canonical output, and provenance. That is already a large responsibility. It is also a boundary. FACET should compile and guard the request contract; the host runtime must still own the changing world around it.

This distinction is easy to blur because a compiler can see a great deal. Once it knows the tools, effects, policy, token budget, and provider payload, it is tempting to give it retries, storage, workflow state, credentials, and side-effect execution too. I think that is the wrong direction. A system is easier to reason about when every layer has a narrow failure domain.

The boundary in one sentence

FACET decides whether a request is structurally and semantically admissible. The host decides how that request lives, fails, resumes, and changes reality.

The current FACET specification and reference compiler already make this separation concrete. A .facet document is parsed, resolved, type-checked, evaluated, laid out, policy-checked, and rendered into Canonical JSON. The model call itself remains outside FACET. Mutable state enters through runtime input. Loops and state machines belong to the host.

That is not a missing feature. It is the architecture.

1. Provider transport belongs to the host

FACET can render a provider-specific payload from one canonical model. It should not own the network session that sends it.

Transport has concerns that are not contract semantics: connection pooling, regional endpoints, streaming sockets, provider authentication, rate-limit headers, request cancellation, proxy policy, and SDK lifecycle. These change at a different speed from the request contract. They also fail differently.

If transport is embedded in the contract layer, a provider SDK update can change the meaning of “valid FACET execution.” I want the opposite: the same compiled artifact should remain inspectable even when the transport adapter is replaced.

The practical interface is simple:

.facet source
    -> FACET compiler
    -> Canonical JSON + hashes + policy decision
    -> host transport adapter
    -> provider

The adapter may translate wire details. It must not silently repair types, invent missing arguments, weaken policy, or reorder semantics. I described that narrower rule in Why AI Provider Adapters Must Not Repair Semantics.

2. Retry and recovery belong to the host

A failed model call is not one failure class.

A timeout before any response, a disconnected stream, a provider-side rejection, an invalid structured result, and an unknown tool outcome require different actions. Retrying all of them with the same request can duplicate cost or side effects. FACET can make the request identity and policy visible, but it cannot infer what happened outside its boundary.

The host therefore owns:

  • retry budgets and backoff;
  • effect identifiers and idempotency keys;
  • resume, replay, rollback, and compensation decisions;
  • provider fallback;
  • the distinction between failed and outcome_unknown.

This is why I treat recovery as a runtime protocol, not as a compiler convenience. The broader decision model is in Retry, Resume, Roll Back, or Compensate?.

FACET can contribute stable hashes and a canonical request artifact. The host must connect those artifacts to an execution ledger.

3. Durable workflow state belongs to the host

One FACET run represents one deterministic request construction. A long-running workflow may survive process restarts, wait for a human, receive an external event, branch, compensate a previous action, or continue tomorrow with new facts.

Those are state-machine responsibilities.

Trying to encode them inside the request language would mix two kinds of truth:

  • contract truth: what inputs, tools, policies, and context are admissible now;
  • workflow truth: what has already happened and what transition is allowed next.

The host should store workflow checkpoints and pass the relevant state into FACET as typed runtime input. FACET then compiles the next request against that explicit snapshot. It does not become the database.

This also keeps replay honest. Recompiling the same contract with the same inputs should reproduce the same request artifact. Replaying the surrounding workflow is a different operation with different side-effect rules.

4. Secrets belong outside the contract artifact

A portable contract is likely to be inspected, diffed, cached, logged, tested, and moved through CI. That makes it the wrong place for credentials.

FACET may declare that a tool exists and that a policy permits a class of effect. The host must resolve the actual credential at the last responsible moment, according to environment, tenant, identity, and deployment policy.

The contract may say:

Payments.charge is exposed and policy permits this call.

The host must answer separate questions:

Which account is active?
Which secret store may release the credential?
Which tenant and region apply?
May this process receive the secret at all?

Keeping those questions outside Canonical JSON preserves portability and reduces leakage. A policy hash can prove which authorization rules were compiled. It should never become a container for the secret that satisfies them.

5. Business side effects belong to the host

FACET can authorize a tool call before execution. It cannot guarantee that the external world will honor the intended semantics.

A payment API can accept a request and later reverse it. A file write can succeed while a downstream index update fails. An email provider can return an identifier before delivery is known. A tool schema describes the call; it does not turn the remote system into a transaction.

The host owns the actual effect boundary:

  1. bind a stable effect identifier;
  2. execute through the appropriate adapter;
  3. record the observed outcome;
  4. reconcile uncertain outcomes;
  5. compensate or escalate when required.

FACET's fail-closed Runtime Guard is valuable precisely because it acts before this boundary. It can reject an inadmissible call. Once an admissible call crosses into an external system, runtime evidence takes over.

A responsibility matrix

Concern FACET contract layer Host runtime
Types and tool signatures Owns Consumes
Context allocation Owns deterministically Supplies inputs and limits
Policy admissibility Compiles and guards Supplies identity/environment facts
Canonical request and hashes Produces Stores and correlates
Provider network call Does not own Owns
Retry and fallback Describes no hidden behavior Owns explicit policy
Workflow checkpoints Does not persist Owns
Credentials Must not contain Resolves securely
External side effects Authorizes before call Executes and reconciles
Model correctness Cannot guarantee Must validate outcomes

The matrix is intentionally asymmetric. FACET is strong because it refuses responsibilities that would make its guarantees vague.

A clean integration test

I use one question to test the boundary: can I replace the provider adapter, workflow engine, or secret store without changing the meaning of the .facet contract?

If the answer is no, infrastructure semantics have leaked into the contract. If changing the contract silently changes retry behavior or credential selection, runtime policy has leaked in the other direction.

The integration should preserve three independent artifacts:

  • the compiled contract artifact;
  • the runtime execution record;
  • the external effect record.

Together they explain the system. None of them should impersonate the others.

The point of a narrow contract layer

The goal is not to move every AI-system concern into FACET. The goal is to create one hard boundary where ambiguity stops.

FACET answers: Is this request well-formed, typed, bounded, policy-admissible, and canonically represented?

The runtime answers: Should it run here, with this identity, through this provider, under this recovery policy, and what happened afterward?

That separation lets FACET remain a portable deterministic contract layer instead of growing into an opaque framework. In AI engineering, a system does not become more rigorous by centralizing every responsibility. It becomes rigorous when each responsibility has an owner, an artifact, and a failure boundary.

Sources

FACET AI CLI Terminal
facet@ai:~$