You can point an AI agent at any API, but that doesn’t mean the API is designed for it. Most APIs were built for human developers who read docs, write integration code, and handle edge cases. AI agents operate differently — they work within context windows, they reason about schemas, and they need predictable patterns.
Here’s what makes an API genuinely agent-friendly.
1. Self-Describing Responses
An agent-friendly API includes its schema in the response, not just in a separate docs page. When an agent queries for tool details, it should get back the full input_schema and output_schema as JSON Schema — machine-readable, complete, and immediately usable.
This is the difference between an agent that can figure out how to call an API on its own and one that needs a human to paste documentation into its context.
2. Invocation Examples in Every Response
Schemas describe the shape of data. Examples show how to actually use it. An agent-friendly API includes a working invocation_example with every tool detail — the exact URL, headers, and sample body needed to make the call.
This is especially important for LLMs, which learn well from examples. A single concrete example is often more useful than a page of abstract documentation.
3. Consistent Response Envelopes
If every API returns data in a different format, the agent needs to handle each one separately. An agent-friendly platform uses the same response structure everywhere:
{
"job_id": "job_abc123",
"status": "success",
"output": { ... },
"credits_used": 50,
"credits_remaining": 9950
}
One pattern. Every API. The agent writes one response handler and it works for everything.
4. Predictable Error Formats
When things go wrong, the error should be structured and consistent — not an HTML error page or a plain text string. Agent-friendly errors include:
- A machine-readable status (
failed,timeout) - A clear error message
- The cost of the failed call (ideally zero — failed calls should be refunded)
5. Minimal Authentication Complexity
OAuth flows, token refresh, per-API credentials — these are all barriers for agents. An agent-friendly API uses a single API key that works across all capabilities. One key in one header. Done.
6. Compact Responses
LLMs have finite context windows. An agent-friendly API keeps responses compact:
- Structured JSON, not HTML or XML
- Concise descriptions, not marketing copy
- Only the fields that matter
How AgentPatch Applies These Principles
Every API on AgentPatch is context-optimized by default:
- Self-describing schemas in every tool detail response
- Working invocation examples included automatically
- Consistent response envelopes across 50+ APIs
- Structured error responses with automatic refunds for failures
- Single API key authentication
- Compact JSON responses designed for LLM context windows
The result: your agent can discover, understand, and use any AgentPatch API without human intervention.
The AgentPatch CLI is designed for AI agents to use via shell access. Install it, and your agent can discover and invoke any tool on the marketplace.
Install (zero dependencies, Python 3.10+):
pip install agentpatch
Set your API key:
export AGENTPATCH_API_KEY=your_api_key
Example commands your agent will use:
ap search "web search"
ap run google-search --input '{"query": "test"}'
Get your API key from the AgentPatch dashboard.