Phase 4 â Dispatch
Time: ~10 minutes
Prerequisites: Phase 0 read; you want a structured request/response contract
You'll need: TypeScript or JavaScript; optional: an app that calls AI APIs
This phase introduces Dispatch (the in-process model-execution Interaction Format; formerly @restormel/aaif): typed request and response shapes. Types, validation, and a runtime helper (executeDispatchRequest) live in @restormel/dispatch. Dispatch is an in-process contract, not a wire protocol — for cross-agent interop see A2A.
Step 4.1 â Request shape
DispatchRequest: input, task?, constraints? (maxCost/latency/tokens), user?, and routing? (model/provider).
Step 4.2 â Response shape
DispatchResponse: output, provider, model, cost, routing.reason.
Step 4.3 â Install and use
pnpm add @restormel/dispatchimport type { DispatchRequest, DispatchResponse } from "@restormel/dispatch";
import { isDispatchRequest, isDispatchResponse } from "@restormel/dispatch";Use the type guards to validate incoming/outgoing payloads. How to test: Pass a sample object to isDispatchRequest / isDispatchResponse; confirm they return true for valid shapes.
Prompts for this phase
Optional. Use if a coding agent should install @restormel/dispatch and verify type guards.
Checkpoint
You now have @restormel/dispatch installed and request/response types and validation guards in use (or ready for when the runtime exists).