Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.prudra.dev/llms.txt

Use this file to discover all available pages before exploring further.

Pricing signals

The route registry gives AI agents structured pricing signals before they make requests. Agents can use these signals to budget, prioritise, and select payment protocols.

What pricing signals are available

The registry provides per-route:
SignalDescription
priceExact cost per call in decimal USDC
tokenToken used for payment (USDC, USDC.e)
chainChain the payment settles on
protocolsWhich protocols the route accepts (x402, mpp)

Agent budgeting pattern

async function planApiUsage(budget: number) {
  const routes = await fetchRegistry('org_clx1abc123');

  // How many calls can we make per route within budget?
  const plan = routes.map(route => ({
    route:       route.route,
    price:       parseFloat(route.price),
    maxCalls:    Math.floor(budget / parseFloat(route.price)),
    description: route.description,
  }));

  // Sort by value (description length as proxy for output richness)
  return plan.sort((a, b) => a.price - b.price);
}

Protocol selection strategy

Agents with both x402 and MPP wallets can select the cheapest or fastest protocol:
function selectProtocol(
  route: { protocols: string[]; chain: string },
  agentCapabilities: { hasX402: boolean; hasMPP: boolean }
) {
  if (route.protocols.includes('x402') && agentCapabilities.hasX402) {
    return 'x402';  // prefer x402 — faster settlement on Base
  }
  if (route.protocols.includes('mpp') && agentCapabilities.hasMPP) {
    return 'mpp';   // fall back to MPP on Tempo
  }
  throw new Error(`No supported protocol for route ${route}`);
}

Cost estimation before a run

Before executing a multi-step workflow, an agent can estimate total cost:
async function estimateWorkflowCost(steps: Array<{ route: string; calls: number }>) {
  const registry = await fetchRegistry('org_clx1abc123');
  const byRoute = Object.fromEntries(registry.map(r => [r.route, r]));

  let totalCost = 0;
  for (const step of steps) {
    const route = byRoute[step.route];
    if (!route) throw new Error(`Route ${step.route} not in registry`);
    totalCost += parseFloat(route.price) * step.calls;
  }

  return {
    totalCost,
    currency: 'USDC',
    steps: steps.map(s => ({
      ...s,
      pricePerCall: parseFloat(byRoute[s.route].price),
      totalForStep: parseFloat(byRoute[s.route].price) * s.calls,
    })),
  };
}