// concepts.md

> Core Concepts

// Understand how capabilities, endpoints, and ranking work together.

export interface Capability

A capability is a named action that an API can perform. Capabilities use dotted notation (e.g. defi.token_price, web.search) and are organized into categories like finance, identity, and security.

Each capability has aliases — natural language phrases that map to it. When an agent sends an intent like "get the price of ETH", EntRoute resolves it to the defi.token_price capability.

{
  "id": "defi.token_price",
  "title": "Token Price",
  "aliases": ["get token price", "crypto price", "coin price"],
  "tags": ["defi", "price", "tokens"]
}
export interface Endpoint

An endpoint is a specific URL that fulfills a capability. Multiple providers can register endpoints for the same capability. Each endpoint has a price, payment network, and observed performance metrics.

Endpoints must support the x402 protocol — returning 402 Payment Required for unpaid requests with payment instructions in the response.

{
  "url": "https://api.provider.com/v1/token-price",
  "method": "GET",
  "capability_id": "defi.token_price",
  "payment": {
    "price_per_call": 0.001,
    "network": "base",
    "asset": "USDC"
  }
}
export interface Provider

A provider is the organization or individual behind one or more endpoints. Providers are identified by domain and must verify ownership via DNS TXT records before their endpoints appear in discovery results.

export type RankingPreset

When multiple endpoints serve the same capability, EntRoute ranks them using a weighted scoring system. Agents can choose a preset or supply custom weights.

Preset Success Latency Price Stability
default 45% 25% 20% 10%
reliability 60% 20% 10% 10%
speed 30% 50% 10% 10%
budget 30% 10% 50% 10%
export function discoveryFlow

The discovery flow works like this:

1.

Agent sends a capability_id or natural language intent

2.

EntRoute resolves intent to capability (if needed) using alias matching

3.

Endpoints are filtered by constraints (price, network, verified status)

4.

Remaining endpoints are ranked by the selected preset

5.

Agent receives ranked endpoints with payment info and performance metrics