@economicagents/indexer
v0.2.0
Published
Provider discovery index for AEP intent resolution - crawls ERC-8004, indexes capabilities and pricing
Maintainers
Readme
@economicagents/indexer
Provider discovery for AEP intent resolution: crawl ERC-8004 registries, index capabilities and pricing, optional SQLite FTS5 or PostgreSQL + pgvector hybrid search.
Install
pnpm add @economicagents/indexerThe aep-index CLI is available when installed globally or via pnpm exec.
From a local clone of economicagents/AEP: cd packages/indexer && pnpm run build.
Usage
# When package is on PATH
aep-index sync [--rpc <url>] [--probe-x402]
aep-index embed
aep-index migrate # when using PostgreSQL (see below)
# From packages/indexer after build
node dist/cli.js sync [--probe-x402]
node dist/cli.js embed
node dist/cli.js migrateDefault index path: ~/.aep/index/. Consumed by @economicagents/resolver, REST POST /resolve, MCP resolve_intent, and aep resolve.
PostgreSQL + pgvector (optional)
For hosted or high-scale search, run Postgres with the pgvector extension (see docker/docker-compose.yml).
- Set
AEP_INDEX_DATABASE_URL(orindexDatabaseUrlin~/.aep/config.json). - Run
aep-index migrateonce to apply SQL migrations frommigrations/. - Run
aep-index syncthenaep-index embed. - Set
OPENAI_API_KEYfor embeddings (embed) and for hybrid lexical + vector search at query time. Without the key, search uses lexical (tsvector) only.
Optional: AEP_EMBEDDING_MODEL (default text-embedding-3-small), AEP_INDEX_DATASET_ID (override dataset namespace).
Operations
- Embedding dimension:
migrations/002_provider_search.sqldefinesvector(1536)to matchtext-embedding-3-small(seeEMBEDDING_DIMENSIONSinsrc/embeddings.ts). Switching to a model with a different output width requires a new SQL migration (or schema change), not onlyAEP_EMBEDDING_MODEL. - Connection pool: The CLI exits after each command, so the
pgpool is released with the process. Long-lived services that import this package and setAEP_INDEX_DATABASE_URLshould callclosePgPool()when shutting down (e.g. graceful shutdown) to avoid holding connections open indefinitely. - Stale rows: Each
syncrebuildsprovider_searchfor the current provider set and deletes rows for that dataset whoseagent_idis no longer present, so removed agents do not linger in Postgres.
Configuration
- RPC:
--rpc <url>or config /AEP_RPC_URL - Chain:
AEP_CHAIN_ID(default: 84532 Base Sepolia) - Config:
~/.aep/config.json(indexPathoverrides default index directory) - DB:
AEP_INDEX_DATABASE_URLorindexDatabaseUrlin config
Dependencies
- PostgreSQL: runtime dependency
pgwhen using the DB URL (migrations ship in the published package undermigrations/). - SQLite path: optional
better-sqlite3(v12+),sqlite-vec. Without them when no DB URL is set, discovery falls back to legacy keyword search.
Build & test
pnpm run build
pnpm run testDocumentation
- Cookbook — Intent resolution setup
- Deployment — Index after deploy
