AI NewsDev toolsAnnouncement

Microsoft tests 6 coding agents on REST and non-REST APIs, 1,356 runs

Microsoft ran six AI coding agents against the same inventory API in three shapes. With docs, REST, POST-only and RPC tied. Without docs, RPC scored zero.

AI News

Editorial3 min read

LinkedInX

Why it mattersAn API maintainer picking between REST and RPC can stop worrying about which agents prefer. The real cost is agents that reach the API without the docs.

An API maintainer picking between REST and RPC has had one worry about AI coding agents. REST wins, the thinking goes: a model can guess the URL and pick the verb. Waldek Mastykarz, a Principal Developer Advocate at Microsoft, ran the test. His team ran six models across 1,356 runs on one API in three shapes.

The team built a fictional inventory API called Binstock, served in three styles with the same data. REST used PATCH, PUT and DELETE on resource paths like /bins/B-103. POST-only kept those paths but routed every write through POST. RPC named each endpoint after an action, like /updateBin. The middle style isolates one change at a time. They mocked each with Dev Proxy and its CrudApiPlugin. Any wrong method or path returned a 404.

With docs, every style tied

The main run gave each agent the base URL and an OpenAPI description. Four models ran it: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.1 Sol and GPT-6.1 Terra. Each ran 15 tasks five times in every style, for 900 runs. REST and POST-only both scored 100 per cent success. RPC scored 99.7 per cent, with one failure from a 10-minute timeout. Runs without a failed call sat at 82 per cent for REST and POST-only, and 77 per cent for RPC. Tokens per run came in near 70,000 for every style, within one per cent. Each model tested equivalent in every pairwise comparison.

Microsoft repeated the run on Claude Haiku 5.5 and MAI Code 2 Flash. Both completed every task in every style, with token use within three per cent.

Without docs, RPC collapsed

The team then gave Claude Sonnet 5.5 and GPT-6.1 Terra only the base URL. Claude Sonnet 5.5 finished 93 per cent of REST tasks. It finished 40 per cent on POST-only and 0 per cent on RPC. GPT-6.1 Terra finished 97 per cent of REST, 60 per cent on POST-only, and 0 per cent on RPC. On RPC, agents averaged about 28 failed calls per task before giving up. No model ever guessed an endpoint name like /updateBin. REST runs still took about 10 failed calls per task. Convention got the agent close, and 404s steered it to the right URL.

The token bill is per correct result

Raw tokens per run looked kind to POST-only and RPC without docs, because failed runs stopped early. Per correct result, REST cost about 80,000 tokens, POST-only about 230,000, and RPC never got there. Each POST-only failed run burned 160,000 to 170,000 tokens while the agent probed.

A follow-up test ran a larger task: a shift handover that fixed a failing unit test, applied events against Binstock, and wrote a daily report. The README linked to an HTML reference page served by the mock. Claude Sonnet 5.5 and GPT-6.1 Terra ran 8 handovers twice in each style, 96 runs. Every run succeeded, with token use within three per cent.

Mastykarz's conclusion: with docs in reach, agents used POST-only and RPC as reliably and cheaply as REST. Without docs, REST is easier to guess. Keep your non-REST API as it stands. Link your OpenAPI description from your README. Consider listing the operations at the root URL, or in the body of a 404. An agent that lands without docs then has a way to find the right endpoint.

What a maintainer does with this depends on how agents reach the API. If your docs page shows up in agent trajectories, your style is fine. If agents keep hitting your API cold, RPC costs 28 failed calls per task. REST costs 10.

Source

Do AI coding agents struggle with non-REST APIs?, by Waldek Mastykarz on the Microsoft for Developers blog.

This item was written by an AI system from the linked source. Reveneau is responsible for what it publishes.

Share
LinkedInX
Start a project