As more of my day-to-day work goes through coding agents, I’ve noticed a pattern in where they do well and where they struggle. Inside a single service they’re now routinely good. An agent can pick up a ticket, read the service, write the change and the tests, open a pull request, and wait for CI like anyone else. I don’t think that’s controversial any more. Postman’s 2025 survey of just over 5,700 developers found that 89% use generative AI in their daily work, and the most common uses were improving code, finding mistakes in it, and writing API documentation.
The struggle starts when the change reaches into a service that someone else owns. My sense is that better models won’t make this go away, because what’s missing is information at the boundary between two teams, or at least information in a form an agent can use.
Let’s imagine a team working on an order page that now has to show refund status. Refunds belong to
another team’s returns service. The agent searches, finds returns-api.yaml in a repository it can
see, and writes a client against a field called refundState. It generates a mock from the same
file, the tests pass, and the pull request goes green. What it had no way of knowing is that the
returns team moved that field to refund.status last sprint. Staging answers with a 200 that
doesn’t contain the field, the client reads undefined, and every order shows its refund as
unknown. Nothing throws, so nobody gets paged, and someone notices a week later.
The agent didn’t do anything foolish here. It did what a capable engineer new to the codebase might well have done, only faster, and without the option of asking anyone.
Why one service works and two don’t
The usual explanation for this is context, and I think it’s only half right. A well-built agent doesn’t pour forty repositories into its context window. It searches, much as you or I would. The question is what it can and can’t find when it does.
The first difficulty is access. The other team’s code often isn’t in the agent’s checkout at all, and when it is, it’s a copy. If you clone forty repositories into the working set, you’ve given the agent a snapshot of forty teams that each deploy on their own schedule, so some of those copies are out of date before the agent reads them.
Even a fresh copy only shows what is checked in, and that’s not the same as what is deployed. The schema on the returns team’s main branch describes what they intend to ship. Production may still be on last month’s version, or may already have next week’s change running behind a flag. Reading another team’s source tells you what they plan to run, which can differ quite a bit from what is running now.
Then there’s size, and here the evidence is fairly clear. Chroma published a report on long-context behaviour in July 2025 that ran 18 models through 194,480 calls on deliberately trivial tasks, such as copying out a given text or finding one sentence within it. Performance fell as the input got longer, even though the task stayed just as easy. The clearest result came from LongMemEval, where the same 306 questions were asked against a full context of roughly 113,000 tokens and against a focused one of roughly 300. Every model did consistently better with the focused version. So an agent given the right slice of its dependencies does well, an agent given everything does worse, and in both cases it sounds equally confident.
A monorepo changes some of this, and I don’t want to wave it away. If every service lives in one tree, access largely takes care of itself. The agent can find the caller and the callee, read both, and follow a type from one to the other, and people who work this way rightly value how much easier it makes cross-service changes.
The other two difficulties remain, though. A large estate in one tree runs to millions of lines, so the agent is back to retrieval, with an index, a search step and a judgement about what to pull in. And the tree still only tells you what’s checked in. The caller you’ve just read may be running a version that shipped three weeks ago. A monorepo moves the boundary to a different place, but there’s still a boundary.
The boundary is the contract
Wherever the boundary sits, the useful question is what an agent can learn about the other side of it without reading the other side’s code.
Services talk to each other over APIs or over events, with REST, gRPC and GraphQL on one side and
queues and topics on the other. Each exposes its surface through some kind of contract, whether
that’s an OpenAPI document, a .proto file or a schema in a registry. Two further things matter
just as much as the contract, and in my experience they’re missing far more often. One is a record
of what changed and why. The other is a list of who depends on it.

