PLATFORM · 01 /
SYSTEM · ACTIVE
Budget-bounded
capability spending
Enforce hard spend policies across HTTP 402 providers. Compare live quotes in parallel and authorize atomic micro-settlements.
COMPATIBLE WITH HTTP 402 PROVIDERS & AGENT RUNTIMES
01 // CORE SYSTEM ARCHITECTURE
Deterministic capability routing primitives
Autonomous agents need to purchase external compute, web searches, and indexing without exposing infinite credit lines or hardcoded secrets.
PRIMITIVE 01 PARALLEL
HTTP 402 Probing
Queries registered capability endpoints simultaneously for live 402 payment requirements, verifying fees before dispatching funds.
PRIMITIVE 02 POLICY
Deterministic Spend Caps
Enforces an explicit maxSpendUsdc policy per execution. Providers quoting above the limit are rejected.
PRIMITIVE 03 LOCAL
In-Process & Idempotent
Runs directly in your application. Uses an optional executionId for safe deterministic retries.
02 // QUICKSTART | example.ts
import { EcoRouter } from "ecorouter";
// 1. Initialize router with smart account and candidate providers
const router = new EcoRouter({
account: process.env.STELLAR_ACCOUNT,
sessionSecret: process.env.SESSION_SECRET,
providers: [
{ id: "tavily", capability: "web-search", endpoint: "https://api.tavily.com/x402", qualityScore: 0.95 },
{ id: "brave", capability: "web-search", endpoint: "https://api.brave.com/x402", qualityScore: 0.90 }
]
});
// 2. Execute capability under hard spending bounds
const result = await router.execute({
capability: "web-search",
input: { query: "latest autonomous agent runtime specifications" },
policy: { maxSpendUsdc: "0.01", minimumQuality: 0.85 }
});
console.log(result.providerId, result.spentUsdc, result.data);
03 // INTERACTIVE CAPABILITY TESTBENCH
Simulate capability execution
Test how EcoRouter challenges endpoints, enforces maxSpendUsdc caps, and selects providers deterministically.
04 // FREQUENTLY ASKED QUESTIONS
FAQ
What is EcoRouter? +
An open-source TypeScript SDK for autonomous agents to discover, evaluate, and settle HTTP 402 capability fees in-process.
How does provider selection work? +
When execute() is invoked, EcoRouter queries registered providers in parallel, filters out quotes exceeding your maxSpendUsdc policy, and routes to the lowest-cost endpoint.
Is there a centralized proxy or server? +
No. The SDK runs completely in your application process. Your keys, policies, and queries are strictly local.
How does it protect against runaway loops? +
Every execution requires an explicit spending policy. If quoted fees exceed your limit, EcoRouter rejects the call before initiating any payment.