Appearance
Compute Adapter Example
Overview
This example shows a compute-participating adapter.
It accepts domain input, maps it into a primitive request, delegates execution, and shapes the result.
This is the standard pattern for a single-stage execution adapter.
When To Use This Pattern
Use this pattern when the adapter’s main job is:
- mapping domain intent to one primitive
- building one canonical execution request
- returning one primary result surface
Typical examples:
- ETA execution
- simple risk simulation
- climate ensemble call
- one-stage search flow
Lifecycle
text
Input → Validate → Transform → Plan → Execute → Finalize → OutputExample Use Case
A logistics client wants a probabilistic ETA instead of a single deterministic arrival estimate.
The adapter:
- receives transport context
- validates the request
- builds an
mc@1execution request - delegates compute
- returns ETA distribution and deadline probability
Example Flow
text
Transport input
↓
ETA adapter
↓
mc@1 / eta.v1
↓
distributed execution
↓
ETA adapter
↓
ETA distribution outputExample Request
json
{
"baseline_seconds": 14400,
"traffic": {
"mean_delay_seconds": 900,
"stdev_seconds": 420
},
"weather": {
"enabled": true,
"slowdown_probability": 0.22,
"penalty_seconds_mean": 540
},
"deadline_at": "2026-04-05T18:00:00Z",
"iterations": 5000000,
"quantiles": [0.5, 0.9, 0.95],
"seed": 19754221,
"verify": true
}Example Primitive Request Built by the Adapter
json
{
"ctx": {
"job_id": "eta-job-001",
"run_id": "run-1"
},
"op": {
"name": "mc",
"version": 1,
"profile": "eta.v1"
},
"args": {
"iterations": 5000000,
"baseline_seconds": 14400,
"traffic_mu": 900,
"traffic_sigma": 420,
"weather_enabled": true,
"weather_slowdown_probability": 0.22,
"weather_penalty_mean": 540,
"deadline_at": "2026-04-05T18:00:00Z",
"quantiles": [0.5, 0.9, 0.95]
},
"seed": {
"mode": "explicit",
"value": "19754221"
},
"policy": {
"verify": "spotcheck"
}
}Example Output
json
{
"adapter_name": "eta-adapter",
"adapter_version": "1.0.0",
"eta_distribution": {
"p50_seconds": 15120,
"p90_seconds": 16184,
"p95_seconds": 16642
},
"deadline_hit_probability": 0.73,
"risk": "YELLOW",
"replay_refs": {
"primitive": "mc@1",
"profile": "eta.v1",
"seed": "19754221"
}
}What the Adapter Actually Does
The adapter is responsible for:
- validating transport input
- normalizing the request
- building the canonical primitive request
- delegating execution
- shaping the returned result surface
The adapter is not responsible for:
- Monte Carlo execution
- result truth
- stochastic engine behavior
- primitive semantics
Pseudocode
text
receive transport request
validate request
map transport request to eta.v1 primitive args
send canonical request to Forge execution surface
receive primitive result
shape output for logistics consumer
return outputWhy This Pattern Matters
This is the cleanest example of:
domain-specific intent mapped into canonical compute truth
It demonstrates the exact relationship between adapters and primitives.
Invariants Satisfied
This pattern preserves:
- explicit primitive selection
- visible execution boundary
- no shadow compute
- preserved traceability
- no semantic override
Mental Model
The adapter asks the right question.
Forge computes the answer.
