Discover the APIs an agent will call before you build
The agent stalls on the internal service nobody documented. Search the public registry for known providers, then build the other rows from your own call logs.
Key takeaways
- -Shadow hosts show up in gateway logs and HTTP clients, not in swy search, which only queries the remote registry.
- -swy discover only searches bundles you've already downloaded. An empty search result on an internal host is correct, not broken.
- -Keep one row per operation with a named owner. A base URL with no owner isn't a scope, it's a stall waiting to happen.
- -An undocumented write is a reason to delay the release, not a reason to let the model try the path and see what happens.
The agent project has a kickoff date and a model picked out. In week three, someone asks which service actually returns the order status the bot is supposed to quote. The architecture diagram shows a box labeled Orders, with no owner, no OpenAPI file, and a base URL that only resolves on one VPN. The public registry search comes back empty under that name, and the project stalls right there, not on the prompt.
This post is how you find that surface before you write a line of the agent: what a registry search can actually see, and what only your own logs can.
Start from calls you already make
An agent can only call an API you can name, and naming starts with evidence, not a whiteboard. Pull a week of outbound calls from the gateway, the service mesh, or the HTTP client logs in whatever repo does this job today. Group them by host and path. You want the same list a person would have to click through to answer the question the agent is about to answer.
Three places usually hold the truth once the wiki has gone stale:
- The gateway or mesh access log, grouped by host
fetch,axios, orHttpClientusages in the repo that already owns the workflow- The on-call channel, where someone has already pasted the curl command that still works
If a host shows up in the log and in nobody’s catalog, that’s your shadow API. Write down the host, the method, and whoever last changed the client. That row is the real scope. No model is going to discover it by guessing a URL. And anything that returns customer fields still has to clear the checklist before company data before you enable it.
What a registry search returns
swy search looks at the remote registry. swy discover searches integrations you’ve already downloaded. Neither one crawls your VPC, so if the order service is an internal app with no public bundle, the search will come back empty. That’s a correct result, not a broken command.
swy search <name>
swy discover "<description>"
swy get <name from swy search>
swy list methodsUse the exact name search prints back. swy get downloads the bundle and doesn’t enable any tools on its own. swy list methods shows you what’s local now. swy add is a later decision, made only once you know the call is actually in scope. The integrations CLI docs cover search, get, and bootstrap in more detail. Don’t treat a download as permission to run every method sitting in the bundle.
When search comes back empty, you’re looking at either an internal service that needs documenting or a provider the registry simply doesn’t carry. Business and Enterprise plans can bring their own provider, but that’s a build with an owner and a schema, not a flag you flip on a Friday afternoon. Free and Pro stay with what the registry already has. Say that out loud in the kickoff, so the date doesn’t assume a bundle that was never there.
Write the inventory before anyone opens an editor
A useful inventory stays short: one row per operation the agent might actually need, not one row per vendor.
| Host or provider | Operation | Read or write | In the registry | Owner |
|---|---|---|---|---|
| orders.internal | GET status by id | Read | No | Commerce |
| github.com | Read one issue | Read | Check with swy search | Source control |
The registry column is a fact you just checked, not a hope. The owner column is an actual person. A row with no owner doesn’t go into the agent, full stop, because you’re not going to get a policy reviewed for a service nobody will admit to running.
API governance tools are where this list should eventually land, once it’s real. A gateway catalog last edited two years ago isn’t going to mention the shadow host you just found. Update it from the log, or just keep the table in the repo next to tooling.json so the agent’s scope and the gateway catalog can be compared in one pull request.
Cut the list to what the first release answers
Discovery always finds more operations than the first release should enable. Keep only what’s required to answer the question you actually sold, and park the rest as “known, not in v1.” An undocumented write is a reason to delay, never a reason to let the model try the path and see what happens.
If the status call depends on a shadow host, name it and find an owner first. Then either wrap it as your own provider, or change the product so the agent doesn’t need it at all. No amount of prompt work removes the underlying dependency.
Run swy search for every public provider on the list, and build the internal rows from logs before you schedule anything. An empty search on an internal host just means the scope is still open, not that the project can skip it.
Related reading
- API compliance for agent integrations. What to attach once a row finally has an owner.
- Policy as code for agent calls. Where an operation goes once you’ve decided it’s in v1.
- Human approval for a tool call. What a write on that list needs before it can wait on a person.
- Log every API call an agent makes. How you confirm the agent actually stayed on the rows you allowed.
FAQ
Will swy search find an internal service that has no public docs?
No. swy search queries the remote registry, and swy discover only sees bundles you’ve already downloaded. An internal host shows up in your logs, never in that search.
What should I do when the registry has the provider but not the one path I need?
Copy the method list from swy list methods and mark the path missing rather than inventing an ID. If that path is required, treat it like a missing provider: scope a bring-your-own provider on Business or Enterprise, or cut it from v1 entirely.
Is a gateway catalog enough as the inventory?
Only if someone has actually kept it updated from traffic. Compare it against a week of access logs. Any host that’s in the log but absent from the catalog is exactly the kind that stalls the agent later.
Can I point the agent at the base URL from the log and skip the inventory?
You can, and the first person to review it will stop the launch cold. A base URL with no owner, no method list, and no read-or-write label isn’t a scope. It’s the same stall you already had, just moved into production.
Use Swytchcode so this doesn't happen to you
Use Swytchcode so you can list exactly which methods are available and allowed before you write a line of agent code, instead of discovering the shadow API in week three.
Swytchcode is an execution kernel that sits between your AI agents and the APIs they call. It resolves the right method, injects auth, checks policy, retries safely with idempotency, and logs every call locally.
Start with the MCP quickstart, or browse the docs for the full reference. Free is 100 live commands a month forever; see pricing for Pro and Business.
More content
How to Stop an AI Agent From Booking the Same Meeting Twice
A scheduling agent that checks availability and then books the slot has a gap between those two steps — and a retry can fall straight into it. Here's how Swytchcode closes that gap.
How to Stop an AI Agent From Creating Duplicate Records
A retried "create" call doesn't update an existing contact, ticket, or row — it makes a second one. Here's why that happens across CRMs, databases, and ticketing tools, and how Swytchcode prevents it.
How to Stop an AI Agent From Sending the Same Email Twice
Most email APIs have no idempotency key to catch a repeat send, which makes a duplicate email a harder problem than a duplicate charge. Here's how Swytchcode handles the gap.
