# AXAG — Agent Experience Accessibility Guidelines
> AXAG (Agent Experience Accessibility Guidelines) is a standard for annotating web UIs so AI agents can discover and invoke what a page does, instead of scraping it. Authors add `axag-*` attributes to existing HTML; tooling turns those into a Semantic Manifest and MCP or WebMCP tools an agent runtime can register.
Source: https://axag.org · Generated from the documentation, in sidebar order.
# Introduction
## What is Agent Experience (AX)?
Source: https://axag.org/docs/intro/what-is-ax
**Agent Experience (AX)** is a design discipline that treats AI agents as first-class product consumers. Just as User Experience (UX) designs for human perception, cognition, and behavior, AX designs for agent perception, planning, and execution.
## The Problem
Modern software interfaces are designed exclusively for human users. Every button label, layout decision, navigation pattern, and interaction flow is optimized for human visual processing and manual interaction. When AI agents attempt to interact with these interfaces, they must:
1. **Infer meaning** from visual layout, CSS classes, and button text
2. **Guess relationships** between form fields, validation rules, and submission actions
3. **Reconstruct intent** from ambiguous labels like "Submit", "Go", or "Process"
4. **Navigate state machines** that were never documented for non-human consumers
5. **Handle side effects** that are only described in human-readable tooltips or documentation
This approach is fundamentally brittle. It fails whenever:
- A CSS class name changes
- A button label is reworded
- A component is replaced with a different visual design
- A page layout is restructured
- Localization changes text content
- Dynamic rendering alters the DOM tree
- Anti-bot defenses are activated
## The AX Discipline
AX addresses this by establishing a parallel design dimension:
| Dimension | UX (Human) | AX (Agent) |
|-----------|-----------|------------|
| **Perception** | Visual rendering, color, layout | Semantic annotations, structured metadata |
| **Understanding** | Labels, tooltips, documentation | Declared intent, entity types, action semantics |
| **Interaction** | Click, type, drag, scroll | Structured operation invocation |
| **Validation** | Visual error messages, inline hints | Declared constraints, preconditions, error codes |
| **Safety** | Confirmation dialogs, undo buttons | Risk classification, approval requirements, idempotency declarations |
| **Discovery** | Navigation menus, search bars | Semantic manifests, tool registries |
AX does not replace UX. AX complements UX by making the semantic layer of an interface explicit and machine-readable.
## Core Principles of AX
### 1. Agents Are Consumers, Not Scrapers
An agent should be able to discover what operations are available, what parameters they require, what constraints apply, and what side effects they produce — without parsing visual layout or inferring meaning from presentation.
### 2. Intent Must Be Explicit
A button labeled "Go" tells a human what to do through visual context. An agent has no visual context. AX requires that every interactive element carries declared intent: `product.search`, `order.cancel`, `ticket.escalate`.
### 3. Constraints Must Be Declared
Validation rules that only exist in client-side JavaScript are invisible to agents. AX requires that constraints — required fields, value ranges, format rules, preconditions — are part of the semantic contract.
### 4. Safety Must Be Engineered
An agent that can submit a form can also submit a destructive operation. AX requires that risk levels, confirmation requirements, approval gates, and side-effect declarations are part of every interaction's metadata.
### 5. Discovery Must Be Structured
Agents cannot browse a navigation menu visually. AX requires that available operations are discoverable through structured manifests and tool registries.
## AX vs Accessibility (A11Y)
AX is conceptually adjacent to accessibility but serves a different consumer:
| Aspect | A11Y | AX |
|--------|------|-----|
| **Consumer** | Humans with disabilities | AI agents |
| **Medium** | Screen readers, keyboard navigation | Semantic manifests, tool registries |
| **Goal** | Equal access for all humans | Machine-readable interaction contracts |
| **Standard** | WCAG, ARIA | AXAG |
| **Annotations** | `aria-label`, `role`, `aria-describedby` | `axag-intent`, `axag-entity`, `axag-action-type` |
Both disciplines share a common insight: **explicit semantics improve interaction quality for non-visual consumers.** ARIA annotations help screen readers understand interface structure. AXAG annotations help agent runtimes understand interaction semantics.
## Why AX Matters Now
The proliferation of AI agents — from customer service bots to autonomous workflow engines — has created an urgent need for reliable, deterministic agent–interface interaction. Current approaches rely on:
- **Screen scraping** — parsing rendered DOM to extract data and trigger actions
- **Prompt engineering** — instructing LLMs to interpret screenshots or HTML dumps
- **Custom API integration** — building bespoke connectors for every product
Each of these approaches is expensive, brittle, and non-portable.
AX, implemented through the AXAG standard, provides a **universal semantic contract layer** that any agent runtime can consume without product-specific integration work.
## Next Steps
- [What is AXAG?](/docs/intro/what-is-axag) — Learn about the annotation standard that implements AX
- [Why Human Interfaces Fail Agents](/docs/intro/why-human-interfaces-fail-agents) — Understand the failure modes in detail
- [Core Concepts](/docs/concepts/agent-experience) — Explore the conceptual foundations
## What is AXAG?
Source: https://axag.org/docs/intro/what-is-axag
**AXAG (Agent Experience Accessibility Guidelines)** is an annotation standard that makes interface semantics explicit and machine-readable for AI agents. It defines a **semantic interaction contract** — a formal declaration of what each interface element means, what it does, what it requires, and what it produces.
> *AX defines the discipline. AXAG defines the executable semantic contract.*
## AXAG Is Not Just Metadata
AXAG is frequently misunderstood as a metadata format — a way to add descriptive labels to UI elements. This undersells its purpose.
AXAG is a **semantic interaction contract**. It declares:
| Dimension | What It Answers |
|-----------|----------------|
| **Intent** | What is this interaction trying to accomplish? |
| **Entity** | What domain object does this interaction operate on? |
| **Action Type** | Is this a read, write, delete, or navigate operation? |
| **Parameters** | What inputs does this interaction require? |
| **Constraints** | What rules govern valid inputs? |
| **Preconditions** | What state must be true before execution? |
| **Postconditions** | What state will be true after execution? |
| **Scope** | What boundary (tenant, user, org) does this operate within? |
| **Risk Level** | How dangerous is this operation? |
| **Confirmation** | Does this require explicit confirmation? |
| **Approval** | Does this require multi-party approval? |
| **Idempotency** | Is it safe to repeat this operation? |
| **Side Effects** | What observable changes does this produce? |
This contract becomes the **source of truth** for two downstream artifacts:
1. **Semantic Manifest** — A structured document that exposes all available operations
2. **MCP Tool Registry** — Generated tool definitions that agent runtimes consume
## The Architecture
```mermaid
graph TD
A[Human Interface] --> B[AXAG Semantic Contract]
B --> C[Semantic Manifest]
C --> D[MCP Tool Registry]
D --> E[Agent Runtime]
style A fill:#e0f2fe,stroke:#0284c7
style B fill:#ddd6fe,stroke:#7c3aed
style C fill:#fef3c7,stroke:#d97706
style D fill:#d1fae5,stroke:#059669
style E fill:#fee2e2,stroke:#dc2626
```
### Layer 1: Human Interface
The visual, interactive surface designed for human users. Buttons, forms, tables, navigation — everything a human sees and interacts with.
### Layer 2: AXAG Semantic Contract
The machine-readable contract that declares the **meaning, intent, constraints, and execution semantics** of interface interactions. This contract exists as annotations on UI elements.
### Layer 3: Semantic Manifest
A derived artifact generated from AXAG annotations. It exposes **discoverable, structured operations** with parameter schemas, constraint declarations, and safety metadata.
### Layer 4: MCP Tool Registry
A generated tool surface following the Model Context Protocol (MCP) specification. Agent runtimes consume this registry to discover and invoke operations **deterministically**.
### Layer 5: Agent Runtime
The planning and execution layer. It reads the tool registry, selects appropriate tools, validates constraints, and performs operations — all without scraping or visual inference.
## A Concrete Example
Consider a search button on an e-commerce product page.
### Without AXAG
```html
```
An agent looking at this button knows:
- There is a button
- It says "Search"
- It has a CSS class `search-btn`
The agent does **not** know:
- What entity is being searched
- What parameters the search requires
- What scope the search operates within
- Whether the operation has side effects
- What the expected response structure is
### With AXAG
The following annotation syntax is a Proposed Implementation Pattern. The semantic dimensions are normative; the exact attribute syntax may evolve.
```html
```
Now the agent knows:
- ✅ This is a product search operation
- ✅ It operates on the `product` entity
- ✅ It is a read (non-mutating) operation
- ✅ It requires a `query` parameter
- ✅ It optionally accepts `category`, `price_min`, `price_max`, `sort_by`
- ✅ It operates within the `catalog` scope
- ✅ It has no risk
- ✅ It is idempotent — safe to retry
## What AXAG Is Not
| AXAG Is | AXAG Is Not |
|---------|-------------|
| A semantic contract standard | A UI component library |
| An annotation format for existing interfaces | A replacement for existing interfaces |
| A source of truth for agent interaction | A visual rendering system |
| Compatible with any frontend framework | Tied to React, Vue, or Angular |
| A specification for what interactions mean | A specification for how interactions look |
| Framework-agnostic metadata | An API definition language like OpenAPI |
## Relationship to Existing Standards
| Standard | Purpose | AXAG Relationship |
|----------|---------|-------------------|
| **ARIA / WCAG** | Accessibility for humans with disabilities | Complementary — AXAG serves agents, not screen readers |
| **OpenAPI** | API contract definition | AXAG annotates UI semantics; OpenAPI defines API endpoints |
| **JSON-LD / Schema.org** | Structured data for search engines | AXAG describes interaction semantics, not content metadata |
| **MCP** | Agent tool protocol | AXAG generates MCP-compatible tool definitions |
## Who Should Use AXAG?
- **Frontend engineers** — Annotate UI elements with semantic contracts
- **Platform teams** — Generate manifests and tool registries from annotations
- **Agent runtime builders** — Consume tool registries for deterministic interaction
- **Product architects** — Design agent-ready interface semantics
- **Standards committees** — Govern annotation vocabulary and conformance levels
## Next Steps
- [Why Human Interfaces Fail Agents](/docs/intro/why-human-interfaces-fail-agents) — Failure modes in detail
- [What Problems AXAG Solves](/docs/intro/what-problems-axag-solves) — The specific problems addressed
- [Getting Started](/docs/getting-started/mental-model) — Build your first annotated interaction
## Why Human Interfaces Fail Agents
Source: https://axag.org/docs/intro/why-human-interfaces-fail-agents
Human interfaces are designed for **visual perception and manual interaction**. They encode meaning through spatial layout, typography, color, iconography, and interactive affordances that humans interpret intuitively. AI agents have none of these perceptual capabilities.
When agents attempt to interact with human-designed interfaces, they encounter systematic failure modes that no amount of prompt engineering or scraping sophistication can reliably solve.
## Failure Mode 1: DOM Instability
Modern frontend frameworks (React, Vue, Angular, Svelte) generate DOM structures dynamically. Class names are hashed, element hierarchies change between renders, and component boundaries shift with every build.
```html
```
An agent relying on the CSS class `ProductCard_addBtn__m9p1q` will fail silently after the next deployment.
## Failure Mode 2: Ambiguous Labels
Human interfaces frequently use short, context-dependent labels that rely on visual context for disambiguation:
- **"Submit"** — Submit what? A form? An application? A payment?
- **"Delete"** — Delete which entity? Is this reversible?
- **"Go"** — Navigate where? Execute what?
- **"Process"** — Process what? With what parameters?
- **"More"** — More of what? Expand details? Load additional items?
Humans disambiguate these labels through visual context — the surrounding form, the page title, the section heading. Agents cannot reliably perform this disambiguation.
## Failure Mode 3: Hidden State Logic
Many interface interactions depend on state that is only visible through visual indicators:
- A button is grayed out (disabled) because a precondition is not met
- A form field turns red because validation failed
- A modal appears because a confirmation step was triggered
- A loading spinner indicates an async operation in progress
None of this state logic is exposed semantically. An agent cannot determine:
- *Why* a button is disabled
- *What* precondition must be satisfied
- *Whether* a confirmation step will be required
- *What* state transitions are occurring
## Failure Mode 4: Multi-Step Modal Complexity
Complex workflows involve multi-step modals, wizard flows, and conditional form paths:
```
Step 1: Select product → Step 2: Configure options → Step 3: Review → Step 4: Confirm
```
Each step may conditionally show or hide fields based on previous selections. The entire flow is orchestrated through client-side state management that is completely opaque to agents.
## Failure Mode 5: Localization and A/B Testing
- Button text changes by locale: "Search" → "Buscar" → "検索"
- A/B tests change button placement, labels, and behavior
- Feature flags alter available interactions per user segment
Agents that depend on text content or element positioning break whenever these variations change.
## Failure Mode 6: Anti-Bot Defenses
Many applications implement:
- CAPTCHA challenges
- Rate limiting
- Browser fingerprinting
- Behavioral analysis
- IP-based blocking
These defenses treat automated interaction as adversarial by default. AXAG provides a legitimate, sanctioned interaction path that distinguishes authorized agent access from unauthorized scraping.
## Failure Mode 7: Asynchronous State Transitions
Modern SPAs use asynchronous data fetching, optimistic updates, and eventual consistency:
```
User clicks "Place Order"
→ UI shows spinner
→ Payment service processes (3-5 seconds)
→ Inventory service reserves (1-2 seconds)
→ Order service creates order
→ UI shows confirmation
```
An agent has no semantic signal for:
- When the operation completes
- Whether it succeeded or failed
- What the resulting state is
- Whether it is safe to proceed
## Failure Mode 8: Undeclared Side Effects
A "Merge Contacts" button in a CRM might:
- Combine two contact records
- Reassign all related opportunities
- Trigger notification emails
- Update analytics dashboards
- Modify billing records
None of these side effects are declared in the button's HTML. An agent that invokes this action has no way to assess its full impact.
## The Fundamental Problem
All of these failure modes share a common root cause:
> **Human interfaces encode meaning through presentation. Agents need meaning encoded through declaration.**
This is the semantic gap that AXAG closes.
## The Cost of the Semantic Gap
| Impact | Description |
|--------|-------------|
| **Brittle automation** | Scraping-based agents break with every UI deployment |
| **Unsafe mutations** | Agents trigger destructive operations without understanding consequences |
| **Maintenance burden** | Every UI change requires scraper updates |
| **Non-portability** | Scrapers are product-specific; no reuse across applications |
| **Trust deficit** | Organizations cannot trust agent interactions without semantic guarantees |
| **Compliance risk** | Uncontrolled agent mutations may violate regulatory requirements |
## How AXAG Addresses Each Failure Mode
| Failure Mode | AXAG Solution |
|-------------|---------------|
| DOM instability | Semantic annotations are stable across renders |
| Ambiguous labels | `axag-intent` declares explicit purpose |
| Hidden state logic | `axag-preconditions` declares required state |
| Multi-step complexity | `axag-workflow-step` declares flow position |
| Localization changes | Intent identifiers are locale-independent |
| Anti-bot defenses | AXAG provides a sanctioned interaction path |
| Async transitions | `axag-postconditions` declares expected outcomes |
| Undeclared side effects | `axag-side-effects` declares observable changes |
## Next Steps
- [What Problems AXAG Solves](/docs/intro/what-problems-axag-solves) — The specific problems AXAG addresses
- [AXAG as a Semantic Contract](/docs/intro/axag-as-semantic-contract) — Understanding the contract model
- [Getting Started](/docs/getting-started/mental-model) — Build your first annotated interaction
## What Problems AXAG Solves
Source: https://axag.org/docs/intro/what-problems-axag-solves
AXAG addresses a specific class of problems that arise when AI agents attempt to interact with systems designed exclusively for human users.
## Problem 1: Semantic Opacity
**Human interfaces express meaning visually. Agents need meaning expressed declaratively.**
AXAG annotations attach machine-readable intent, entity type, action classification, parameters, and constraints to every interactive element.
## Problem 2: Scraping Fragility
**Screen scraping is the current dominant approach for agent–UI interaction. It is inherently brittle.**
AXAG replaces scraping with stable semantic contracts that survive DOM changes, CSS rehashing, layout restructuring, and localization updates.
## Problem 3: Safety Blindness
**Agents cannot distinguish between low-risk reads and high-risk mutations without explicit declarations.**
AXAG classifies every operation by risk level, declares confirmation and approval requirements, and specifies preconditions that must be satisfied before execution.
## Problem 4: Discovery Failure
**Agents cannot browse navigation menus or scan page layouts to discover available operations.**
The AXAG Semantic Manifest exposes all available operations as structured, queryable metadata — eliminating the need for visual discovery.
## Problem 5: Parameter Ambiguity
**Form fields, dropdowns, and input controls do not declare their semantic role to agents.**
AXAG parameter annotations declare field type, validation rules, required status, format constraints, and relationships between fields.
## Problem 6: Cross-Product Inconsistency
**Every product requires a custom scraper or integration. There is no universal interaction contract.**
AXAG is domain-agnostic. The same annotation vocabulary works across e-commerce, CRM, marketing, analytics, travel, support, and any other product category.
## Problem 7: Governance Vacuum
**Organizations have no standard way to govern, validate, version, or audit agent interaction semantics.**
AXAG provides conformance levels, validation rules, CI integration, and a governance model for controlling how interfaces expose operations to agents.
## The Core Thesis
> If an interface exposes operations to AI agents, the semantics of those operations MUST be explicit, validated, and governed — not inferred from visual presentation.
This is the problem space AXAG occupies. It is not a UI framework, not an API specification, and not a metadata format. It is a **semantic interaction contract standard**.
## Next Steps
- [AXAG as a Semantic Contract](/docs/intro/axag-as-semantic-contract)
- [Who Should Use AXAG](/docs/intro/who-should-use-axag)
- [Core Concepts](/docs/concepts/agent-experience)
## AXAG as a Semantic Contract
Source: https://axag.org/docs/intro/axag-as-semantic-contract
AXAG is frequently described as an "annotation standard." While technically accurate, this description understates its purpose. AXAG is a **semantic interaction contract** — a binding declaration of what an interface element does, what it requires, and what it guarantees.
## Contract vs Metadata
| Aspect | Metadata | Contract |
|--------|----------|----------|
| **Purpose** | Describes an element | Governs interaction with an element |
| **Binding** | Informational | Operational |
| **Validation** | Optional | Required |
| **Drift** | Tolerated | Violation |
| **Consumer** | Documentation tools | Agent runtimes |
| **Failure mode** | Stale information | Broken agent behavior |
When AXAG annotations declare that an operation requires `cart_validated` as a precondition, that is not a suggestion — it is a contract. An agent runtime that ignores this precondition is violating the contract. A manifest that omits this precondition has drifted from the source of truth.
## Contract Dimensions
The AXAG semantic contract expresses these dimensions:
### Intent
What the interaction is trying to accomplish. Example: `checkout.begin`, `product.search`, `ticket.escalate`.
### Entity
The domain object being operated on. Example: `order`, `product`, `ticket`, `campaign`.
### Action Type
The classification of the operation: `read`, `write`, `delete`, `navigate`.
### Parameters
The inputs required and optional for the operation, with type information and validation rules.
### Constraints
Rules that govern valid inputs — value ranges, format requirements, mutual exclusions, conditional requirements.
### Preconditions
State that MUST be true before the operation can execute. Example: `cart_validated`, `user_authenticated`, `inventory_available`.
### Postconditions
State that WILL be true after successful execution. Example: `checkout_session_created`, `order_confirmed`.
### Scope
The boundary within which the operation operates: `user`, `tenant`, `organization`, `global`.
### Risk Level
The danger classification: `none`, `low`, `medium`, `high`, `critical`.
### Safety Boundaries
Confirmation requirements, approval gates, rate limits, and cooldown periods.
### Idempotency
Whether the operation is safe to repeat without unintended side effects.
### Side Effects
Observable changes that the operation produces beyond its primary result.
## The Contract Chain
AXAG annotations are the **source of truth** in a contract chain:
```
AXAG Annotations (source of truth)
→ Semantic Manifest (derived artifact)
→ MCP Tool Registry (generated surface)
→ Agent Runtime (consumer)
```
If the annotations change, the manifest MUST be regenerated. If the manifest changes, the tool registry MUST be regenerated. Drift between any layers in this chain is a **conformance violation**.
## Why "Contract" Matters
Calling AXAG a contract rather than metadata has practical consequences:
1. **Validation is mandatory** — Contracts must be validated. Metadata can be stale.
2. **Drift is a defect** — Contract drift is a bug, not technical debt.
3. **Breaking changes require migration** — Contract changes that break consumers require versioning and migration paths.
4. **Governance is required** — Contracts need ownership, review processes, and change control.
## Next Steps
- [Who Should Use AXAG](/docs/intro/who-should-use-axag)
- [Core Concepts: Semantic Contract](/docs/concepts/semantic-contract)
- [Specification Overview](/docs/specification/overview)
## Who Should Use AXAG
Source: https://axag.org/docs/intro/who-should-use-axag
AXAG is designed for multiple audiences across the software development lifecycle.
## Frontend Engineers
Annotate UI components with semantic contracts. You add `axag-*` attributes to buttons, forms, tables, and navigation elements to declare their intent, parameters, and constraints.
## Platform Teams
Build the tooling that generates Semantic Manifests from annotations, produces MCP tool registries, and validates conformance across the product surface.
## Agent Runtime Builders
Consume tool registries generated from AXAG manifests. Your agents discover operations, validate parameters, and execute actions through the semantic contract rather than through scraping.
## Product Architects
Design interaction semantics for your product. Define the vocabulary of intents, entities, and action types that your product exposes to agents.
## API and Integration Teams
Align AXAG semantic contracts with existing API contracts (REST, GraphQL, gRPC). Ensure that UI-facing operations and API-facing operations share consistent semantics.
## Enterprise Standards Committees
Govern the AXAG vocabulary for your organization. Define conformance levels, review processes, and adoption roadmaps.
## Security and Compliance Teams
Review risk classifications, approval requirements, and safety boundaries declared in AXAG annotations. Validate that high-risk operations are appropriately gated.
## Next Steps
- [Getting Started: Mental Model](/docs/getting-started/mental-model)
- [Core Concepts](/docs/concepts/agent-experience)
# Getting Started
## Mental Model: How AXAG Works
Source: https://axag.org/docs/getting-started/mental-model
Before writing your first annotation, understand the mental model that makes AXAG work.
## The Two Audiences
Every interface element serves two audiences simultaneously:
1. **Human users** — who perceive the element visually and interact manually
2. **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
```mermaid
graph TD
A["🖥️ Human Interface (Visual, interactive surface)"] --> B
B["📋 AXAG Semantic Contract (Annotations on UI elements)"] --> C
C["📦 Semantic Manifest (Structured operation catalog)"] --> D
D["🔧 MCP Tool Registry (Generated tool definitions)"] --> E
E["🤖 Agent Runtime (Plans, validates, executes)"]
```
### 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)
```html title="Before — plain HTML button"
```
### Step 2: Add AXAG Annotations
```html title="After — AXAG-annotated checkout button" showLineNumbers
```
### Step 3: Generate Semantic Manifest Entry
```json title="axag-manifest.json — checkout entry" showLineNumbers
{
"intent": "checkout.begin",
"entity": "order",
"action_type": "write",
"operation_id": "checkout_begin",
"description": "Start checkout for a validated cart and create a checkout session.",
"required_parameters": [
{ "name": "cart_id", "type": "string" },
{ "name": "payment_method_id", "type": "string" },
{ "name": "shipping_address_id", "type": "string" }
],
"optional_parameters": [],
"risk_level": "high",
"confirmation_required": true,
"scope": "user",
"preconditions": ["cart_validated", "inventory_reserved"],
"postconditions": ["checkout_session_created"]
}
```
### Step 4: Generate MCP Tool Definition
```json title="MCP tool definition — checkout_begin" showLineNumbers
{
"name": "checkout_begin",
"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"]
},
"metadata": {
"action_type": "write",
"risk_level": "high",
"idempotent": false,
"confirmation_required": true,
"approval_required": false,
"source_intent": "checkout.begin",
"source_entity": "order"
}
}
```
### Step 5: Agent Invokes the Tool
The agent runtime:
1. Discovers `checkout_begin` in the tool registry
2. Validates that `cart_id`, `payment_method_id`, and `shipping_address_id` are provided
3. Checks that `cart_validated` and `inventory_reserved` preconditions are met
4. Notes that this is a high-risk mutating operation requiring confirmation
5. Requests user confirmation
6. Executes the operation
7. Verifies that `checkout_session_created` postcondition is satisfied
## Next Steps
- [First Annotated Action](/docs/getting-started/first-annotated-action) — Annotate your first UI element
- [First Semantic Manifest](/docs/getting-started/first-semantic-manifest) — Generate a manifest
- [First Generated Tool](/docs/getting-started/first-generated-tool) — Produce an MCP tool definition
## Your First Annotated Action
Source: https://axag.org/docs/getting-started/first-annotated-action
This guide walks you through annotating a single button with AXAG semantics in under five minutes.
## Scenario
You have a product search button on an e-commerce page. Currently, it looks like this:
```html title="Before — unannotated search"
```
An agent looking at this HTML cannot determine:
- What entity is being searched
- What parameters are required vs optional
- Whether this operation has side effects
- What scope the search operates within
## Step 1: Identify the Semantic Dimensions
Before annotating, answer these questions:
| Question | Answer |
|----------|--------|
| What is the intent? | Search for products |
| What entity does this operate on? | Product |
| What type of action is this? | Read (non-mutating) |
| What parameters are required? | query |
| What parameters are optional? | category, price_min, price_max |
| What scope does this operate in? | Catalog (public) |
| What is the risk level? | None |
| Is it idempotent? | Yes |
## Step 2: Add AXAG Annotations
The attribute syntax shown below is a Proposed Implementation Pattern.
```html title="After — fully annotated product search" showLineNumbers
```
### The same annotation as a macro
The identity, safety and parameter-name attributes fit in one [`axag` macro](/docs/specification/macro-syntax); the description stays longhand:
```html title="After — macro shorthand"
```
Both forms produce the same Semantic Manifest. `npx axag fmt` converts between them.
## Step 3: Validate Your Annotation
Check your annotation against these rules:
- ✅ `axag-intent` uses `entity.verb` format
- ✅ `axag-entity` identifies the domain object
- ✅ `axag-action-type` is one of: `read`, `write`, `delete`, `navigate`
- ✅ Required parameters are listed
- ✅ Risk level is appropriate for the action type
- ✅ Idempotency is declared for read operations
## Step 4: Verify the Semantic Contract
The annotation now declares a contract:
> "This button performs a **product search** (a **read** operation on the **product** entity) that **requires** a `query` parameter, **optionally** accepts `category`, `price_min`, and `price_max`, operates within the **catalog** scope, has **no risk**, and is **idempotent**."
An agent reading this contract can:
1. Discover the operation without parsing the DOM
2. Construct valid parameters without guessing
3. Assess safety without inspecting visual indicators
4. Retry safely because idempotency is declared
## Common Mistakes
| Mistake | Problem | Fix |
|---------|---------|-----|
| Missing `axag-intent` | Agent cannot determine purpose | Always declare intent |
| Using `axag-action-type="write"` for a search | Misclassifies a read operation | Use `read` for non-mutating operations |
| Omitting `axag-scope` | Agent cannot determine access boundaries | Always declare scope |
| Setting `axag-risk-level="high"` for a search | Over-classifying a safe operation | Match risk to actual impact |
## Next Steps
- [First Semantic Manifest](/docs/getting-started/first-semantic-manifest) — Generate a manifest from your annotation
- [First Generated Tool](/docs/getting-started/first-generated-tool) — Produce an MCP tool definition
## Your First Semantic Manifest
Source: https://axag.org/docs/getting-started/first-semantic-manifest
The Semantic Manifest is a JSON document generated from AXAG annotations. It catalogs every annotated operation with full parameter schemas, constraints, and safety metadata.
## From Annotation to Manifest
Given the annotation from the previous step:
```html title="Annotated search button (from previous step)"
```
The generated Semantic Manifest entry is:
```json title="axag-manifest.json — generated output" showLineNumbers
{
"version": "1.1.0",
"generated_at": "2026-09-14T00:00:00.000Z",
"source": {
"paths": ["src"],
"tool": "axag-cli",
"tool_version": "1.0.2"
},
"conformance": "intermediate",
"actions": [
{
"intent": "product.search",
"entity": "product",
"action_type": "read",
"operation_id": "product_search",
"description": "Search the product catalog by text query with optional filters",
"required_parameters": [
{ "name": "query", "type": "string" }
],
"optional_parameters": [
{ "name": "category", "type": "string" },
{ "name": "price_min", "type": "string" },
{ "name": "price_max", "type": "string" }
],
"risk_level": "none",
"idempotent": true,
"scope": "public",
"source_file": "src/pages/search.html",
"source_line": 1
}
]
}
```
## Manifest Structure
Every Semantic Manifest contains:
| Field | Purpose |
|-------|---------|
| `version` | The AXAG specification version the manifest conforms to |
| `generated_at` | Timestamp of manifest generation |
| `source` | Where the annotations were read from, and the tool that read them |
| `conformance` | `basic`, `intermediate`, or `full` — computed from the declared metadata |
| `actions` | Array of annotated operation definitions, sorted by intent |
Each action contains the full semantic contract: intent, entity, parameters, safety metadata, and the source location it came from.
:::tip Parameter types
Parameters listed by name (`'["query"]'`) are typed as `string`. To declare types and constraints, use the object form: `axag-required-parameters='[{"name":"price_min","type":"number","min":0}]'`.
:::
## Generation Approaches
Manifests can be generated through:
1. **Build-time extraction** — A build plugin scans annotated HTML/JSX and outputs manifest JSON
2. **Runtime extraction** — A client-side script reads `axag-*` attributes from the live DOM
3. **Static analysis** — A linter or analyzer processes source files without rendering
The recommended approach is **build-time extraction** for production deployments.
## Next Steps
- [First Generated Tool](/docs/getting-started/first-generated-tool) — Map the manifest to an MCP tool
- [Manifest Schema](/docs/semantic-manifest/manifest-schema) — Full manifest schema reference
## Your First Generated Tool
Source: https://axag.org/docs/getting-started/first-generated-tool
MCP tool definitions are generated from the Semantic Manifest. Each manifest operation becomes a callable tool that agent runtimes can discover and invoke.
## From Manifest to Tool
Given the manifest entry from the previous step, the generated MCP tool definition is:
```json title="MCP tool — product_search" showLineNumbers
{
"name": "product_search",
"description": "Search the product catalog by text query with optional filters",
"input_schema": {
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "Free-text search query for product name, description, or SKU"
},
"category": { "type": "string", "description": "Filter by product category" },
"price_min": { "type": "number", "description": "Minimum price filter" },
"price_max": { "type": "number", "description": "Maximum price filter" }
},
"required": ["query"]
},
"metadata": {
"action_type": "read",
"risk_level": "none",
"idempotent": true,
"confirmation_required": false,
"approval_required": false,
"source_intent": "product.search",
"source_entity": "product"
}
}
```
## Tool Structure
MCP tool definitions contain:
| Field | Purpose |
|-------|---------|
| `name` | Unique identifier derived from the intent (`product.search` → `product_search`) |
| `description` | Human-readable description for agent planning |
| `input_schema` | JSON Schema for tool parameters |
| `metadata` | Action type, risk, idempotency, confirmation, and the source intent |
## How Agents Use This Tool
An agent runtime:
1. **Discovers** `product_search` in the tool registry
2. **Plans** to use it based on user request (e.g., "Find red running shoes under $100")
3. **Constructs** parameters: `{ "query": "red running shoes", "price_max": 100 }`
4. **Validates** that required parameters are present
5. **Checks safety** — read operation, no risk, no confirmation needed
6. **Executes** the tool
7. **Returns** results to the user
## Next Steps
- [First End-to-End Agent Action](/docs/getting-started/first-end-to-end-agent-action)
- [Tool Generation: Mapping Rules](/docs/tool-generation/mapping-rules)
## First End-to-End Agent Action
Source: https://axag.org/docs/getting-started/first-end-to-end-agent-action
This page walks through a complete agent interaction — from user request to executed operation — powered by AXAG semantic contracts.
## Scenario
A user asks their AI agent: *"Find me blue running shoes under $80."*
## Step 1: Agent Discovers Available Tools
The agent queries the MCP Tool Registry and finds:
```json title="Tool registry — product_search" showLineNumbers
{
"name": "product_search",
"description": "Search the product catalog by text query with optional filters",
"input_schema": {
"type": "object",
"properties": {
"query": { "type": "string" },
"category": { "type": "string" },
"price_min": { "type": "number" },
"price_max": { "type": "number" }
},
"required": ["query"]
},
"metadata": {
"action_type": "read",
"risk_level": "none",
"idempotent": true,
"confirmation_required": false,
"approval_required": false,
"source_intent": "product.search",
"source_entity": "product"
}
}
```
## Step 2: Agent Plans the Invocation
The agent determines:
- Tool: `product_search`
- Parameters: `query = "blue running shoes"`, `price_max = 80`
- Safety: Read-only, no risk, no confirmation needed → proceed directly
## Step 3: Agent Validates Parameters
- ✅ `query` is present and is a string
- ✅ `price_max` is a number
- ✅ No preconditions to check
- ✅ Safety allows direct execution
## Step 4: Agent Executes
The agent invokes `product_search` with:
```json title="Agent invocation — structured parameters"
{
"query": "blue running shoes",
"price_max": 80
}
```
## Step 5: Agent Returns Results
The operation returns matching products. The agent presents them to the user with relevant details.
## What Made This Possible
Without AXAG, the agent would need to:
1. Parse the page DOM to find a search input
2. Guess that the input labeled "Search" is for products
3. Figure out how to apply price filters (dropdown? slider? text input?)
4. Submit the form by simulating a button click
5. Wait for dynamic content to load
6. Scrape the results from rendered DOM elements
With AXAG, the agent:
1. Reads structured tool definitions
2. Constructs typed parameters
3. Invokes a semantic operation
4. Receives structured results
**No scraping. No guessing. No brittle selectors.**
## Next Steps
- [Implementation Prerequisites](/docs/getting-started/implementation-prerequisites)
- [Core Concepts](/docs/concepts/agent-experience)
- [Authoring Guide](/docs/authoring-guide/annotating-buttons)
## Implementation Prerequisites
Source: https://axag.org/docs/getting-started/implementation-prerequisites
Before implementing AXAG, ensure the following prerequisites are in place.
## Technical Prerequisites
1. **Frontend framework** — Any modern framework (React, Vue, Angular, Svelte, plain HTML) is supported
2. **Build toolchain** — A build process that can run extraction plugins (Webpack, Vite, Rollup, esbuild, or similar)
3. **JSON processing** — Ability to generate and serve JSON manifest files
4. **CI/CD pipeline** — For running validation and manifest generation on each build
## Organizational Prerequisites
1. **Vocabulary ownership** — Identify who owns the intent and entity vocabulary for your product
2. **Governance model** — Define who reviews and approves changes to annotations
3. **Agent consumer identification** — Know which agent runtimes will consume your semantic contracts
4. **Risk classification policy** — Define how your organization classifies operation risk levels
## Recommended Knowledge
- Familiarity with HTML data attributes
- Understanding of JSON Schema
- Basic knowledge of the Model Context Protocol (MCP)
- Understanding of your product's domain entities and operations
## Next Steps
- [Core Concepts](/docs/concepts/agent-experience)
- [Authoring Guide](/docs/authoring-guide/annotating-buttons)
- [Specification Overview](/docs/specification/overview)
# Core Concepts
## Core Concept: Agent Experience
Source: https://axag.org/docs/concepts/agent-experience
Agent Experience (AX) is the design discipline that ensures AI agents can discover, understand, and execute interface operations reliably. It is the agent-facing counterpart to User Experience (UX).
## Why a Separate Discipline?
Human users and AI agents consume interfaces through fundamentally different modalities:
| Dimension | Human User | AI Agent |
|-----------|-----------|----------|
| **Perception** | Visual (eyes scan layout) | Structural (reads metadata) |
| **Understanding** | Contextual (infers from surroundings) | Declarative (reads explicit contracts) |
| **Interaction** | Physical (click, type, drag) | Programmatic (invoke operations) |
| **Error recovery** | Intuitive (reads error messages) | Structured (parses error codes) |
| **Trust** | Experiential (learns through use) | Contractual (relies on declared guarantees) |
Designing for both modalities requires explicit attention to agent needs — just as accessibility requires explicit attention to the needs of users with disabilities.
## AX Design Principles
### 1. Declarative Over Inferential
Agents should read explicit declarations, not infer meaning from visual presentation.
### 2. Structured Over Unstructured
Operations should be defined with typed parameters, not loose text descriptions.
### 3. Safe By Default
Destructive operations should require explicit opt-in, not implicit trust.
### 4. Discoverable Over Hidden
Available operations should be cataloged in manifests, not hidden in navigation hierarchies.
### 5. Versioned Over Volatile
Semantic contracts should be versioned and governed, not changed without notice.
## Next Steps
- [Semantic Contract](/docs/concepts/semantic-contract)
- [Intent vs Presentation](/docs/concepts/intent-vs-presentation)
## Core Concept: Semantic Contract
Source: https://axag.org/docs/concepts/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_validated` is true
- The manifest MUST include this precondition
- The tool definition MUST surface this constraint
- The agent runtime MUST validate this before execution
## Contract Components
Every AXAG semantic contract consists of:
1. **Identity** — Intent and entity declarations
2. **Interface** — Parameters, types, and constraints
3. **Preconditions** — Required state before execution
4. **Postconditions** — Guaranteed state after execution
5. **Safety** — Risk level, confirmation, approval requirements
6. **Execution semantics** — Action type, idempotency, side effects
## Contract Lifecycle
```mermaid
graph LR
A[Author] --> B[Validate]
B --> C[Generate Manifest]
C --> D[Generate Tools]
D --> E[Agent Consumes]
E --> F[Monitor Drift]
F --> A
```
Contracts are authored by frontend engineers, validated by CI, transformed into manifests and tools, consumed by agents, and monitored for drift.
## Next Steps
- [Intent vs Presentation](/docs/concepts/intent-vs-presentation)
- [Specification Overview](/docs/specification/overview)
## Core Concept: Intent vs Presentation
Source: https://axag.org/docs/concepts/intent-vs-presentation
**Presentation** describes how an interaction appears to human users. **Intent** describes what the interaction means semantically.
| Aspect | Presentation | Intent |
|--------|-------------|--------|
| Button text | "Submit" | `order.create` |
| Visual state | Grayed-out button | `precondition: cart_validated` |
| Color coding | Red button | `risk_level: high` |
| Position | Below the form | `action_type: write` |
AXAG captures intent. CSS captures presentation. Both are necessary; only intent is machine-readable.
## Why This Distinction Matters
An agent cannot:
- See that a button is red (and infer it's dangerous)
- See that a button is grayed out (and infer a precondition)
- See that a button is at the bottom of a form (and infer it submits the form)
AXAG makes all of this explicit through declarations rather than visual cues.
## Next Steps
- [Affordances](/docs/concepts/affordances)
- [Constraints](/docs/concepts/constraints)
## Core Concept: Affordances
Source: https://axag.org/docs/concepts/affordances
In UX, an affordance is a property of an object that indicates how it can be used — a button affords clicking, a slider affords dragging.
In AX, affordances are **declared capabilities**. An AXAG-annotated element declares what operations it affords to agents through its `axag-intent` and `axag-action-type` attributes.
## Visual vs Semantic Affordances
| Visual Affordance | Semantic Affordance |
|------------------|---------------------|
| A button shape suggests "clickable" | `axag-action-type="write"` declares "invocable operation" |
| A text field suggests "typeable" | `axag-parameter-type="string"` declares "accepts text input" |
| A dropdown suggests "selectable" | `axag-parameter-type="enum"` declares "accepts constrained value" |
## Agent-Facing Affordances
For agents, affordances MUST be:
- **Explicit** — Declared through annotations, not inferred from appearance
- **Typed** — Carrying parameter type information
- **Scoped** — Bounded by declared context
- **Constrained** — Governed by declared validation rules
## Next Steps
- [Constraints](/docs/concepts/constraints)
- [Preconditions and Postconditions](/docs/concepts/preconditions-postconditions)
## Core Concept: Constraints
Source: https://axag.org/docs/concepts/constraints
Constraints are rules that govern valid inputs and valid execution conditions for an operation. In AXAG, constraints are declared as part of the semantic contract — not hidden in client-side validation logic.
## Types of Constraints
### Value Constraints
Rules about individual parameter values:
- Type constraints: `type: "string"`, `type: "number"`
- Format constraints: `format: "email"`, `format: "date"`
- Range constraints: `min: 0`, `max: 100`
- Enum constraints: `enum: ["draft", "published", "archived"]`
- Pattern constraints: `pattern: "^[A-Z]{2}[0-9]{6}$"`
### Relational Constraints
Rules about relationships between parameters:
- Mutual exclusion: `price_min` and `price_max` cannot be equal
- Conditional requirement: `shipping_address_id` is required when `delivery_method` is "ship"
- Dependency: `payment_method_id` requires `billing_address_id`
### Execution Constraints
Rules about when the operation can execute:
- Preconditions: State that must be true before execution
- Rate limits: Maximum invocation frequency
- Cooldown periods: Minimum time between invocations
## Why Declaring Constraints Matters
Validation rules that exist only in client-side JavaScript are invisible to agents. If a form requires an email format but only validates on blur, an agent has no way to know this until submission fails.
AXAG makes constraints part of the contract, enabling agents to construct valid inputs on the first attempt.
## Next Steps
- [Preconditions and Postconditions](/docs/concepts/preconditions-postconditions)
- [Safety Boundaries](/docs/concepts/safety-boundaries)
## Core Concept: Preconditions and Postconditions
Source: https://axag.org/docs/concepts/preconditions-postconditions
**Preconditions** declare what state MUST be true before an operation can execute. **Postconditions** declare what state WILL be true after successful execution.
## Preconditions
Examples:
- `cart_validated` — The cart must be validated before checkout
- `user_authenticated` — The user must be logged in
- `inventory_reserved` — Inventory must be reserved before payment
Preconditions enable agents to:
1. Check whether execution is safe before invoking
2. Identify what steps must be completed first
3. Plan multi-step workflows automatically
## Postconditions
Examples:
- `checkout_session_created` — A checkout session will exist after execution
- `ticket_assigned` — The ticket will be assigned to an agent
- `order_confirmed` — The order will be in confirmed status
Postconditions enable agents to:
1. Verify operation success
2. Chain operations by using postconditions as preconditions for subsequent steps
3. Report expected outcomes to users
## Workflow Chaining
Preconditions and postconditions enable automatic workflow planning:
```
validate_cart → postcondition: cart_validated
reserve_inventory → precondition: cart_validated → postcondition: inventory_reserved
checkout_begin → precondition: cart_validated, inventory_reserved → postcondition: checkout_session_created
```
An agent can automatically determine the correct execution order.
## Next Steps
- [Context and Scope](/docs/concepts/context-and-scope)
- [Safety Boundaries](/docs/concepts/safety-boundaries)
## Core Concept: Context and Scope
Source: https://axag.org/docs/concepts/context-and-scope
**Scope** defines the boundary within which an operation executes. **Context** provides the environmental information needed for execution.
## Scope Levels
| Scope | Description | Example |
|-------|-------------|---------|
| `global` | Accessible to all users | Public product search |
| `catalog` | Scoped to a product catalog | Category-specific search |
| `tenant` | Scoped to an organizational tenant | Multi-tenant SaaS operations |
| `organization` | Scoped to an organization | Team-level settings |
| `user` | Scoped to an individual user | Profile updates |
| `session` | Scoped to an active session | Cart operations |
| `customer` | Scoped to a customer account | Order history |
## Why Scope Matters
An agent operating within a multi-tenant SaaS product must know that `tenant` scope means operations are isolated to the current tenant. Without this declaration, an agent might attempt cross-tenant operations that should be forbidden.
## Context Inheritance
AXAG supports context inheritance — child elements can inherit scope from parent containers:
```html
```
## Next Steps
- [Visibility vs Operability](/docs/concepts/visibility-vs-operability)
- [Role Awareness and Tenant Boundaries](/docs/concepts/role-awareness-tenant-boundaries)
## Core Concept: Visibility vs Operability
Source: https://axag.org/docs/concepts/visibility-vs-operability
**Visibility** means an agent can discover an operation exists. **Operability** means an agent can invoke it.
An operation can be:
- Visible and operable — Discoverable and executable
- Visible but not operable — Discoverable but gated (e.g., requires approval)
- Not visible — Hidden from the agent entirely
This distinction prevents agents from assuming that discovery implies permission.
## Declaring Operability
```html
```
This tells the agent: you can see this operation exists, but you cannot execute it without admin approval.
## Next Steps
- [Determinism and Trust](/docs/concepts/determinism-and-trust)
- [Safety Boundaries](/docs/concepts/safety-boundaries)
## Core Concept: Determinism and Trust
Source: https://axag.org/docs/concepts/determinism-and-trust
Agents require **deterministic** interactions — the same inputs with the same preconditions should produce the same outcomes. Trust in agent interactions is built on predictable behavior governed by explicit contracts.
## Why Determinism Matters
Non-deterministic interactions create:
- Unpredictable side effects
- Inconsistent operation outcomes
- Difficulty in debugging agent behavior
- Erosion of user trust in agent actions
## How AXAG Enables Determinism
1. **Typed parameters** — Agents know exact input requirements
2. **Explicit preconditions** — Agents verify state before execution
3. **Declared postconditions** — Agents verify expected outcomes
4. **Idempotency declarations** — Agents know if retry is safe
5. **Side effect declarations** — Agents assess full impact before execution
## Trust Model
Trust in AXAG is **contractual**: agents trust the semantic contract, and the contract is validated through CI, monitored for drift, and governed through change control.
## Next Steps
- [Safety Boundaries](/docs/concepts/safety-boundaries)
- [Idempotency and Side Effects](/docs/concepts/idempotency-side-effects)
## Core Concept: Safety Boundaries
Source: https://axag.org/docs/concepts/safety-boundaries
Safety boundaries are explicit declarations that control how and when operations can be executed. They prevent agents from performing dangerous actions without appropriate safeguards.
## Safety Dimensions
### Risk Classification
| Level | Description | Example |
|-------|-------------|---------|
| `none` | No risk — read-only, no side effects | Product search |
| `low` | Minor risk — easily reversible | Adding item to cart |
| `medium` | Moderate risk — state changes that require attention | Updating user profile |
| `high` | Significant risk — financial or data impact | Processing payment |
| `critical` | Maximum risk — irreversible, high-impact | Deleting an account |
### Confirmation Requirements
Operations classified as `high` or `critical` risk SHOULD require explicit confirmation before execution.
```html
```
### Approval Requirements
Some operations require multi-party approval before execution:
```html
```
### Rate Limits and Cooldowns
```html
```
## Why Safety Boundaries Are Non-Negotiable
An agent without safety boundaries is equivalent to giving every user root access. Without explicit risk declarations, agents cannot distinguish between browsing products and deleting accounts.
## Next Steps
- [Idempotency and Side Effects](/docs/concepts/idempotency-side-effects)
- [Role Awareness and Tenant Boundaries](/docs/concepts/role-awareness-tenant-boundaries)
## Core Concept: Idempotency and Side Effects
Source: https://axag.org/docs/concepts/idempotency-side-effects
**Idempotency** indicates whether an operation can be safely repeated without unintended consequences. **Side effects** are observable changes produced by an operation beyond its primary result.
## Idempotency
| Declaration | Meaning |
|-------------|---------|
| `axag-idempotent="true"` | Safe to retry — repeated invocations produce the same result |
| `axag-idempotent="false"` | Not safe to retry — repeated invocations may cause duplicates or errors |
Examples:
- Product search → idempotent (searching twice returns the same results)
- Order creation → NOT idempotent (creating twice produces two orders)
## Side Effects
Side effects SHOULD be declared when an operation causes observable changes beyond its primary purpose:
```html
```
This tells agents that merging contacts will also reassign opportunities, send notification emails, and update analytics — enabling informed decision-making.
## Next Steps
- [Role Awareness and Tenant Boundaries](/docs/concepts/role-awareness-tenant-boundaries)
- [Safety Boundaries](/docs/concepts/safety-boundaries)
## Core Concept: Role Awareness and Tenant Boundaries
Source: https://axag.org/docs/concepts/role-awareness-tenant-boundaries
Operations in multi-tenant, role-based systems require explicit declarations of who can perform them and within what boundary.
## Role Awareness
```html
```
This declares that only `admin` and `super_admin` roles can invoke this operation, and role escalation is not permitted.
## Tenant Boundaries
```html
```
The inherited `axag-tenant-boundary="strict"` declaration prevents agents from attempting cross-tenant operations.
## Why These Matter
Without role and tenant declarations:
- An agent might attempt admin operations with user-level credentials
- A multi-tenant agent might inadvertently operate across tenant boundaries
- Privilege escalation paths become invisible
## Next Steps
- [Specification Overview](/docs/specification/overview)
- [Context and Scope](/docs/concepts/context-and-scope)
# AXAG Specification
## AXAG Specification Overview
Source: https://axag.org/docs/specification/overview
**Status:** v1.0.0
**Classification:** Normative
**Last Updated:** 2026-03-21
This document provides the normative specification for the Agent Experience Accessibility Guidelines (AXAG) standard. It defines the vocabulary, annotation primitives, required and optional fields, conformance levels, and validation rules that govern AXAG implementations.
## Specification Scope
The AXAG specification defines:
1. **Canonical Vocabulary** — The set of reserved annotation attribute names and their semantics
2. **Annotation Primitives** — The atomic annotation units from which semantic contracts are composed
3. **Field Requirements** — Which fields are required at each conformance level
4. **Semantic Dimensions** — The categories of meaning that annotations can express
5. **Conformance Levels** — The tiers of implementation completeness
6. **Validation Rules** — The rules for checking annotation correctness
7. **Versioning Model** — How the specification evolves
## Content Classification
This specification uses RFC 2119 keywords:
The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.
Content in this specification is classified as:
| Classification | Meaning |
|---------------|---------|
| **Normative** | Binding requirements. Implementations MUST comply. |
| **Recommended** | Best practices. Implementations SHOULD follow. |
| **Informative** | Explanatory context. Not binding. |
| **Example** | Illustrative code or configuration. |
| **Proposed Pattern** | Inferred implementation approach. Not yet canonical. |
## Conformance Levels
AXAG defines three conformance levels:
### Basic Conformance
Minimum viable annotation. Every annotated element MUST include:
### Intermediate Conformance
Production-ready annotation. In addition to Basic fields, every annotated element SHOULD include:
### Full Conformance
Enterprise-grade annotation. In addition to Intermediate fields, annotations SHOULD include all applicable semantic dimensions:
## Annotation Format
AXAG annotations MUST be expressed as HTML data attributes prefixed with `axag-`. The prefix is reserved and MUST NOT be used for non-AXAG purposes.
### Attribute Naming Convention
- All attributes use kebab-case: `axag-intent`, `axag-action-type`
- Array values are JSON-encoded strings: `axag-required-parameters='["a","b"]'`
- Boolean values use string `"true"` or `"false"`
- Enum values use lowercase strings from the defined vocabulary
### Example: Minimal Annotation (Basic Conformance)
```html
```
### Example: Full Annotation (Full Conformance)
```html
```
## Specification Sections
The full specification is organized into the following sections:
| Section | Content |
|---------|---------|
| [Canonical Vocabulary](/docs/specification/vocabulary) | Reserved attribute names and allowed values |
| [Annotation Primitives](/docs/specification/annotation-primitives) | Atomic annotation units |
| [Required Fields](/docs/specification/required-fields) | Mandatory fields per conformance level |
| [Optional Fields](/docs/specification/optional-fields) | Additional semantic dimensions |
| [Entities](/docs/specification/entities) | Entity naming conventions |
| [Actions](/docs/specification/actions) | Action type definitions |
| [Parameters](/docs/specification/parameters) | Parameter declaration model |
| [Constraints](/docs/specification/constraints) | Constraint declaration model |
| [Risk Classification](/docs/specification/risk-classification) | Risk level definitions |
| [Safety Boundaries](/docs/specification/safety-boundaries) | Confirmation, approval, rate limits |
| [Confirmation Requirements](/docs/specification/confirmation-requirements) | When and how confirmation is required |
| [Approval Requirements](/docs/specification/approval-requirements) | Multi-party approval model |
| [Context Inheritance](/docs/specification/context-inheritance) | How child elements inherit parent context |
| [Namespacing](/docs/specification/namespacing) | Namespace rules for custom extensions |
| [Versioning](/docs/specification/versioning) | Specification version model |
| [Error Semantics](/docs/specification/error-semantics) | Error code and message conventions |
| [Conformance Levels](/docs/specification/conformance-levels) | Detailed conformance requirements |
## Next Steps
- [Canonical Vocabulary](/docs/specification/vocabulary)
- [Annotation Primitives](/docs/specification/annotation-primitives)
- [Semantic Manifest](/docs/semantic-manifest/what-it-is)
## Canonical Vocabulary
Source: https://axag.org/docs/specification/vocabulary
The AXAG canonical vocabulary defines all reserved attribute names, their types, allowed values, and semantic meaning.
## Reserved Attribute Prefix
The prefix `axag-` is reserved for AXAG annotations. Implementations MUST NOT use this prefix for non-AXAG purposes.
## Identity Attributes
| Attribute | Type | Description |
|-----------|------|-------------|
| `axag-intent` | `string` | Semantic intent in `entity.verb` format |
| `axag-entity` | `string` | Domain entity being operated on |
| `axag-action-type` | `enum` | Operation classification |
| `axag-description` | `string` | Human-readable description |
| `axag-operation-id` | `string` | Unique operation identifier |
## Parameter Attributes
| Attribute | Type | Description |
|-----------|------|-------------|
| `axag-required-parameters` | `string[]` | JSON array of required parameter names |
| `axag-optional-parameters` | `string[]` | JSON array of optional parameter names |
| `axag-params-from` | `string` | `#id` of the form whose controls supply parameters |
| `axag-schema` | `string` | Schema binding: `zod:#` or `openapi:[#]` |
| `axag-parameter` | `string` | Parameter name (on input elements) |
| `axag-parameter-type` | `string` | Parameter data type |
| `axag-parameter-required` | `boolean` | Whether the parameter is required |
| `axag-parameter-description` | `string` | Parameter description |
| `axag-parameter-format` | `string` | Expected format (email, date, url, etc.) |
| `axag-parameter-enum` | `string[]` | Allowed values for enum parameters |
| `axag-parameter-min` | `number` | Minimum value |
| `axag-parameter-max` | `number` | Maximum value |
| `axag-parameter-pattern` | `string` | Regex pattern for validation |
| `axag-parameter-min-length` | `number` | Minimum string length |
| `axag-parameter-max-length` | `number` | Maximum string length |
## State Attributes
| Attribute | Type | Description |
|-----------|------|-------------|
| `axag-preconditions` | `string[]` | Required state before execution |
| `axag-postconditions` | `string[]` | Guaranteed state after execution |
| `axag-side-effects` | `string[]` | Observable changes beyond primary result |
## Safety Attributes
| Attribute | Type | Description |
|-----------|------|-------------|
| `axag-risk-level` | `enum` | `none`, `low`, `medium`, `high`, `critical` |
| `axag-confirmation-required` | `boolean` | Whether explicit confirmation is needed |
| `axag-confirmation-message` | `string` | Message to display for confirmation |
| `axag-approval-required` | `boolean` | Whether multi-party approval is needed |
| `axag-approval-roles` | `string[]` | Roles that can approve |
| `axag-approval-count` | `number` | Number of approvals required |
| `axag-idempotent` | `boolean` | Whether safe to repeat |
| `axag-rate-limit` | `string` | Maximum invocation frequency |
| `axag-cooldown` | `string` | Minimum time between invocations |
## Scope Attributes
| Attribute | Type | Description |
|-----------|------|-------------|
| `axag-scope` | `enum` | `public`, `user`, `tenant`, `global` |
| `axag-tenant-boundary` | `enum` | `strict` (never crosses tenants) or `relaxed` (cross-tenant access where authorized) |
| `axag-required-roles` | `string[]` | Roles permitted to invoke |
| `axag-role-escalation` | `boolean` | Whether role escalation is permitted |
## Visibility Attributes
| Attribute | Type | Description |
|-----------|------|-------------|
| `axag-visible` | `boolean` | Whether discoverable by agents |
| `axag-operable` | `boolean` | Whether invocable by agents |
| `axag-operability-reason` | `string` | Why the operation is not operable |
## Workflow Attributes
| Attribute | Type | Description |
|-----------|------|-------------|
| `axag-workflow-id` | `string` | Workflow identifier |
| `axag-workflow-step` | `number` | Step position in workflow |
| `axag-workflow-total-steps` | `number` | Total steps in workflow |
| `axag-workflow-next` | `string` | Intent of next step |
| `axag-workflow-previous` | `string` | Intent of previous step |
## Versioning Attributes
| Attribute | Type | Description |
|-----------|------|-------------|
| `axag-version` | `string` | AXAG specification version |
| `axag-deprecated` | `boolean` | Whether this annotation is deprecated |
| `axag-deprecated-replacement` | `string` | Replacement intent for deprecated operations |
| `axag-since` | `string` | Version when this annotation was introduced |
## Action Type Values
| Value | Description |
|-------|-------------|
| `read` | Non-mutating data retrieval |
| `write` | Creates or modifies an entity |
| `delete` | Removes, cancels, or deactivates an entity |
| `navigate` | Changes the view or context without data mutation |
:::note Changed in 1.1
Earlier drafts of this page listed `create` and `mutate`. The manifest schema and all AXAG tooling only ever accepted `write`; use `write` for both.
:::
## Scope Values
| Value | Description |
|-------|-------------|
| `public` | Available without authentication (catalog browsing, help pages) |
| `user` | Affects only the signed-in user's own data |
| `tenant` | Affects data shared across the user's organization |
| `global` | Affects every tenant or the whole platform |
## Risk Level Values
| Value | Description | Typical Actions |
|-------|-------------|-----------------|
| `none` | No risk | Search, browse, read |
| `low` | Easily reversible | Add to cart, bookmark |
| `medium` | Requires attention | Update profile, change settings |
| `high` | Financial or data impact | Process payment, submit application |
| `critical` | Irreversible, high impact | Delete account, purge data |
## Next Steps
- [Annotation Primitives](/docs/specification/annotation-primitives)
- [Required Fields](/docs/specification/required-fields)
## Annotation Primitives
Source: https://axag.org/docs/specification/annotation-primitives
Annotation primitives are the atomic units from which AXAG semantic contracts are composed. Every annotation consists of one or more primitives attached to an HTML element.
## Primitive Categories
### 1. Identity Primitives
Declare what the operation is:
- `axag-intent` — The semantic purpose
- `axag-entity` — The domain object
- `axag-action-type` — The operation classification
### 2. Interface Primitives
Declare what the operation requires:
- `axag-required-parameters` — Mandatory inputs
- `axag-optional-parameters` — Optional inputs
- Parameter detail attributes on input elements
### 3. State Primitives
Declare preconditions and postconditions:
- `axag-preconditions` — Required state before execution
- `axag-postconditions` — Guaranteed state after execution
- `axag-side-effects` — Observable changes
### 4. Safety Primitives
Declare risk and authorization:
- `axag-risk-level` — Danger classification
- `axag-confirmation-required` — Confirmation gate
- `axag-approval-required` — Approval gate
- `axag-idempotent` — Retry safety
### 5. Context Primitives
Declare operational boundaries:
- `axag-scope` — Boundary level
- `axag-required-roles` — Role constraints
- `axag-tenant-boundary` — Tenant isolation (`strict` or `relaxed`)
## Composition Rules
Primitives compose according to these rules:
1. **Identity is mandatory** — Every annotated element MUST have at least `axag-intent`, `axag-entity`, and `axag-action-type`
2. **Safety follows action type** — Mutating actions SHOULD declare risk level
3. **Context is inheritable** — Child elements inherit parent context primitives
4. **Parameters are element-scoped** — Parameter detail attributes attach to input elements
## Next Steps
- [Required Fields](/docs/specification/required-fields)
- [Optional Fields](/docs/specification/optional-fields)
## Macro Syntax
Source: https://axag.org/docs/specification/macro-syntax
The `axag` attribute packs the most common annotation fields into one string. It expands to exactly the longhand `axag-*` attributes an author could have written, so validators, manifests and generated tools are identical whichever form a page uses.
The macro is a Proposed Implementation Pattern in AXAG 1.1. Tooling (`@web-axag/axag-lint`, `axag-cli`, the VS Code extension) supports it; it becomes normative once the 1.1 review period closes.
```html title="Longhand"
```
```html title="Macro"
```
## Grammar
```text
macro = action-type ":" intent [ "!" risk-level ] [ "?" pair *( "&" pair ) ]
action-type = "read" | "write" | "delete" | "navigate"
intent = entity "." verb ; lowercase letters and _, as axag-intent
risk-level = "none" | "low" | "medium" | "high" | "critical"
pair = key [ "=" value ] ; a bare key means true
value = token *( "," token )
token = 1*( ALPHA / DIGIT / "_" / "-" )
```
No escaping is needed: intents cannot contain `: ! ? & = ,`, so values never collide with separators. Whitespace is not allowed inside the macro.
## Keys
| Key | Expands to | Value |
|-----|-----------|-------|
| `approval` | `axag-approval-required` | `true` / `false` (bare key = `true`) |
| `confirm` | `axag-confirmation-required` | `true` / `false` |
| `idempotent` | `axag-idempotent` | `true` / `false` |
| `async` | `axag-async` | `true` / `false` |
| `scope` | `axag-scope` | `public`, `user`, `tenant`, `global` |
| `tenant` | `axag-tenant-boundary` | `strict`, `relaxed` |
| `roles` | `axag-approval-roles` | comma-separated list |
| `effects` | `axag-side-effects` | comma-separated list |
| `req` | `axag-required-parameters` | comma-separated parameter names |
| `opt` | `axag-optional-parameters` | comma-separated parameter names |
Each key MAY appear at most once. List values become JSON string arrays: `roles=owner,security_admin` is `axag-approval-roles='["owner","security_admin"]'`.
## Rules
1. The macro expands to longhand attributes before any validation, manifest generation or tool generation.
2. `axag-entity` defaults to the part of the intent before the dot. An explicit `axag-entity` overrides it and is not a conflict.
3. Longhand attributes MAY sit next to the macro to add fields the grammar cannot express: `axag-description`, `axag-preconditions`, `axag-postconditions`, typed parameter objects, and list items containing spaces.
4. A longhand attribute that sets the same field as the macro to a different value is an error (**AXAG-LINT-028**). Implementations use the longhand value and report the conflict.
5. A macro that does not match the grammar is an error (**AXAG-LINT-027**), reported with the column where parsing failed. Parts that do parse still apply.
6. An empty `axag` attribute is ignored. In JSX, `axag={spec}` is a dynamic value and is not read as a macro.
## Examples
| Macro | Meaning |
|-------|---------|
| `read:product.search!none?idempotent&req=query&opt=category,price_max` | Idempotent search with one required and two optional parameters |
| `write:cart.add_item!low?idempotent=false&effects=cart_updated` | Non-idempotent write with a side effect |
| `delete:invoice.void!high?confirm&idempotent&scope=tenant&tenant=strict` | Confirmed, tenant-bound delete |
| `navigate:settings.open?scope=user` | Navigation, no risk level declared |
## Converting existing pages
`axag-cli` rewrites files in either direction without touching other attributes:
```bash
npx axag fmt src --to macro # longhand → macro
npx axag fmt src --to longhand # macro → longhand
npx axag fmt src --check # CI: fail if any file isn't in macro form
```
## Next Steps
- [Annotation Attributes Reference](/docs/reference/annotation-attributes)
- [Required Fields](/docs/specification/required-fields)
## Required Fields
Source: https://axag.org/docs/specification/required-fields
At minimum (Basic Conformance), every AXAG-annotated element MUST include:
1. **`axag-intent`** — The semantic intent in `entity.verb` format (e.g., `product.search`, `order.create`)
2. **`axag-entity`** — The domain entity being operated on (e.g., `product`, `order`, `ticket`)
3. **`axag-action-type`** — The operation classification (`read`, `write`, `delete`, `navigate`)
At Intermediate Conformance, these additional fields are REQUIRED:
4. **`axag-required-parameters`** — JSON array of required parameter names
5. **`axag-scope`** — The operational boundary
6. **`axag-risk-level`** — The risk classification
7. **`axag-description`** — Human-readable operation description
Implementations that claim conformance at a given level MUST include all fields required at that level and all lower levels.
## Optional Fields
Source: https://axag.org/docs/specification/optional-fields
Optional fields extend the semantic contract with additional dimensions. They are RECOMMENDED for Full Conformance and MAY be included at any level.
## Parameter Fields
- `axag-optional-parameters` — Parameters that are accepted but not required
- `axag-parameter-*` attributes on input elements for detailed parameter metadata
## State Fields
- `axag-preconditions` — Required state before execution
- `axag-postconditions` — Guaranteed state after execution
- `axag-side-effects` — Observable changes
## Safety Fields
- `axag-confirmation-required`, `axag-confirmation-message`
- `axag-approval-required`, `axag-approval-roles`, `axag-approval-count`
- `axag-idempotent`
- `axag-rate-limit`, `axag-cooldown`
## Access Control Fields
- `axag-required-roles`
- `axag-role-escalation`
- `axag-tenant-boundary`
## Workflow Fields
- `axag-workflow-id`, `axag-workflow-step`, `axag-workflow-total-steps`
## Visibility Fields
- `axag-visible`, `axag-operable`, `axag-operability-reason`
## Entities
Source: https://axag.org/docs/specification/entities
An entity is the domain object that an AXAG-annotated operation acts upon. Entities are declared via the `axag-entity` attribute.
## Naming Conventions
- Entity names MUST be lowercase, singular nouns: `product`, `order`, `ticket`, `campaign`
- Compound entities use underscore separation: `shopping_cart`, `user_profile`, `tenant_settings`
- Entity names SHOULD match the domain model used by the application's backend
## Common Entities by Domain
| Domain | Entities |
|--------|----------|
| E-Commerce | `product`, `cart`, `order`, `payment`, `shipment`, `return` |
| CRM | `lead`, `contact`, `opportunity`, `account`, `pipeline` |
| Marketing | `campaign`, `audience`, `experiment`, `template` |
| Support | `ticket`, `agent`, `knowledge_article`, `escalation` |
| Travel | `flight`, `hotel`, `booking`, `itinerary`, `reservation` |
| Analytics | `report`, `dashboard`, `dataset`, `metric`, `alert` |
| Jobs | `job`, `application`, `candidate`, `interview` |
## Entity Relationships
When operations span multiple entities, use the primary entity in `axag-entity` and declare related entities in parameters or side effects.
## Actions
Source: https://axag.org/docs/specification/actions
The `axag-action-type` attribute classifies the nature of an operation.
## Action Types
| Type | Semantic | Side Effects | Idempotent by Default |
|------|----------|-------------|----------------------|
| `read` | Retrieves data without modification | None | Yes |
| `write` | Creates or modifies an entity | Entity creation or state change | Depends — declare `axag-idempotent` |
| `delete` | Removes an entity | Entity removal | Depends |
| `navigate` | Changes view context without data mutation | None | Yes |
## Rules
- `read` and `navigate` actions SHOULD have `axag-risk-level="none"` unless special circumstances apply
- `write` and `delete` actions MUST declare `axag-risk-level`
- `delete` actions SHOULD have `axag-confirmation-required="true"` unless the deletion is trivially reversible
- `write` actions that produce financial impact SHOULD be classified as `high` or `critical` risk
## Parameters
Source: https://axag.org/docs/specification/parameters
Parameters are the inputs required and accepted by an AXAG-annotated operation.
## Declaration Methods
### On the action element:
```html
```
### On individual input elements:
```html
```
## Parameter Types
`string`, `number`, `boolean`, `date`, `datetime`, `enum`, `array`, `object`
## Parameter Constraints
- `axag-parameter-min` / `axag-parameter-max` — Numeric range
- `axag-parameter-min-length` / `axag-parameter-max-length` — String length
- `axag-parameter-pattern` — Regex validation
- `axag-parameter-enum` — Allowed values
- `axag-parameter-format` — Format hint (email, url, phone, date, etc.)
## Constraints
Source: https://axag.org/docs/specification/constraints
Constraints govern valid inputs and execution conditions. They MUST be declared in annotations, not hidden in client-side validation logic.
## Value Constraints
Applied to individual parameters: type, format, range, pattern, enum, length.
## Relational Constraints
Relationships between parameters: mutual exclusion, conditional requirements, dependencies.
## Execution Constraints
State requirements: preconditions, rate limits, cooldown periods, temporal windows.
## Declaration Example
```html
```
## Risk Classification
Source: https://axag.org/docs/specification/risk-classification
Every mutating operation MUST declare a risk level. Risk classification drives safety requirements.
| Level | Description | Required Safety |
|-------|-------------|----------------|
| `none` | No risk (reads, navigation) | None |
| `low` | Easily reversible (cart operations) | None required, logging recommended |
| `medium` | State changes requiring attention | Confirmation recommended |
| `high` | Financial or significant data impact | Confirmation MUST be required |
| `critical` | Irreversible, high-impact operations | Confirmation AND approval MUST be required |
## Classification Guidelines
- **Payment processing** → `high`
- **Account deletion** → `critical`
- **Profile update** → `medium`
- **Adding bookmark** → `low`
- **Searching products** → `none`
Implementations MUST NOT classify a `delete` action as `none` risk unless the deletion is trivially reversible (e.g., removing an unsaved draft).
## Safety Boundaries
Source: https://axag.org/docs/specification/safety-boundaries
Safety boundaries are declared in the annotation and enforced in two places: the agent runtime in the page, and the server that receives the call. A declaration alone constrains nothing — an agent holding the page's credentials can call the API directly — so an implementation MUST enforce `confirmation_required`, `approval_required`, `required_roles` and `tenant_boundary` on the server for any action at `high` risk or above. The page's enforcement is what gives a person the chance to refuse; see [Safety Enforcers](/docs/frameworks/safety).
Safety boundaries define the guardrails around operation execution. This section defines the normative requirements for safety declarations.
## Confirmation Requirements
Operations with `risk_level` of `high` or `critical` MUST declare `axag-confirmation-required="true"`.
## Approval Requirements
Operations that require multi-party authorization MUST declare `axag-approval-required="true"` with `axag-approval-roles` and `axag-approval-count`.
## Rate Limits
Operations subject to rate limiting SHOULD declare `axag-rate-limit` using the format `{count}/{period}` (e.g., `100/hour`, `10/minute`).
## Cooldown Periods
Operations that require a minimum interval between invocations SHOULD declare `axag-cooldown` using duration format (e.g., `60s`, `5m`, `1h`).
## Safety Matrix
| Action Type | Minimum Risk | Confirmation | Approval |
|------------|-------------|-------------|---------|
| `read` | `none` | No | No |
| `navigate` | `none` | No | No |
| `write` | `low` | Required for `high`+ | For regulated or high-impact changes |
| `delete` | `medium` | Required | Recommended |
## Confirmation Requirements
Source: https://axag.org/docs/specification/confirmation-requirements
Confirmation requirements gate operation execution behind explicit user or agent acknowledgment.
## When Confirmation Is Required
- `risk_level` is `high` or `critical`
- The operation produces irreversible side effects
- Financial transactions exceed defined thresholds
## Declaration
```html
```
## Agent Runtime Behavior
When `axag-confirmation-required="true"`, agent runtimes MUST:
1. Present the confirmation message to the user
2. Wait for explicit confirmation
3. Only proceed upon affirmative response
4. Log the confirmation event
## Approval Requirements
Source: https://axag.org/docs/specification/approval-requirements
Approval requirements gate operations behind multi-party authorization. These are distinct from confirmations — approvals require a different person or role to authorize.
## Declaration
```html
```
## Approval Model
- `axag-approval-roles` — Roles authorized to approve
- `axag-approval-count` — Number of approvals required (default: 1)
- The invoking agent/user cannot self-approve
## Agent Runtime Behavior
When `axag-approval-required="true"`, agent runtimes MUST:
1. Submit an approval request rather than executing directly
2. Notify the appropriate approval roles
3. Wait for the required number of approvals
4. Execute only after all approvals are received
## Context Inheritance
Source: https://axag.org/docs/specification/context-inheritance
AXAG supports context inheritance — child elements inherit scope, tenant, and role context from parent containers.
## Inheritance Rules
1. `axag-scope` on a parent element applies to all child annotations
2. `axag-tenant-boundary` on a parent element applies to all children
3. `axag-required-roles` on a parent element constrains all children
4. Child elements MAY override inherited context with more restrictive values
5. Child elements MUST NOT override inherited context with less restrictive values
## Example
```html
```
## Namespacing
Source: https://axag.org/docs/specification/namespacing
Organizations MAY extend the AXAG vocabulary with custom attributes using namespaced prefixes.
## Rules
- Custom attributes MUST use the format `axag-x-{namespace}-{attribute}`
- The `x-` prefix indicates an extension attribute
- Extensions MUST NOT conflict with reserved AXAG attribute names
- Extensions SHOULD be documented in the organization's AXAG governance policy
## Example
```html
```
## Specification Versioning
Source: https://axag.org/docs/specification/versioning
The AXAG specification follows semantic versioning: `MAJOR.MINOR.PATCH`.
## Version Rules
- **MAJOR** — Breaking changes to normative requirements
- **MINOR** — New optional fields or conformance requirements
- **PATCH** — Clarifications, typo fixes, informative content updates
## Annotation Versioning
Annotations MAY declare the specification version they conform to:
```html
```
## Backward Compatibility
- MINOR versions MUST be backward-compatible with the same MAJOR version
- Deprecated attributes MUST remain valid for at least one MINOR version after deprecation
- Deprecation MUST be declared via `axag-deprecated="true"` and `axag-deprecated-replacement`
## Error Semantics
Source: https://axag.org/docs/specification/error-semantics
AXAG defines error codes and semantics for annotation validation and runtime execution failures.
## Validation Error Codes
| Code | Name | Description |
|------|------|-------------|
| `AXAG-001` | Missing Intent | `axag-intent` not declared |
| `AXAG-002` | Missing Entity | `axag-entity` not declared |
| `AXAG-003` | Missing Action Type | `axag-action-type` not declared |
| `AXAG-004` | Invalid Action Type | Value not in allowed enum |
| `AXAG-005` | Invalid Risk Level | Value not in allowed enum |
| `AXAG-006` | Unsafe Mutation | Mutating action without risk declaration |
| `AXAG-007` | Missing Confirmation | High/critical risk without confirmation requirement |
| `AXAG-008` | Parameter Mismatch | Required parameters not matching input elements |
| `AXAG-009` | Scope Mismatch | Child scope less restrictive than parent |
| `AXAG-010` | Manifest Drift | Annotation changed without manifest regeneration |
## Runtime Error Codes
| Code | Name | Description |
|------|------|-------------|
| `AXAG-R001` | Precondition Not Met | Required precondition is false |
| `AXAG-R002` | Confirmation Rejected | User declined confirmation |
| `AXAG-R003` | Approval Pending | Awaiting required approvals |
| `AXAG-R004` | Rate Limited | Invocation frequency exceeded |
| `AXAG-R005` | Role Unauthorized | Invoking role not in required roles |
## Conformance Levels
Source: https://axag.org/docs/specification/conformance-levels
AXAG defines three conformance levels that represent progressive implementation maturity.
## Basic Conformance
**Minimum viable annotation.** Required fields: `axag-intent`, `axag-entity`, `axag-action-type`.
Suitable for: initial adoption, proof of concept, internal tooling.
## Intermediate Conformance
**Production-ready annotation.** Adds: `axag-required-parameters`, `axag-scope`, `axag-risk-level`, `axag-description`.
Suitable for: production deployments, external-facing products, agent-accessible interfaces.
## Full Conformance
**Enterprise-grade annotation.** Adds all applicable optional dimensions: preconditions, postconditions, side effects, confirmation, approval, idempotency, roles, rate limits.
Suitable for: regulated industries, high-trust agent interactions, enterprise standards compliance.
## Claiming Conformance
Every Semantic Manifest declares its conformance level in the `conformance` field. Generators compute it from the metadata the actions actually declare, so a claim can't exceed what the annotations support:
```json
{
"version": "1.1.0",
"conformance": "intermediate",
"actions": []
}
```
The CLI's `axag validate --level` flag accepts the same names. The earlier `A`, `AA`, `AAA` names are still accepted and map to `basic`, `intermediate`, `full`.
# Semantic Manifest
## Semantic Manifest: What It Is
Source: https://axag.org/docs/semantic-manifest/what-it-is
The Semantic Manifest is a **structured JSON document** generated from AXAG annotations. It serves as the intermediate artifact between annotated UI elements and MCP tool definitions.
## Purpose
The manifest:
1. **Catalogs** all annotated operations in a structured format
2. **Normalizes** annotation data into a consistent schema
3. **Enables discovery** — agents query the manifest to find available operations
4. **Serves as input** for MCP tool generation
5. **Provides a validation target** for CI/CD pipelines
## Structure
```json title="axag-manifest.json — example structure" showLineNumbers
{
"version": "1.1.0",
"generated_at": "2026-09-14T00:00:00.000Z",
"source": {
"paths": ["src"],
"tool": "axag-cli",
"tool_version": "1.0.2"
},
"conformance": "intermediate",
"actions": [
{
"intent": "product.search",
"entity": "product",
"action_type": "read",
"operation_id": "product_search",
"description": "Search the product catalog by text query with optional filters",
"required_parameters": [
{ "name": "query", "type": "string" }
],
"optional_parameters": [
{ "name": "category", "type": "string" },
{ "name": "price_min", "type": "string" },
{ "name": "price_max", "type": "string" }
],
"risk_level": "none",
"idempotent": true,
"scope": "public",
"source_file": "src/pages/search.html",
"source_line": 1
}
]
}
```
## Manifest vs Annotations
| Aspect | Annotations | Manifest |
|--------|------------|---------|
| Format | HTML attributes | JSON document |
| Location | Inline in UI code | Standalone file |
| Scope | Single element | Entire page/application |
| Consumer | Build tools, extractors | Agent runtimes, validators |
| Mutability | Changed by developers | Generated from annotations |
The manifest is a **derived artifact**. The annotations are the source of truth.
## Next Steps
- [Why It Exists](/docs/semantic-manifest/why-it-exists)
- [Manifest Schema](/docs/semantic-manifest/manifest-schema)
## Why the Semantic Manifest Exists
Source: https://axag.org/docs/semantic-manifest/why-it-exists
The manifest exists because AXAG annotations are scattered across HTML elements throughout an application. Agents need a single, queryable document to discover all available operations.
## Problems Without a Manifest
1. Agents would need to parse every page's DOM to find annotations
2. No consolidated view of available operations
3. No validation checkpoint between annotations and tool generation
4. No versioned artifact for change tracking
## The Manifest as Bridge
```
Annotations (scattered) → Manifest (consolidated) → Tools (consumable)
```
The manifest consolidates, normalizes, and structures all annotation data into a single document that agent runtimes and toolchains can consume efficiently.
## Manifest Schema
Source: https://axag.org/docs/semantic-manifest/manifest-schema
The Semantic Manifest is validated by a JSON Schema published at [`/schema/v1.1/axag-manifest.schema.json`](pathname:///schema/v1.1/axag-manifest.schema.json). The [v1 schema](pathname:///schema/v1/axag-manifest.schema.json) stays published for existing manifests; v1.1 only adds optional fields and enum values, so every valid v1 manifest is also valid under v1.1.
## Top-Level Fields
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `version` | `string` (semver) | Yes | AXAG specification version |
| `generated_at` | `date-time` | Yes | ISO 8601 timestamp |
| `source` | `Source` | Yes | Where the annotations were read from |
| `conformance` | `enum` | Yes | `basic`, `intermediate`, `full` |
| `actions` | `Action[]` | Yes | Operation definitions |
## Source Fields
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `url` | `uri` | No | Application URL |
| `paths` | `string[]` | No | Source paths scanned |
| `tool` | `string` | No | Generator name |
| `tool_version` | `string` | No | Generator version |
## Action Fields
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `intent` | `string` | Yes | Semantic intent, `entity.verb` (`^[a-z_]+\.[a-z_]+$`) |
| `entity` | `string` | Yes | Domain entity (`^[a-z_]+$`) |
| `action_type` | `enum` | Yes | `read`, `write`, `delete`, `navigate` |
| `description` | `string` | Yes | Human-readable description |
| `operation_id` | `string` | No | Unique operation identifier |
| `required_parameters` | `Parameter[]` | No | Parameters that must be provided |
| `optional_parameters` | `Parameter[]` | No | Parameters that may be provided |
| `risk_level` | `enum` | No | `none`, `low`, `medium`, `high`, `critical` |
| `confirmation_required` | `boolean` | No | Human confirmation gate |
| `approval_required` | `boolean` | No | Role-based approval gate |
| `approval_roles` | `string[]` | No | Roles that can approve |
| `idempotent` | `boolean` | No | Retry safety |
| `async` | `boolean` | No | Completes asynchronously (1.1) |
| `scope` | `enum` | No | `public`, `user`, `tenant`, `global` (`public` added in 1.1) |
| `tenant_boundary` | `enum` | No | `strict`, `relaxed` (1.1) |
| `required_roles` | `string[]` | No | Roles permitted to invoke (1.1) |
| `side_effects` | `string[]` | No | Observable changes |
| `preconditions` | `string[]` | No | Required state |
| `postconditions` | `string[]` | No | Guaranteed state |
| `element_selector` | `string` | No | CSS selector of the source element |
| `source_file` | `string` | No | File the annotation lives in |
| `source_line` | `integer` | No | Line in that file (1-based) |
## Parameter Fields
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `name` | `string` | Yes | Parameter name |
| `type` | `enum` | Yes | `string`, `number`, `integer`, `boolean`, `array`, `object` (`integer` added in 1.1) |
| `description` | `string` | No | Human-readable description |
| `enum` | `array` | No | Allowed values |
| `min` / `max` | `number` | No | Numeric bounds |
| `minLength` / `maxLength` | `integer` | No | String length bounds (`minLength` added in 1.1) |
| `pattern` | `string` | No | Regular expression the value must match (1.1) |
| `format` | `enum` | No | `email`, `url`, `date`, `datetime`, `uuid` |
| `default` | any | No | Value used when omitted |
| `items` | `object` | No | JSON Schema for array elements (1.1) |
| `properties` | `object` | No | JSON Schema properties for objects (1.1) |
| `source` | `enum` | No | `harvested:html`, `zod`, `openapi` — where an undeclared parameter came from (1.1) |
Which optional fields a manifest fills in determines its [conformance level](/docs/specification/conformance-levels).
## Manifest Generation Model
Source: https://axag.org/docs/semantic-manifest/generation-model
Semantic Manifests are generated from AXAG annotations through extraction, normalization, and serialization.
## Generation Pipeline
```mermaid
graph LR
A[Source Files] --> B[Annotation Extractor]
B --> C[Normalization]
C --> D[Validation]
D --> E[Serialization]
E --> F[manifest.json]
```
## Generation Approaches
### Build-Time Extraction (Recommended)
A bundler plugin reads source files (HTML, JSX, TSX, Vue SFC, Angular templates) and generates the manifest during the build. See [Build-Time Compilation](/docs/tool-generation/build-time-compilation).
### Runtime Extraction
A client-side script reads `axag-*` attributes from the live DOM. Useful for dynamic applications where annotations are computed at runtime.
### Static Analysis
An AST-based analyzer processes source files without rendering — `axag generate` in CI, using the same compiler as the bundler plugin. Most reliable for CI/CD validation.
Annotations whose value is only known at runtime (`axag={spec}` built from props) can't be extracted statically. Generators list them under `dynamic_actions` so a runtime knows the manifest is incomplete for that page.
## Extraction Rules
1. Scan all elements with any `axag-*` attribute
2. Group attributes by element
3. Resolve context inheritance from parent elements
4. Normalize parameter references
5. Validate required fields per conformance level
6. Serialize to manifest JSON
## Schema Harvesting
Source: https://axag.org/docs/semantic-manifest/schema-harvesting
An action's parameters don't have to be written out in `axag-*` attributes. Generators combine three sources, highest precedence first:
| Source | Where it comes from | `source` in the manifest |
|--------|---------------------|--------------------------|
| **Declared** | `axag-required-parameters` / `axag-optional-parameters`, `req=` / `opt=` in the macro | *(omitted)* |
| **Schema binding** | A Zod schema or OpenAPI operation named by `axag-schema` or the CLI's `bindings` config | `zod` or `openapi` |
| **Harvested** | The form's controls, constraints and labels | `harvested:html` |
## Precedence
1. A higher source decides whether a parameter is **required or optional** and keeps every field it sets.
2. Lower sources **fill fields the higher one left out**, such as a description from a `