Getting Started
aixa.js is a lightweight SDK that exposes your web application's functionality to AI agents via JSON-RPC tool schemas. This guide walks you through installation, quick-start examples, and verification — so you can go from zero to agent-friendly in under a minute.
Installation
Choose the method that best fits your project:
1. npm
npm install @aixa/core
Then import it in your application:
import { AIXA } from '@aixa/core';
2. CDN — jsDelivr
<script type="module">
import { AIXA } from 'https://cdn.jsdelivr.net/npm/@aixa/core/dist/index.js';
</script>
3. CDN — unpkg
<script type="module">
import { AIXA } from 'https://unpkg.com/@aixa/core/dist/index.js';
</script>
4. CDN — esm.sh (bundled)
<script type="module">
import { AIXA } from 'https://esm.sh/@aixa/core';
</script>
5. Self-Hosted Bundle
Download the bundle entry point from demo/vendor/bundle-entry.mjs,
host it on your own server, and import it directly:
<script type="module">
import { AIXA } from '/path/to/your/bundle-entry.mjs';
</script>
Quick Start — Auto-Inference
Auto-inference scans your page's semantic HTML and automatically generates JSON-RPC tool schemas. No manual configuration is needed — ideal for server-rendered pages and simple SPAs.
import { AIXA } from '@aixa/core';
const aixa = new AIXA({ autoInfer: true });
aixa.start();
That's it. The SDK will:
- Scan the DOM for semantic elements (search inputs, forms, buttons, links, etc.)
- Generate tool schemas with names, descriptions, and parameter definitions
- Broadcast available tools via
CustomEventonwindow - Listen for incoming JSON-RPC requests from AI agents
Quick Start — Manual Config
For complex SPAs, custom APIs, or when you need fine-grained control over what agents can access, use the manual registration API:
import { AIXA } from '@aixa/core';
const aixa = new AIXA();
aixa.registerSearch('product_search', [
{ name: 'q', type: 'string', description: 'Search query', required: true },
{ name: 'category', type: 'string', description: 'Product category' },
{ name: 'minPrice', type: 'number', description: 'Minimum price' },
{ name: 'maxPrice', type: 'number', description: 'Maximum price' }
], 'https://api.example.com/products/search');
aixa.start();
Verifying It Works
Once the SDK is running, open your browser's DevTools console and run:
window.__aixa.getCapabilities()
This returns an array of all registered tool schemas — both auto-inferred and manually
registered. Each entry includes the tool's name, description,
parameters schema, riskLevel, and category.
aixa:tools-ready event
to know when tool discovery is complete:
window.addEventListener('aixa:tools-ready', (e) => {
console.log('Available tools:', e.detail.tools);
});
Next Steps
-
Auto-Inference —
Learn how the DOM scanner works, which elements it detects, and how to
annotate your HTML with
data-aixa-*attributes. - Manual Configuration — Register custom tools for APIs, mutations, and complex workflows with full control over security and behavior.
- HITL Security — Understand confirmation gating, risk levels, and human-in-the-loop patterns for high-risk operations.
- Demo — Explore the live demo application to see aixa.js in action with both auto-inferred and manually configured tools.