Everything the agent can learn about the other service has to come through that middle box. If the contract is missing, stale or vague, the agent doesn’t stop and ask. It guesses, and the guess compiles.
I’ll concentrate on REST here, since that’s where most integration still happens. The same Postman survey has 93% of respondents using it, well ahead of anything else. I think the argument applies to gRPC and to events too, and most of the tooling carries across, but when I say contract I’m thinking of an OpenAPI document.
None of this is new, of course. Anyone who has maintained a library has at some point renamed a field nobody could possibly have been using, or tightened a response type, and then sat through the incident review that followed. Agents make it worse, mainly by removing the informal ways we used to work around it.
The most thorough answer we’ve had so far is consumer-driven contract testing, which Ian Robinson described almost twenty years ago. Most teams that try it use Pact. Consumers publish their expectations, producers verify against them, and someone keeps a broker running so the two sides can find each other. Where an organisation sustains that, it works very well. I’ve seen it work in a couple of teams and then become expensive to keep going, and as far as I could tell the reasons weren’t technical. Setting it up fell to whichever team was least able to say no, and keeping it running became everyone’s problem and so nobody’s priority.
What a human does at the boundary
Contract testing catches a break once it’s been made. There’s an earlier problem, though, which is finding out what the contract says in the first place.
Consider how an experienced engineer integrates with an unfamiliar internal API. They search the developer portal and find two specs, and they work out which one is current, usually from commit dates rather than anything the documents say. They skim for the operation they need and look for an example payload, and if there isn’t one, they look at an existing caller’s code instead. Then they find the owning team, ask in a channel, and wait. Eventually someone replies with the thing the spec doesn’t mention, perhaps that the endpoint is soft-deprecated, or that they really ought to use the other one.
What that engineer is collecting, I think, comes down to four answers. Where is the contract? Is it what’s running? What has changed recently, and why? Who else depends on it, and who should I tell if I need something changed? The spec usually answers the first of these, at least partly. The other three tend to live in people’s heads.
Once the engineer ships, most of what they learned leaves with the ticket, and the next engineer goes through the same loop. We tend to call this tribal knowledge and treat it as a feature of the culture. I’d rather treat it as a cost, and an unmeasured one. Most of the time between “I need this API” and “I can call it correctly” is spent waiting for someone who already knew the answer.
An agent can’t run that loop. It won’t pick up from a Slack thread that the spec dated March is the real one and the June one was an abandoned spike, and it won’t notice that the person who replied sounded unsure. What it will do is write a confident client against whatever it found. For a public illustration of how common this is, I looked at 957 public OpenAPI specs. 278 of them were no longer at the address they’d been published at, and 69% of the most recent changes said nothing a consumer could act on.
Broadly, an agent that needs another team’s API has three options. It can clone their repositories, it can ask them, or it can fetch the operation it needs from the contract.

I don’t think we’re close to agents running that whole loop unsupervised, and I’d treat claims to the contrary with some suspicion. What we can do is remove the parts of the loop that exist only because nobody wrote the information down in a form a machine could read.
Testing has the same problem
The other half of integration is showing that it works. For most teams I talk to, that still means curl, Postman or Insomnia pointed at a sandbox or a staging environment, by hand.
For an agent to do this on your behalf, the contract and the deployed service need to agree. If they don’t, the agent tests against a document describing a system nobody is running, the tests pass, and the change ships, which is what happened to our refund field. The cheapest way to test a client properly is to point it at a mock generated from the contract. That checks that the shapes line up, and it lets you exercise the error responses as well as the successful one.
Mocks have their own way of going stale. Someone builds one by hand with a sensible set of responses, it becomes useful, and then the API moves and the mock doesn’t. A few weeks later the integration tests are passing against responses the real service no longer sends. A mock generated from the current contract, and regenerated whenever the contract changes, holds up much better. I’ve written about this at more length in A hand-built mock is a second API you have to keep in sync.
Put the finding and the testing together and you get a loop an agent can run on its own, as long as the contract is current.

What I’d want in place
Putting the finding and the testing together, I’d want an organisation to have roughly the
following. None of it requires exotic tooling. Most of it can be assembled from open-source pieces
many teams already run, such as Backstage for a catalog, Spectral and oasdiff in CI, and Prism or
Microcks for mocks. The hard part is usually deciding to do it and giving someone the time.
A catalog shaped like the organisation. There should be one place where every contract lives, arranged the way the teams are actually arranged. The value of having a single place is that a human has somewhere to look, and so does an agent. The Postman survey found that more than half of respondents saw inconsistent documentation as a barrier to collaboration, along with duplicated effort and difficulty finding APIs that already existed. If engineers can’t find an API, I wouldn’t expect an agent to do any better.
Specs written for a stranger. By this I mean a spec that someone outside the team could use
without asking anything. Every operation should have example payloads and a sentence saying what
it’s for, such as “settle an authorised payment”, rather than just repeating PATCH /payments/{id}.
Error responses should be listed along with the conditions that cause them. Internals should stay
out. An agent that learns your table names has learned something it will eventually act on. If the
spec is good enough, the consuming agent never needs to read your codebase, which leaves its context
free for its own work.
Governance at the source. The quality of an agent’s client depends heavily on how well the
contract is documented and how reliably it’s kept current, so I’d put a lot of weight here. The
arrangement I’ve found most workable is a set of organisation-level policies that teams inherit and
extend, covering documentation, naming, versioning and deprecation. A linter in CI enforces them,
and a contract change is treated like any other code change, with a pull request and a review. A
tool such as oasdiff can then catch compatibility breaks before merge instead of after deployment.
I’d also record which version each environment is running, since without that every answer the
catalog gives is really about the main branch.
A consumer registry. This is the piece I see missing most often. Knowing that a change is breaking is useful, but you can only act on it if you know whom it breaks. Most catalogs describe producers well and consumers poorly, and those that do track consumers usually infer them from runtime traffic. Traffic can tell you that some service called you last Tuesday. It can’t tell you which team owns that service, who to write to, what they use the endpoint for, or how they’d like to hear about changes.
Go back to the refund change from the start of this article and look at it from the returns team’s side. The order page was only one of the services reading that field.

