Guide

Can an AI agent choose which API to call?

Yes. How to let your agent pick a provider for each job at runtime instead of hardcoding one, and how to keep that choice honest.

Yes. An agent can choose its API at runtime if it has two things: a list of the tools that can do the job, and a fair way to rank them. Hardcoding one provider is simpler, but it locks in that provider's accuracy, price and outages.

What a good choice needs

Hardcoded or chosen at runtime

Hardcoded provider compared with choosing at runtime
Hardcoded providerChosen at runtime
Switching providerA code change and a deployFollows the ranking
When the provider failsYour agent fails or retriesIt can try the next-ranked tool
AccuracyWhatever that provider givesThe best score for the job and region

How to do it with Arettic

1. Ask for the job

curl
curl https://api.arettic.com/v1/recommend \
  -H "Authorization: Bearer sk_test_…" \
  -H "Content-Type: application/json" \
  -d '{ "task": "find the email and job title of the CTO at acme.com" }'

The answer lists the tools ranked by score, then price, each with its price per passing result and the check it must pass.

2. Run the top tool

curl
curl https://api.arettic.com/v1/execute \
  -H "Authorization: Bearer sk_test_…" \
  -H "Content-Type: application/json" \
  -d '{
    "tool_id": "hunter-verify-email",
    "input": { "email": "[email protected]" },
    "fallback": true,
    "max_price": 50
  }'

With fallback: true, if an item fails, the next-ranked tool runs once within your max_price. Only the tool that passes is charged.

Keep the ranking honest

A ranking only helps if nobody can buy their way up. On Arettic, paying never changes a score, rank or routing decision, and the score formula is public on How scores work. More on provider discovery.

Questions

Is choosing at runtime slower?

It adds one call. recommend is free, and your agent can reuse its answer for the same job and region.

Can I force a provider?

Yes. Send any purchasable tool_id to execute. On Pro and up, owners can pin a tool so it's tried first.

Updated 2026-10-23 · This page as Markdown · JSON

Give your agent every tool on one key.

Get your free API key