Semantic Contract
A semantic contract is a formal, machine-readable declaration of what an interface interaction means, what it requires, and what it guarantees. AXAG annotations express semantic contracts.
Contract vs Description
A description tells you about something. A contract binds you to something.
When AXAG declares axag-preconditions='["cart_validated"]', this is not informational — it is contractual. It means:
- The operation MUST NOT be invoked unless
cart_validatedis true - The manifest MUST include this precondition
- The tool definition MUST surface this constraint, so the agent can plan around it
- The operation MUST refuse a call that breaks it, with
AXAG_PRECONDITION_FAILED
Preconditions are written for people and agents to reason about, not evaluated by a machine: nothing checks cart_validated for you. The refusal is what makes the contract binding, and it belongs in the handler or API that performs the operation.
Contract Components
Every AXAG semantic contract consists of:
- Identity — Intent and entity declarations
- Interface — Parameters, types, and constraints
- Preconditions — Required state before execution
- Postconditions — Guaranteed state after execution
- Safety — Risk level, confirmation, approval requirements
- Execution semantics — Action type, idempotency, side effects
Contract Lifecycle
Contracts are authored by frontend engineers, validated by CI, transformed into manifests and tools, consumed by agents, and monitored for drift.