Build vs buy for agent infrastructure
Buy the model, buy the harness. Build the context and the guardrails. Most of what actually differentiates your setup, and most of the risk, lives in those last two.
Also available as a standalone Playbook →
The failure mode is easy to fall into.
It's also a pleasant one, which is most of the problem.
Building the loop yourself feels like real infrastructure work. The kind engineers are good at and enjoy.
Wiring an existing agent up to your own systems feels like configuration. Which is to say, it feels like nothing.
The instinct is backwards. Plumbing is a commodity now. The wiring is not.
Four layers, two different answers
The model itself: never build.
Training something competitive with what OpenAI, Anthropic or Google ship costs hundreds of millions, plus a research team most companies will never assemble.
Not a close call for anyone outside the handful actually in that business. It isn't getting closer, either.
The harness, meaning the loop that lets an agent plan, call tools, observe results and retry reliably, is usually buy as well.
This is the layer teams most often get wrong.
Getting tool-calling right under real failure conditions. Handling partial failures gracefully. Building a sandbox that's genuinely safe.
Multi-year problems, every one of them, and several vendors are already years deep.
Rebuild it internally and you're competing with that investment using a fraction of the engineers, for a capability that isn't your product.
Context and tools is where the calculus reverses. This one is build, because nobody else can do it.
A vendor ships you an excellent agent loop.
Only you know that your deploy needs a specific approval step, that your billing service has three legacy tables nobody trusts, or that "the new API" in your internal docs has meant two different APIs depending on which quarter somebody wrote the page.
That knowledge gets wired in by somebody who has it. There's increasingly a standard way to do the wiring, protocols that let an agent reach your internal systems directly, which lowers the cost without making it optional.
Evals and guardrails are build too, for the same reason.
What counts as a good result, and what counts as an unacceptable one, is a fact about your codebase, your risk tolerance and your customers.
Not something a vendor's defaults can capture.
A benchmark score from outside your repository tells you less about your risk than fifteen real tickets from your own backlog. Run through whatever you're evaluating. Checked against outcomes you actually care about.
The tell that you're on the wrong layer
Engineers debugging retry logic. Writing sandboxing code. Building a permissions model from scratch.
That's effort one layer too low, redoing work a vendor already funded at a scale you can't match.
Engineers debugging why the agent doesn't understand your deployment process, or why it keeps missing the one legacy quirk in billing. That's exactly where it should be. Nobody is going to sell you that understanding.
A useful gut check. Could a competitor buy the thing your team just built.
If yes, you probably should have bought it too, and spent the engineering time on the parts a competitor structurally can't replicate.
The one I built and would tell you to skip
Late 2024, on a plane, I built a CLI in Go. I don't write Go. It took one flight, about six hours.
What it did: read a codebase, work out the patterns and coding standards in it, take notes, then use those notes to write better instructions for coding agents.
Save tokens. Raise output quality.
It worked, and it was a genuinely great experience to build.
We used it for about a month. Then the models got smart enough not to need it.
So here's the refinement on "build the context layer," and it matters.
The context is yours and always will be.
Tooling to extract that context automatically is not. It sits close enough to the model's own capability that model progress simply eats it, and in my case the useful life of the thing turned out to be about four weeks.
Build the AGENTS.md. Don't build the thing that writes your AGENTS.md for you.
The correction isn't "trust vendors with everything."
Dependence on the loop and the model is a manageable, well-precedented risk, the same kind you already accept from your cloud provider or your CI system without thinking about it much.
The layer worth owning was never the plumbing. It's the part where the agent meets your business, and that's the one piece nobody can hand you finished.