Mental Model: How AXAG Works
Before writing your first annotation, understand the mental model that makes AXAG work.
The Two Audiences
Every interface element serves two audiences simultaneously:
- Human users — who perceive the element visually and interact manually
- AI agents — who need to discover, understand, and invoke the element programmatically
Traditional interfaces serve only the first audience. AXAG adds a semantic layer that serves the second.
The Five-Layer Architecture
Layer 1: Human Interface
The existing UI. No changes required to visual design, layout, or user interaction patterns.
Layer 2: AXAG Semantic Contract
Annotations added to UI elements. These annotations declare intent, entity, action type, parameters, constraints, preconditions, risk level, and safety requirements.
Layer 3: Semantic Manifest
A JSON document generated from annotations. It catalogs every operation available on a page, section, or application with full parameter schemas and safety metadata.
Layer 4: MCP Tool Registry
Tool definitions generated from the manifest following the Model Context Protocol specification. Each operation becomes a callable tool with typed inputs and safety constraints.
Layer 5: Agent Runtime
The agent reads the tool registry, plans which tools to invoke, validates parameters against constraints, and executes operations.
The Key Insight
Agents MUST interact with systems through semantic operations declared in the AXAG contract — not through scraping, prompt interpretation, or visual inference.
This means:
- The agent does not parse the DOM to find buttons
- The agent does not read button text to guess intent
- The agent does not inspect CSS classes to identify elements
- The agent reads the Semantic Manifest to discover operations
- The agent reads tool definitions to understand invocation contracts
- The agent validates parameters against declared constraints before execution
From UI Element to Agent Action
Here is the complete transformation path for a single UI element:
Step 1: The UI Element (Human-Facing)
<button onclick="handleCheckout()">Proceed to Checkout</button>
Step 2: Add AXAG Annotations
<button
axag-intent="checkout.begin"
axag-entity="order"
axag-action-type="mutate"
axag-required-parameters='["cart_id","payment_method_id","shipping_address_id"]'
axag-preconditions='["cart_validated","inventory_reserved"]'
axag-postconditions='["checkout_session_created"]'
axag-risk-level="high"
axag-confirmation-required="true"
axag-scope="customer"
onclick="handleCheckout()"
>
Proceed to Checkout
</button>
Step 3: Generate Semantic Manifest Entry
{
"intent": "checkout.begin",
"entity": "order",
"operation": "begin_checkout",
"parameters": {
"cart_id": { "type": "string", "required": true },
"payment_method_id": { "type": "string", "required": true },
"shipping_address_id": { "type": "string", "required": true }
},
"preconditions": ["cart_validated", "inventory_reserved"],
"postconditions": ["checkout_session_created"],
"risk_level": "high",
"scope": "customer",
"execution_type": "mutate",
"confirmation_required": true
}
Step 4: Generate MCP Tool Definition
{
"tool_name": "begin_checkout",
"description": "Start checkout for a validated cart and create a checkout session.",
"input_schema": {
"type": "object",
"properties": {
"cart_id": { "type": "string" },
"payment_method_id": { "type": "string" },
"shipping_address_id": { "type": "string" }
},
"required": ["cart_id", "payment_method_id", "shipping_address_id"]
},
"safety": {
"execution_type": "mutate",
"risk_level": "high",
"confirmation_required": true
}
}
Step 5: Agent Invokes the Tool
The agent runtime:
- Discovers
begin_checkoutin the tool registry - Validates that
cart_id,payment_method_id, andshipping_address_idare provided - Checks that
cart_validatedandinventory_reservedpreconditions are met - Notes that this is a high-risk mutating operation requiring confirmation
- Requests user confirmation
- Executes the operation
- Verifies that
checkout_session_createdpostcondition is satisfied
Next Steps
- First Annotated Action — Annotate your first UI element
- First Semantic Manifest — Generate a manifest
- First Generated Tool — Produce an MCP tool definition