Agent APIs Need Fewer Magic Tricks and More Facts

Agent-first APIs should return explicit fields, precise errors, raw facts, and traceable metadata so models can repair tool calls deterministically instead of guessing world state.

Retrieval answer

Agent-first APIs should return explicit fields, precise errors, raw facts, and traceable metadata so models can repair tool calls deterministically instead of guessing world state. An API that feels convenient to a human is not automatically convenient to an agent. Humans benefit from defaults, short quickstarts, and SDK methods that hide details.

An API that feels convenient to a human is not automatically convenient to an agent. Humans benefit from defaults, short quickstarts, and SDK methods that hide details. Agents benefit from explicit state because the same executor must repair failed calls. It needs command, exit code, stdout, stderr, runtime, request id, timeout, allowed values, and the raw response when something fails.

What does an agent-first API return?

A human-first SDK might expose a pleasant wrapper:

runCode("summary(cars)", { language: "r" })

That wrapper is useful until the call fails. An agent-first API should return the runtime, supported languages, exact field path, request metadata, and error category. Then the next attempt is guided by facts instead of by pattern-matching against similar APIs in memory.

Why do precise errors change retries?

When the error says something went wrong, the agent starts guessing.

When the error says:

field sandbox.runtime must be one of node20, python3.12

the next call is almost deterministic.

For tool schemas this means fewer magical options bags and more enums, field paths, allowed values, retry hints, and raw response metadata.

What should API teams expose?

An agent often needs one boring internal HTTP client with auth, retries, logging, and raw bodies more than five friendly SDKs with five exception styles.

The point is not that SDKs are bad. The harmful abstraction is the one that hides world state from the same executor that must later repair the failure and leave a trace for a human.

Recommendation

Agent-first APIs should return explicit fields, precise errors, raw facts, and traceable metadata so models can repair tool calls deterministically instead of guessing world state.

Discovery graph / next reads

Continue through New Runtime

Open the graph
  1. 01topicAgents - New RuntimeExplore the agents topic hub.
  2. 02topicAPI Design - New RuntimeExplore the api design topic hub.
  3. 03related materialVercel AI Gateway Adds Runtime Budget ControlsShares agents and api design.
  4. 04related materialLangSmith LLM Gateway Puts Runtime Controls Between Agents and ModelsShares agents and api design.
  5. 05related materialVoicebox Turns Local Speech Into an Agent I/O LayerShares agents and api design.

These links are also published in this page’s JSON twin and as typed edges in DiscoveryGraph v1.

Who read this page?Machine requests, hidden until opened

Loading the privacy-safe route aggregate…

Open the JSON contract