@nicolasakf/agentize
v0.2.0
Published
First-party semantic search and discovery for websites
Maintainers
Readme
Agentize
Make your website legible to AI agents.
Agentize builds a semantic index of the content you choose and serves it from your own domain under /agents/*. An agent asks a question in natural language and receives your Markdown, with canonical URLs attached, instead of crawling and parsing your HTML.
Install this package in the website owner's repository, declare the content sources, and serve an authoritative agent interface from the owner's domain. Protocol 0.2 supports public websites and shared-access intranets.
curl https://example.com/agents/search \
-H 'content-type: application/json' \
-d '{"query":"Can employees use a company identity provider?","limit":5}'The response names each matching resource, its canonical URL, type, and last update, along with the passages that matched. A follow-up request to GET /agents/resources/:id returns the full page as normalized Markdown.
Agentize is not a web crawler. It does not accept arbitrary website URLs, and it does not send your content or an agent's queries to a hosted AI provider. Embeddings are computed locally at build time.
Quick start
Requires Node.js 22 or newer.
npm install @nicolasakf/agentize
npx agentize initDeclare your content sources in the generated agentize.config.ts:
import { defineConfig, markdown } from "@nicolasakf/agentize";
export default defineConfig({
site: {
name: "Example",
origin: "https://example.com",
description: "Example's authoritative agent interface",
},
sources: [
markdown({ root: "content", include: ["**/*.{md,mdx}"] }),
],
});Then validate, build, and serve the index:
npx agentize check
npx agentize build
npx agentize servecurl http://127.0.0.1:4242/agentsEndpoints
GET /agentsdiscovers the site and its agent endpoints.GET /agents/indexlists semantic collections and paginated standalone resources.POST /agents/searchperforms semantic-first retrieval, with optional filters on type, collection, tag, and language.GET /agents/resources/:idreturns JSON, or Markdown withAccept: text/markdown.
Commands
agentize initcreates configuration and framework integration files.agentize buildproduces an atomic.agentize/output/bundle.agentize devwatches source files, rebuilds incrementally, and serves on port 4242.agentize serveserves a previously generated bundle.agentize checkvalidates resources, privacy exclusions, relationships, and Next.js route coverage.
Next.js
agentize init creates an App Router catch-all route under app/agents/[[...path]]/route.ts. Wrap your Next config with withAgentize from @nicolasakf/agentize/next, and run agentize build before next build.
Protected intranets
Set access: { mode: "protected" } for one shared employee corpus. Protect every /agents/* request with the host's middleware by passing authorizeRequest to createAgentizeRouteHandlers, or run a sidecar behind an authenticated reverse proxy with agentize serve --trust-upstream-protection.
Protected bundles refuse to start without one of those safeguards. Every admitted caller can search and retrieve every indexed resource, so exclude documents with narrower permissions. Protected Markdown and static HTML sources may set includeNoindex: true when their pages use noindex only to block public search engines.
Documentation
Configuration reference, database-backed resources, the v0.2 protocol specification, and deployment notes: github.com/nicolasakf/agentize
Licensed under the MIT License.
