How to Build for AI Agents A developer building crmkit, an experimental CRM designed for AI agents, argues that APIs should be optimized for agents rather than humans. The developer recommends returning text instead of JSON by default, making output grepable with one record per line, using short prefixed identifiers, and surfacing context to reduce round trips. These principles were learned while building crmkit, a headless CRM where the agent is the only user. Traditionally APIs were designed for a browser or a client library. Something on the other end was going to parse the response and turn it into a screen or an object. However, the thing calling your API now is a model in a loop, with a token budget and a terminal, and it does not render your JSON anymore. Instead, it reads it. I have argued before that you should build for who is not human https://chatbotkit.com/reflections/build-for-who-is-not-human . That was the why. This is the how, and it lands almost entirely on your API, because the API is the only surface an agent ever touches. Most of what follows I learned the slow way, building crmkit https://github.com/crmkit/crmkit , a deliberately experimental CRM designed for agents to drive. It is headless, there is no UI at all, and the agent is the only user it has. That turns out to be a good teacher, because there is nowhere to hide a bad decision behind a screen. We run it internally on a few projects. It is not perfect, but I think it is pointing the right way. Start with the format. Text is the default interface. Not JSON. JSON is a serialisation format for programs that are going to parse it, and an agent is not parsing anything. It is reading. Every brace, quote, repeated key name is a token you charge the agent for on every single response, and none of it carries meaning to the reader. Return text first, and let structured output be the fallback through the accept header. There is nothing wrong with adding other ways in either, like ?format=json , when a real program is on the other end. Just stop making that the default, because it is not going to be the common case in the future. Then make it grepable. Surface as much useful information in a single line as you can. The agent's first instinct with your output is to pipe it into grep, because that is the environment it lives in. A record spread across fifteen lines of pretty printed JSON cannot be sliced. The same record on one line can be filtered, counted, cut and sorted, without a round trip back to you or another pass through the model. In crmkit a contact comes back like this: contact k7m2q name="Jane Doe" email=jane@acme.com stage=lead updated=2026-06-04T09:13Z 1 contact s One labeled line per record, and anything that is not a record rides on a comment line the agent can read or ignore. Pagination is the same trick, a next: