agentronicsDOCS
Guides

Plain HTML / CDN

Drop the Agentronics SDK into a static page with one script tag — no bundler required.

Plain HTML / CDN

Agentronics ships an IIFE bundle alongside the ESM and CJS builds. Static sites, server-rendered HTML, and prototypes can pull it from the CDN without a build step.

One-tag install

<script type="module">
  import { Agentronics } from 'https://cdn.jsdelivr.net/npm/@agentronics/sdk@0.7.0/dist/index.js'
 
  const client = Agentronics.init({
    publishableKey: 'agtx_pk_live_…',
    siteId: 'shop-acme-com',
  })
 
  client.installDomEnforcer()
  client.installMemoryDelivery({ metaTags: true })
</script>

The CDN (jsDelivr) serves the same files as npm install @agentronics/sdk. Pin an exact version (0.7.0) in production: a pinned URL never changes, so browsers cache it for a year.

The examples pin an exact version, which lets you use Subresource Integrity. To get fixes without editing your page, load @agentronics/sdk@0.7 instead (the latest 0.7.x; no SRI, since the file changes with each patch). Agent Nic installs it that way.

If your site sends a Content-Security-Policy, allow https://cdn.jsdelivr.net in script-src and https://api.agentronics.dev in connect-src, or the SDK can't load or report.

Lite path for WebMCP-only sites

If you only need WebMCP-native detection and the smallest possible footprint (≤ 8 KB brotli):

<script type="module">
  import { init, detectWebMcp } from 'https://cdn.jsdelivr.net/npm/@agentronics/sdk@0.7.0/dist/lite.js'
 
  const client = init({
    publishableKey: 'agtx_pk_live_…',
    siteId: 'shop-acme-com',
  })
 
  const agent = await detectWebMcp()
  if (agent) console.log('webmcp agent detected:', agent)
</script>

The lite entry intentionally omits the policy engine, DOM enforcer, site memory, and tracer. Use it when the only thing you need is "is a WebMCP agent on the page right now?".

Classic <script> (no module)

If your CMS or hosting environment can't serve modules:

<script src="https://cdn.jsdelivr.net/npm/@agentronics/sdk@0.7.0/dist/index.global.js"></script>
<script>
  const client = window.Agentronics.init({
    publishableKey: 'agtx_pk_live_…',
    siteId: 'shop-acme-com',
  })
  client.installDomEnforcer()
</script>

The classic bundle (index.global.js) sets window.Agentronics with the same API as the ESM build. This is what Agent Nic adds to your site.

Registering tools without a build

<script type="module">
  import { Agentronics } from 'https://cdn.jsdelivr.net/npm/@agentronics/sdk@0.7.0/dist/index.js'
 
  const client = Agentronics.init({
    publishableKey: 'agtx_pk_live_…',
    siteId: 'shop-acme-com',
  })
 
  client.registerTool({
    name: 'newsletter.subscribe',
    description: 'Subscribe an email address to the newsletter.',
    inputSchema: {
      type: 'object',
      properties: { email: { type: 'string', format: 'email' } },
      required: ['email'],
    },
    authz: { policy: 'newsletter.write' },
    async execute({ email }) {
      await fetch('/api/newsletter', {
        method: 'POST',
        headers: { 'content-type': 'application/json' },
        body: JSON.stringify({ email }),
      })
      return { content: [{ type: 'text', text: 'subscribed' }] }
    },
  })
 
  client.publishToWebMcp()
</script>

Subresource Integrity

For locked-down deployments, load the single-file bundle and pin its hash (the ESM build imports shared chunks, which an integrity attribute doesn't cover). jsDelivr lists it (base64 SHA-256) at https://data.jsdelivr.com/v1/package/npm/@agentronics/sdk@0.7.0/flat; use it as integrity="sha256-…":

<script
  src="https://cdn.jsdelivr.net/npm/@agentronics/sdk@0.7.0/dist/index.global.js"
  integrity="sha256-…"
  crossorigin="anonymous"
></script>

What you give up vs. the npm install

Featurenpm installCDN
Tree-shaking✅ — bundler drops unused exports⚠️ — full bundle ships
Source maps✅ — local files✅ — .map served alongside
Type checking✅ — .d.ts files❌ — runtime types only
Offline development✅❌

The runtime behavior is identical. If you start with the CDN and outgrow it, switching to npm install @agentronics/sdk is a one-line change.

On this page