Policy-driven AI model routing with verifiable provenance across 0G, Hedera, and The Graph.
AgentRouter is a reusable decision and provenance layer for autonomous AI agents. Instead of hardcoding one model provider, an agent can discover available routes, compare exact cost, latency, capabilities, privacy, and budget constraints, then deterministically select the best eligible option. It executes inference through 0G Compute and produces a canonical receipt explaining what was considered, why alternatives were excluded, and which route was selected. Non-secret evidence can be stored on 0G Storage, while receipt hashes are anchored and independently verified on 0G Chain. The project also supports HBAR settlement and Mirror Node verification through Hedera, giving agents an auditable way to decide, spend, execute, and prove what happened.
AgentRouter is built as a reusable TypeScript toolkit with a Next.js and React demonstration application. Zod defines the versioned contracts for model catalogs, normalized quotes, routing policies, execution evidence, payment challenges, and canonical receipts. A deterministic router filters candidates by capability, privacy, currency, quote expiry, and integer-denominated budgets, then ranks eligible routes by price, latency, and stable identifiers. 0G is the core infrastructure: 0G Compute executes model requests, 0G Storage holds non-secret content-addressed evidence, and a Solidity contract on 0G Chain anchors receipt hashes so another agent can verify them independently. Hedera adds HBAR payment settlement, HashScan evidence, HCS audit anchors, and Mirror Node verification with replay protection. Supabase/Postgres provides durable workflow state and atomic budget reservations. The Graph adapter normalizes indexed provider records into the same contract as local fixtures, allowing discovery sources to change without changing the routing engine. The deliberately “hacky” part is the strict separation of truth: slow indexing never triggers a second payment, The Graph is used for discovery and monitoring rather than settlement verification, and every externally retried operation uses stable idempotency keys. The entire project is validated with TypeScript checks, ESLint, Vitest, production builds, Subgraph builds, and client-bundle secret scanning.

