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.

2 min1 source

In one minute

  • 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.
  • The record is connected to 3 topics: api-design, agents, tool-use.
  • 1 public source carries the evidence boundary.

Source ledger

Publishable sources attached to this record.

1 public source
#SourceRolePublic status
1freestyle.shsourceprimary receiptsource_urls
On this page

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.

The agent needs to know what actually happened after a tool call: command, exit code, stdout, stderr, runtime, request id, timeout, allowed values, and the raw response when something fails.

Example

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 retries change

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.

New Runtime Read

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.

Open archive
  1. Under the Hood: AI Engineers Need Mechanism Mapsai-engineering ยท rag2 sources