Turn any OpenAPI spec into safe AI agent tools in an afternoon
Every operation becomes a tool with a risk level. Destructive endpoints arrive enabled but gated — not hidden.
Most APIs already describe themselves. Somewhere in the repository, or at /openapi.json on the API's own host, there is a document listing every path, every method and every argument. It was written for client generators and documentation sites. It turns out to be exactly what an agent needs as well.
What you give it
An OpenAPI connection asks for three things:
- the document URL — JSON or YAML, OpenAPI 3.x (Swagger 2.0 is not supported)
- the base URL of the API itself
- credentials, if it needs them: an API key in a header or query parameter, a bearer token, basic auth, or OAuth2 client credentials
You can also set static headers sent on every request, such as an API version or a tenant id. Credentials are encrypted at rest and attached to requests by the platform. They never appear in a prompt and are never shown to the model.
What comes out
One tool per operation. The tool's key comes from the operation's operationId, its description from the specification, and its argument schema from the parameters and request body the specification declares. An argument the model proposes is checked against the real contract before any request is made.
Operation types set a risk floor
Each operation also gets an operation type, and the type sets a risk floor. Take a small billing API as an example:
| Operation | Tool | Type | By default |
|---|---|---|---|
GET /orders |
list_orders |
read | runs |
GET /orders/{id} |
get_order |
read | runs |
POST /refunds |
create_refund |
write | runs for someone with execute permission |
PATCH /orders/{id} |
update_order |
write | runs for someone with execute permission |
DELETE /customers/{id} |
delete_customer |
delete | stops for approval |
Reading a POST by its path
A POST is read by its path as well as its method. /customers is a create, /customers/search is a read, and /reports/export is an export — which sits at high risk, because bulk extraction of customer data is a data-protection event even though nothing changes. Calling a search a create would force needless approvals.
Enabled but gated, not hidden
delete_customer arrives switched on, with approval required. That is deliberate. Leave destructive endpoints out and the agent cannot do its job, so people work around it by doing the deletion by hand, with no record. Leave them ungated and you are trusting the model. Gating is the middle that holds.
The floor only moves one way. You can raise a tool's risk or add an approval requirement on the tools page. You cannot lower a delete below critical, and a per-agent setting can add an approval but never remove one the registry requires. When the call does pause, the approval covers that call with those arguments, once — see one approval, one call.
The parts that keep it safe
A few decisions are worth knowing about:
- Header parameters are never exposed as tool arguments. A model that can set arbitrary headers on an authenticated request is a model that can move a credential somewhere it should not go.
- Remote
$refs are refused. Following one would mean fetching a URL of the document's choosing during parsing. - Every request is SSRF-guarded. Private addresses, loopback and cloud metadata endpoints are refused on save, on every request, and again on every redirect hop.
- Broken operations are skipped and reported, not fatal. One malformed path does not cost you the other two hundred, and the connection page says which tools you are missing and why.
If there is no document
Look first — many services publish one without advertising it. If there genuinely is none, write a small specification covering only the operations an agent should use. A deliberately narrow document beats importing four hundred operations and disabling most of them. The OpenAPI integration page has the details.
The specification was always the contract. Now it is the contract an agent is held to.
0 comments
Sign in to join the discussion.