With that information to hand, a deprecation can begin as a conversation months ahead rather than as an outage on someone else’s side. I find it helpful to think of consumers as subscribers to an API’s changelog. They get the release notes, and they get a chance to object to a deprecation while objecting is still cheap.
Mocks that follow the contract, hosted somewhere the whole team can use rather than on one person’s laptop, and regenerated as the spec changes.
Agent access to all of it. An agent needs to be able to query this directly, without a person in between, typically through an MCP server. It should be able to ask for a single operation, get the current version of it, and find out who owns it.
An agent skill on top. Once those pieces exist, it’s worth writing an organisation-level skill that tells agents how to use them together: find the contract, read the examples, generate the client, start a mock, and check the consumer list before changing anything. It can be shipped through the platform repositories like any other internal tooling and refined as people use it.
Why API-first finally pays
One effect of all this interests me more than any of the tooling. Once the contract is linted, reviewed and diffed in CI, teams start writing it before the implementation, simply because that’s where the pipeline begins. Contract-first stops being something only disciplined teams manage and becomes the easiest way to work.
API-first has been recommended for at least a decade, and I think its patchy adoption had an understandable cause. The cost came on day one and the benefit came much later. Designing the contract first slowed the start of a project, and what you got back was better documentation and fewer design arguments down the line. Those are real benefits, but they’re hard to point to in a planning meeting, so the practice mostly survived where a senior engineer kept insisting on it.
Agents shift that balance, and quickly enough to notice within a sprint or two. The contract is the only view a consuming agent has of your service. A contract written after the code describes whatever happened to get built, accidents included. A contract written first describes what you meant, and the code gets checked against it. A document that used to be a deliverable nobody read now determines whether another team’s agent can integrate with you at all.
Agents also take care of much of the tedious work. Give one a reviewed contract and it will scaffold the handlers, the types, the client and a first pass at the tests. The old objection to contract-first was that you wrote the boring parts twice. Now you write the contract once and generate most of the rest, so the careful approach is also the quick one.
The Postman survey suggests most teams haven’t caught up with this yet. While 89% of developers use these tools every day, only 24% say they design their APIs with agents in mind.
Who has to own it
I see this as platform work. It needs a team that owns it and a budget, and I don’t think it happens as a side project fitted in between feature work. Someone has to make the case to whoever controls the budget, and in my experience that case lands better when it’s framed in terms of change failure rate and integration lead time than as a preference for particular tools.
Most organisations will end up with only part of this, and part of it still helps. A catalog with good examples and no consumer registry is a good deal better than no catalog.
How you would know it is working
Usage is the obvious thing to measure, but on its own it doesn’t tell you much. These are the measures I’d look at.
- Agent lookups answered by the catalog. The hits show up in the catalog’s own logs. Misses are harder to see, so the trend is more telling than the exact ratio. Each hit is a question that didn’t turn into a Slack thread.
- Time from “I need this API” to a correct first call for a new consumer. If I could track only one number, it would be this one.
- Contract coverage, the share of deployed services with a current, machine-readable contract in the catalog. This is a good place to start, and the number is usually lower than people expect.
- Changelog quality, the share of contract changes that come with a note a consumer could act on. Across 957 public specs it was 31%, and an internal number can be measured the same way.
- Breaking changes caught before merge compared with those found in production. The ratio matters more than either count.
- Deprecations with lead time, announced to named consumers before removal, compared with those that somebody’s pager found first.
- Consumer coverage, the share of APIs where the teams on the other side can be named and reached.
The part I’m least sure about
I’ve put a lot of weight on writing things down for machines, and there’s a fair objection to that. Any system that depends on people maintaining metadata tends to decay, and I’ve described one that depends on people maintaining quite a lot of it. The governance pipeline helps, because it makes the metadata a build artefact rather than a chore, but it only covers what a linter can check. No linter will tell you that an endpoint is now used for something its description never mentions.
The consumer registry is the most exposed to this. It could easily go the way of most CMDBs, correct when it’s first filled in, wrong a quarter later, and still trusted a year after that.
My current guess is that a registry stays accurate only when being in it gets the consumer something they want. If an entry is how you get access to an API, or how your name ends up on a producer’s pull request before a breaking change merges, then a stale entry costs its owner something they’ll notice, and they’ll fix it. I’m sceptical that people keep metadata current simply because they’ve been asked to.
I don’t have enough examples yet to know whether that holds up at scale, and I’d treat my own view here as tentative. If you’ve run a consumer registry that stayed accurate over time, I’d very much like to hear what kept it that way.
Further reading
Ian Robinson’s Consumer-Driven Contracts: A Service Evolution Pattern is still the best description I know of the producer–consumer relationship this article keeps coming back to. Martin Fowler’s short entries on ContractTest and TolerantReader cover two of the techniques that make that relationship survivable.
The figures here come from Postman’s State of the API 2025 (with a useful summary in Nordic APIs’ deep dive), Chroma’s Context Rot report from 14 July 2025, and my own survey of 957 public OpenAPI specs.
Keep reading
- ArchitectureWhat goes wrong once you pass a handful of services
- Stale contractI fetched 957 public OpenAPI specs. Most can't tell you what changed.
