Step 5 of 8

Phase 4 — AAIF

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 the Agent-to-Agent Interaction Format (AAIF): typed request and response shapes. Types, validation, and a runtime helper (executeAAIFRequest) live in @restormel/aaif.

Step 4.1 — Request shape

AAIFRequest: input, task?, constraints? (maxCost/latency/tokens), user?, and routing? (model/provider).

Step 4.2 — Response shape

AAIFResponse: output, provider, model, cost, routing.reason.

Step 4.3 — Install and use

CLI
pnpm add @restormel/aaif
TypeScript
import type { AAIFRequest, AAIFResponse } from "@restormel/aaif";
import { isAAIFRequest, isAAIFResponse } from "@restormel/aaif";

Use the type guards to validate incoming/outgoing payloads. How to test: Pass a sample object to isAAIFRequest / isAAIFResponse; confirm they return true for valid shapes.

Prompts for this phase

Optional. Use if a coding agent should install @restormel/aaif and verify type guards.

Checkpoint

You now have @restormel/aaif installed and request/response types and validation guards in use (or ready for when the runtime exists).