Pinecone、エージェント対応API設計の重要性を提唱
本文の状態
日本語全文を表示中
詳細モードで約24分の本文を読めます。
同じ出来事の情報源
この情報源を基点に整理
Pinecone
Pinecone は、API デザインの主要な消費者が人間から自律型エージェントへ移行している現状を指摘し、回復機能やコンテキスト効率、実行速度の観点から設計原則の変更を提唱する。
Continue in AI NEW LAB
このニュースを、実務の判断につなげる
AI NEW LABで、試したことや先に確認したい条件を共有できます。まずはログインなしで読めます。
AI NEW LABで論点を見るAI深層分析を開く2026年8月13日 02:37
AI深層分析
キーポイント
消費者の変化と AX の登場
API 利用の主役が人間開発者から自律型エージェントへ移行しており、これに対応する「Agent Experience (AX)」という新たな設計分野が確立されつつある。
エージェント特有の制約条件
エージェントはサポートチケットの提出ができず、コンテキスト(トークン)が限られた資源であり、人間による監視なしに高速で動作するため、従来の API 設計では失敗しやすい。
具体的な設計上の課題
エラー時の回復手段が API 応答内に含まれる必要があること、冗長な記述がコストと精度低下を招くこと、そしてアグレッシブなリトライや並列実行への耐性が求められる。
評価フレームワークの確立
Netlify の Mathias Biilmann 氏が提唱した AX は、Lighthouse のようなスコアリングフレームワークとコミュニティを通じて、エージェントがサービスを利用しやすさを定量化する動きを加速させている。
トレーニングデータの重力
過去のチュートリアルや回答によって形成されたデプロイ済みの API 形状がモデルの事前確率を支配し、ドキュメントやレスポンスが現代のパスへ誘導しない限り、エージェントは古い API を使い続ける。
重要な引用
An agent doesn't integrate with an API once, it re-chooses the API on every task
Their recovery is in-band and metered.
Every byte returned is billed as tokens, and it displaces the reasoning the agent needs to finish the job.
Agents are a magnifying glass for every corner an API cuts
編集コメントを表示
編集コメント
自律型エージェントの台頭は、API エコシステムにおける設計思想の根本的な転換を迫る。従来の DX(開発者体験)の延長線上ではなく、機械が主体となる AX の視点が不可欠であることは、技術陣にとって即座に認識すべき課題だ。
Source Article
元記事を日本語で読む
本文に関係しない購読案内、埋め込み通知、サイト内プロモーションは除いています。
Pinecone では、製品開発にあたり人間だけでなく「エージェント」も重要なユーザーとして意識しています。この新しいタイプのユーザー向けに設計する過程で得た教訓は、同社の 3 つの製品を超えて普遍的なものです。つまり、どの API チームも、意図的に設計しているかどうかにかかわらず、いずれエージェントを相手にすることになるのです。
コンシューマーの変化
これまでの API デザインは、特定の読者を想定していました。それは、1 つのタブでドキュメントを開き、もう 1 つのタブで Stack Overflow を参照しながら作業する人間開発者のことです。その開発者は API を一度評価し、統合コードを書けばそれで完了でした。
しかし今やエージェントが第 2 の読者として登場し、近い将来には主要な読者となるでしょう。採用の単位も変化しています。従来の「開発者が SDK コードを書く」という行為から、「タスクの最中にツールを呼び出すエージェント」へとシフトしているのです。エージェントは API と一度だけ統合するのではなく、あらゆるタスクで API の選択を再検討します。そして、無人で成功するか、あるいは製品が静かにループから脱落するかのどちらかです。
このようにエージェントが新たなコンシューマーとなる背景には、3 つの特性があります。
彼らの回復は、API からのレスポンスに依存する「インバンド」かつ「計測可能」なものです。タスク中にサポートチケットを発行したり同僚に問い合わせたりすることはできません。エージェントが得られる情報はすべて API が返す内容に限られます。ドキュメントや検索への迂回も、1 ラウンド(モデルとの往復 1 回)とトークン数として課金されます。レスポンスに「何が起きたか」と「次に何をすべきか」が明記されていない場合、エージェントは推測せざるを得ません。その推測のたびに、誰かの予算が削られていきます。
彼らのコンテキスト(文脈)は希少なリソースです。返されるデータ 1 バイトすべてがトークンとして課金され、かつタスク完了に必要な推論能力を圧迫します。冗長なレスポンスはかつてはスタイルの問題でしたが、今や「1 リクエストごとのコスト」という欠陥と見なされます。トークン単価が下がっても意味がありません。なぜならコンテキストとは「アテンション(注意)」そのものだからです。ウィンドウがいっぱいになると品質は低下し、請求額が変わらなくても予算は縮小していきます。
彼らは機械の速度で動作します。エージェントは攻撃的にリトライし、自由に並列処理を行い、無人で実行されます。つまり、API の失敗モードがどのようなものであれ、それが人間によるチェックなしに機械のスピードで実行されることになります。
これはすでに「Agent Experience(AX)」という名前の分野になりつつあります。2025 年初頭に Netlify の Mathias Biilmann が提唱したこの概念は、かつて DX(Developer Experience)が UX の横に割り込んだように、開発者体験の隣に並ぶ存在です。コミュニティサイトや、Lighthouse のような「エージェントがあなたのサービスをどれだけ使いこなせるか」を評価するスコアリングフレームワークも登場しています。
古典的な API がエージェントに失敗する理由
まず原則を語る前に、実際の症状を見てみましょう。以下に挙げるすべての失敗パターンは、本番環境の API(当社を含む)で実際に観測されたものです。当社の監査で見つかった問題については既に修正済みですが(詳細とリンクはこの記事末尾に記載)、ここでは例をそのままの生々しい形で残しています。なぜなら、これらはあらゆる古典的な API が抱えがちな典型的なカテゴリだからです。
- 学習データの重力。モデルの事前知識(プリアー)を支配しているのは、廃止された古い API の形状です。長年にわたるチュートリアルや回答でそれが教え込まれてきたからです。ドキュメントやレスポンスが意図的に最新の手法へ誘導しない限り、エージェントは永遠に過去の API を使い続けます。当社のコールドスタート試験でも実際に目撃しました:小規模なモデルの最初の行動は、2024 年に廃止したパッケージ名のインストールでした。一方、最新世代のモデルは即座に現代の API にアクセスしています。事前知識は一種の流通経路のようなものであり、常に時代遅れになりがちです。
- 機能の崖。エージェントが直面するインターフェース(通常は MCP サーバー:エージェントとツールの間における新興の標準インタフェースである Model Context Protocol)は、SDK が提供する機能のごく一部しか公開していません。エージェントはツール内でタスクを開始しますが、途中でこの「崖」にぶつかり、結局は手書きコードへ切り替えるか、あきらめてしまいます。
- サインアップの壁。最初の成功した呼び出しには、ブラウザを持つ人間、メールボックス、そしてクレジットカードが必要です。コールド状態のエージェントにとっては、初回呼び出しまでの時間が無限大になります。
人間が API のエラーメッセージを読み、拒否されたキーの表示を見て眉をひそめ、クリップボードを確認して原因に気づくような場合、それはバグとはみなされません。しかし、エージェントは眉をひそめることができません。エージェントは API が切り捨てたあらゆる箇所に拡大鏡のように作用し、その結果として製品が機能していないと判断されるのは当然のことです。
エージェントフレンドリーな設計の評価基準
「エージェントフレンドリー」という言葉は、数値的な指標が伴うまでスローガンに過ぎません。私たちは、実質的な評価を担う 2 つの主要な指標を採用しました。
- 初回成功までのターン数 (TTFSC): エージェントに事前のコンテキストを与えず、API を使用する必要があるタスクを開始し、最初の成功した呼び出しが行われるまでの往復通信数をカウントします。これはエージェント時代における「Hello World」への到達時間を示す指標であり、非常に厳しい現実を映し出します。不明確なエラー、ドキュメントによる迂回、認証の行き止まりはすべて、1 つのターンとしてカウントされます。
- 無人でのタスク成功率: 人間が一切介入せず、エージェントが API を用いて完了できる現実的な多段階タスクの割合です。この数値こそが、エージェントが製品を継続して選択するかどうかを決定づけるものです。
これら 2 つの主要指標に加え、診断用の指標も追跡しています。具体的には、「修正可能なエラー」の割合(単なる失敗報告ではなく、具体的な解決策を示すもの)、タスク完了あたりのトークンコスト、タスクあたりのツール呼び出し数、およびエラークラスの分類ごとの発生率です。
これらの評価は、CI における評価として実行しています。これは Anthropic が自社のツールを改善する際に行う手法と同じです。各リリースごとに、ステージング環境に対して冷たい状態のエージェントを実行し、TTFSC の悪化は他のビルド障害と同様に扱います。
本記事執筆中に、自社 API で実験を行いました。最新世代のモデル(Claude Sonnet 5)を、ドキュメントもツールも SDK もインストールされていない状態の「裸」の環境で 3 回テストしたものです。環境変数に API キーを設定しただけです。タスクは「いくつかの文書を保存し、最も関連性の高いものを検索する」というものでした。
結果はすべて成功しました。最初の API 呼び出しまでにかかった平均ターン数は 6、一致する結果が返ってくるまでの検索ターン数は 11 です。実行あたり約 90 秒、コストは 0.30 ドルでした。モデルを 3 回だけ試した程度のテストなので科学的な結論を出すには不十分ですが、その会話ログからは、数値の平均値以上の学びがありました。
REST API をそのまま使ったエージェントは、わずか 3 ターンで最初の成功を収めました。唯一の失敗は、データ更新(upsert)直後の検索で空の結果が返ってきたことです。ただし、再試行することで解決しました。一方、Python SDK を選んだ 2 つのエージェントは、ターン数のほぼ半分を「型エラー」の原因究明に費やしていました。そのうち 1 つは、契約仕様を見つけるために SDK のソースコードまで読み込んでいました。
3 つの会話ログからわかったのは、生 API がエージェントに必要な情報を提供している一方、SDK のエラーメッセージは役に立たなかったということです。(具体的な発見内容と、それに基づいて行った修正については、この記事の末尾で詳述します。)
本記事の後半では、現在自社が採用しているチェックリストを公開します。6 つの設計原則、ドキュメントに関する注意書き、そして組織的な教訓です。
原則 1:エラーメッセージはガイドである
エージェントが確実に読むのは、エラーメッセージだけです。つまり、これはドキュメントそのものと同じ役割を果たすものです。そのため、私たちはエラーメッセージを、あたかもプロンプトのように設計しています。
私たちが目指すのは、ユーザーが直面するすべてのエラーに以下の 3 つの要素を含めることです。まず「何が問題か」(特定のフィールドや値、そして期待された内容)、次に「修正方法」(具体的な次のアクション)、そして文章に収まらない場合はドキュメントへのリンクです。「Invalid request(無効なリクエスト)」という表現は、これら 3 つすべてを満たしていません。
悪い例: Invalid request. 良い例: Response is too large. To reduce the size, try a lower top_k value, or omit values and metadata.
後者のエラーは会話のターンを 1 つ消費するだけです。前者の場合は、エージェントがこちらの意図を推測して解決するまで、必要なだけ多くのターンを費やすことになります。
文章による説明に加えて、機械可読なエラーコードも公開しています(標準的な形式としては RFC 9457 の Problem Details を採用しています)。コードはエージェントや SDK が分岐するための契約であり、文章は非契約的な記述として扱われます。そのため、互換性を確認することなくいつでも改善が可能です。
2 つの失敗パターンについては特に注意が必要です。エージェントがセッション全体を失う事例を何度も見てきたからです。Missing(不足)と Invalid(無効)は異なるエラーとして扱い、それぞれに適切な修正方法を提示します。「認証情報がない」ことと「認証情報が拒否された」ことは別問題だからです。また、大まかなチェックが具体的なチェックを覆い隠すこともありません。バリデーションは実行順序を定義しており、最も実用的なエラーを優先して返すか、あるいは両方の信号を同時に返します。
よくある反論の一つに、「リッチなエラーは情報が漏洩する恐れがある」というものがあります。例えば「インデックスが見つかりません」というメッセージは、攻撃者に存在するリソースの情報を教えてしまうからです。
この問題に対する解決策は、一つの不変条件を設けることです。権限を持つ呼び出し元には正確なエラーを返し、それ以外の人には常に同じ壁(エラー)を見せるようにします。正当にリソースにアクセスできる呼び出し元に対して情報を豊富にする行為が、アクセスできない人にとって攻撃対象領域を広げることはありません。
また、エラーの受け入れ先も一元化しました。ゲートウェイ、認証レイヤー、サービスそれぞれでパブリックなエラーメッセージを個別に作成すると、契約は層ごとに崩れていきます。同じ失敗が一つのパスでは教訓となり、別のパスでは行き止まりになるという事態です。
すべての公開メッセージは単一のチョークポイント(ボトルネック)を経由し、そこで契約が強制されます。
原則2: リーダーのコンテキストを予算化する
レスポンスは、エージェントが推論のために使用するコンテキストウィンドウに届きます。そのため、このスペースは慎重に使う必要があります。機能的には、私たちが自由に使いこなすか、無駄にするかの問題です。
すべての要素に上限を設けます。 無制限のリストも、ダンプ処理も、火の粉のような大量データも許しません。ページネーションと上限値は、REST エンドポイントだけでなく、ツール出力やドキュメント検索など、リスト形式のレスポンスすべてに適用します。
切り捨てを行う場合は、その旨を明記し、絞り込む方法を提示する必要があります。「1,340 件中 20 件を表示中;名前空間でフィルタリングして結果を減らしてください」のようにです。静かに上限値が設定されていると、エージェントは「これがすべてだ」と誤解し、誤った前提に基づいて処理を進めてしまいます。
トークン課金制の読者向けにレスポンスを設計する。Anthropic の ツール記述ガイド には、意味のある識別子が不明瞭な UUID よりもモデルの精度で明確に優位であるというデータがある。また、response_format を簡潔にするか詳細にするかで、例ではトークン使用量が約 3 分の 1 に削減される。重要なフィールドは先頭に配置し、すべてのフィールドにお金を払う必要がある以上、柔軟性が美徳になるわけではない。
検索がリストより勝つ。エージェントが何を探しているかを知っている場合、search_contacts(query) は list_contacts() に加えてエージェント側でフィルタリングするよりも優れている。クエリ計画はエージェントの頭の中で行うべきではない。
成功はインバンドで検証可能である必要がある。書き込みが成功した場合は、ID やカウント、準備状態など、追加の読み取りなしにエージェントが効果を確認できる十分な情報を返すことだ。
原則 3: 自己記述はドキュメントより勝る
「ここで何ができるか?」と API に問いかけることで、エージェントはワンショットでタスクを完了する。推測して試行錯誤するだけでは失敗する。describe や capabilities エンドポイントを公開し、リソースが受け付ける内容やフィルタリング可能なフィールド、制限事項、現在の状態といった運用上の質問にインバンドで答えるようにする。
OpenAPI スペックは必須条件だ。エージェントは記述をそのまま読むため、不完全な記述を含む完全な仕様でも失敗する。エンドポイントの戻り値については説明しているが使用タイミングが不明確だと、モデルの事前知識に任せることになる。そのため、すべてのパラメータには説明と現実的な例を示す必要がある。
Responses are shaped for a reader that pays per token. Anthropic's tool-writing guide has data on this: semantically meaningful identifiers measurably outperform opaque UUIDs for model precision, and offering a response_format of concise vs detailed cut token usage roughly threefold in their examples. High-signal fields come first; flexibility isn't a virtue when every field costs money.
Search wins over list. When the agent knows what it's looking for, search_contacts(query) beats list_contacts() plus agent-side filtering; query planning shouldn't happen in the agent's head.
Success is verifiable in-band. A successful write returns enough — IDs, counts, readiness state — that the agent can confirm the effect without a follow-up read.
Principle 3: Self-description beats documentation
An agent that can ask the API "what can I do here?" one-shots its task. An agent that has to guess, flails. We ship describe/capabilities endpoints that answer the operational questions in-band: what a resource accepts, which fields are filterable, what the limits are, what state it's in.
An OpenAPI spec is table stakes. Agents read descriptions exactly as written, so a complete spec with vague descriptions still fails them. A description that says what an endpoint returns but not when to use it leaves the choice to the model's priors, so every parameter gets a description and a realistic example.
デプレケーション(非推奨)は、誰かが対応しない限り事実上永久に続きます。レスポンスや公式な例示に残存する古い仕様は、学習データがそれを示すため、すべてのエージェントのデフォルトとして定着してしまいます。そのため、私たちは明確に非推奨を宣言し、旧経路を紛れもない形でマークするとともに、現代的な経路をあらゆる場所で標準的な例として提示する必要があります。
原則4:機械の速度でも安全に
すべての操作が再試行され、並列化され、時には自信満々だが誤った引数で呼び出されるものだと想定して設計します。なぜなら、実際には人間が到達したことのない速度でそれが起こるからです。
整合性(アイデンポテンシー)は、親切心ではなく契約です。 エージェントはデフォルトで再試行を行うため、再試行された変更操作は重複ではなく何もしない処理(no-op)であるべきです。また、適用されるセマンティクスについては文書で明示する必要があります。自然な整合性が適用できない場合は、整合性キー(idempotency keys)がその役割を担います。
レート制限は制御可能です。 X-RateLimit-* ヘッダーや Retry-After により、エージェントは自ら進んでスロットリングを行うことができます。これらがなければ、壁に激突して盲目でバックオフするしかありません。
予測可能性が重要です。 同じ入力と状態であれば、同じ形状と結果が得られるはずです。結果が正当に変化する可能性がある場合は、レスポンスでその旨を明記します。エージェントはこの一貫性の上に多段階の計画を組み立てるため、予期せぬ驚きは計画全体を無効化してしまいます。
ガードレールは境界に設置されます。 ドライランやプレビューモード、可能な限り実行の巻き戻し機能、破壊的な操作に対する確認ゲートなどです。エージェントは人間よりもはるかに速く愚かな行動をとってしまうため、高速で実行された愚かな行為であっても回復可能である必要があります。
原則 5:人間を介さないアクセス
認証(Auth)は、エージェントの運用が最も失敗しやすい箇所であり、TTFSC(Time To First Successful Call)には資格情報の取得も含まれます。ここには成熟度の段階があり、現在の多くの API はまだ最下層に留まっています。
短期有効なキーです。数分〜数時間の TTL(Time To Live)を持つ資格情報を使い、どこかのリポジトリに残り続ける不滅のキーは避けるべきです。アカウントレベル以下の最小権限スコープも重要です。リソース単位で、読み取り・書き込み・管理を細かく区別します。エージェントが初期段階で広範な権限を要求し、それを永久に保持し続けるのは、大きな被害範囲(Blast Radius)を生むリスクです。
次に重要なのがデレゲーションネイティブなフローです。人間に代わって動作するエージェントには OAuth 2.1 with PKCE を、自律型サービスエージェントにはクライアントクレデンシャルを、RFC 8693 のトークン交換を用いて広範な資格情報をタスク固有のものに絞り込みます。モデルコンテキストプロトコル(Model Context Protocol)の認証仕様は、これらのフローを仲介するエージェントランタイム間の共通基盤として台頭しつつあります。
最上位の段階はゼロサインアップサンドボックスです。誰でも取得可能な一時リソースを用意し、冷えた状態のエージェントがアカウントなしで最初の成功した呼び出しを行えるようにします。その後、人間がその作業を引き継ぎます。濫用防止は登録フォームではなく、クォータと TTL で管理します。これは「濫用の経済性」とのトレードオフであり、無制限のエージェント到達範囲に対して支出を限定する仕組みです。
これらすべてを通じて、人間は必須条件ではなくエスカレーションの窓口としてループ内に留まります。エージェントは自身のスコープ内で自由に動作し、特権的な操作のみが承認トリガーとなります。
原則 6:エージェント向けインターフェースは製品であり、単なる鏡ではない
各エンドポイントにツールを一つずつ割り当てて MCP サーバーとする「反射的な対応」が一つの選択肢ですが、私たちはそれを拒否しました。API をそのまま鏡のように映し出すアプローチでは、エージェントは二度の失敗を喫するからです。
大規模な API の場合、最初の呼び出しが行われるまでに数十万トークンを消費してしまうこともあります(Cloudflare は 2,500 エンドポイントを持つ表面において、100 万トークン以上を要したと測定しています)。また、エンドポイントを細分化しすぎると、エージェントは API のワークフローを一つずつ手動で再構築する必要に迫られ、非効率を招きます。
キュレーションの必要性は単なる仮説ではありません。私たちの行った 3 つの「コールドスタート」トライアルのうち 2 つでは、API に直接アクセスする前に、エージェントが最初に実行した行動は、自らのハネス(環境)内にあるツールを検索し、自社製品用のインストール済みツールを探すことでした。最終的に生 HTTP リクエストに頼るまでには至りませんでした。これは、窓から這い上がる前に、まずは正面玄関を探そうとする人間の行動と似ています。
そのため私たちはキュレーションを行いました。Anthropic のガイダンスでは、エンドポイント単位で多数のツールを作るのではなく、ワークフローに沿った少数のツールを構築することを推奨しています。具体的には、「list_users」「list_events」「create_event」を個別に提供するのではなく、「schedule_event」という単一のツールを提供するべきです。
Stainless や Speakeasy といった SDK ベンダーも、同じく「生エンドポイントを公開するのではなく、機能を公開すべきだ」というアドバイスに合意しています。
大規模な API の場合、そのアプローチはさらに広がります。動的メタツール(list_endpoints / get_schema / invoke)によって、エージェントがオンデマンドで操作を発見できるようになります。一方、このスペクトルの一端には Cloudflare の Code Mode があります。これは型付き SDK を介して search() と execute() のみを公開し、エージェントが API に対してコードを書けるようにします。これにより、約 1,000 トークンの固定コストで、同じ 2,500 エンドポイントにアクセス可能になります。
このスペクトル全体に通じる共通点は、誰かがエージェント向けのインターフェースを設計する必要があるという点です。それを生成することが、ミラーリング(反映)を実現する方法なのです。
キュレーションの誠実さを保つための 2 つのルールがあります。
機能のパリティ: SDK で可能なことはすべてエージェント側でも可能であること。あるいは、その差が明示的かつ文書化されていること。
ゼロ構成デフォルト: 意思決定が最も少ないパスを、すべてのエージェントが選択するように設計することです。つまり、デフォルトのパスこそが最適なパスなのです。
長い尾(ロングテール)の機能も、エスケープハッチ、メタツール、コードモード、あるいは最低限 SDK への文書化されたポインタを通じてアクセス可能に保つ必要があります。これにより、処理中にタスクが行き詰まることを防ぎます。
新瓶に入った古酒か?
ここに挙げた要素は、10年前のAPIデザイナーから見ればどれも馴染み深いものばかりです。実行可能なエラー、範囲を限定したレスポンス、自己記述性、冪等性、最小権限の原則、誠実なドキュメント。これらに新しいものはありません。優れたAPI設計とは本来そうあるべきものであり、過去に指標が良好に見えたのは、人間が開発者としてそのコストを静かに負担していたからです。
エージェントは新たなAPIの規範を求めているわけではありません。むしろ、従来の規範を無視した場合のコストが「可視化」され、「請求可能」になり、離脱を招く要因となることを浮き彫りにしているのです。本当に新しいのは、以下の4点に絞られます。機械的な速度での安全性、委譲を前提とした認証、エージェント向けに厳選されたインターフェース、そして設計上の予算としてのトークンコストです。残りの要素は古くからの規範であり、現在はそれが強制されるようになったという違いだけです。
この投稿の発端となった実験があります。冷たい状態のエージェント(事前知識を持たないもの)をAPIに向けることで、最初の成功する呼び出しに至るまでのターン数をカウントするというものです。ドキュメントが事前に読み込まれたデモ用エージェントではなく、純粋な「コールド」なエージェントです。この数値こそが「エージェント体験の基準線」となり、前述のすべての原則は、この数字を下げることを目指したものです。
Nexus と Pineconeのエージェントスキル(npx skills add pinecone-io/skills)も同じ設計思想に基づいて構築されています。これは、会話の相手側であるエージェントから見た場合、目的のために作られたインターフェースがどのような感覚を与えるかを体感できる機会です。
さらに読むべき資料
原文を表示
At Pinecone we develop our products with both human and agentic consumers in mind. Designing for that second kind of consumer taught the team something about API design that generalizes well past those three products: every API team is about to serve an agentic consumer, whether they design for it or not.
The consumer changed
API design has, until recently, assumed a particular reader: back when 'the reader' meant a human developer with docs open in one tab and Stack Overflow in the other. That developer evaluates the API once, writes an integration, and moves on. Agents are a second reader now, and likely soon the dominant one. The unit of adoption is shifting from a developer writing SDK code to an agent calling a tool mid-task: an agent doesn't integrate with an API once, it re-chooses the API on every task, and it either succeeds unattended or the product silently drops out of the loop.
Three properties make agents a new kind of consumer:
- Their recovery is in-band and metered. An agent can't file a support ticket or ping a colleague mid-task; everything it learns comes from what the API returns. Every detour through docs or search is billed in turns (one full round-trip through the model) and tokens. If the response doesn't say what went wrong and what to do next, the agent guesses, and every guess spends someone else's budget.
- Their context is a scarce resource. Every byte returned is billed as tokens, and it displaces the reasoning the agent needs to finish the job. A verbose response used to be a style complaint; now it's a defect with a per-request price tag. Cheaper tokens don't help, because context is attention: quality degrades as the window fills, and the budget shrinks even where the bill doesn't.
- They operate at machine tempo. Agents retry aggressively, parallelize freely, and act unattended, so whatever the API's failure modes are, they now execute at machine speed with no human sanity check in the loop.
This is becoming a discipline with a name: Agent Experience, or AX, coined in early 2025 by Netlify's Mathias Biilmann, sitting alongside developer experience the way DX once elbowed in next to UX. There's a community site and an emerging scoring framework — think Lighthouse, but for how well agents can use your service.
How agents actually fail against a classic API
Before principles, symptoms. Every failure pattern below is real, observed against production APIs, ours included. The ones our own audit caught have since been fixed (the list, with links, closes this post); we keep the examples in their original unflattering form, because these are the categories every classic API accumulates.
- Training-data gravity. Deprecated API shapes dominate the model's priors, because that's what years of tutorials and answers taught it. Unless docs and responses actively steer to the modern path, agents will write yesterday's API forever. We watched this live in our own cold trials: a smaller model's very first action was to install a package name we retired in 2024, while the current-generation model went straight to the modern API. The priors are a distribution channel, and they lag.
- Capability cliffs. The agent-facing surface — typically an MCP server (Model Context Protocol, the emerging standard interface between agents and tools) — exposes a strict subset of what the SDK can do. The agent starts a task inside the tool, hits the cliff halfway through, and either shells out to hand-written code or gives up.
- The signup wall. The first successful call requires a human with a browser, an email inbox, and a credit card. For a cold agent, time-to-first-call is infinite.
None of these registers as a bug when the reader is human. A person squints at the rejected-key message, checks their clipboard, figures it out. An agent can't squint. Agents are a magnifying glass for every corner an API cuts, and the person watching the transcript concludes, fairly or not, that the product doesn't work.
Measuring agent-friendliness
"Agent-friendly" stays a slogan until numbers get attached to it. We settled on two metrics that do most of the work:
- Turns-to-first-successful-call (TTFSC). Start an agent with zero prior context and a task that requires the API, then count the round-trips until the first successful call. This is time-to-hello-world for the agent era, and it's brutally honest: every unclear error, every doc detour, every auth dead-end shows up as a turn.
- Unattended task-success rate. The percentage of realistic, multi-step tasks an agent completes against the API with zero human intervention. This is the number that decides whether agents keep choosing a product.
Behind those two, we track the diagnostic ones: the percentage of errors that are actionable (they state a fix, not just a failure), token cost per completed task, tool calls per task, and error rates by class. We run these as evaluations in CI, the way Anthropic iterates on its own tools: a cold agent against staging on every release, with a TTFSC regression treated like any other broken build.
We ran the experiment on our own API while drafting this post: three cold trials of a current-generation model (Claude Sonnet 5) in a bare harness. An API key in the environment, no docs, no tools, no SDK preinstalled. The task was "store a handful of documents, retrieve the most relevant one." All three succeeded unattended: median 6 turns to the first successful API call, 11 turns to the first search that returned matches, roughly 90 seconds and $0.30 per run. Three runs of one model is a smoke test, not science, but the transcripts taught us more than the medians. The agent that chose raw REST reached its first successful call in 3 turns; its only stumble was a search right after upsert that silently returned empty until it retried. The two agents that chose our Python SDK spent nearly half their turns learning call signatures from bare TypeErrors — one ended up reading the SDK's source to find the contract. It cost three transcripts to learn that the raw API taught the agent what it needed and the SDK's errors didn't. (The specific findings, and the fixes they produced, are published at the end of this post.)
The rest of this post is the checklist we now hold our own surface to: six design principles, a note on docs, and one organizational lesson.
Principle 1: Errors are guidance
The error message is the only piece of documentation an agent is guaranteed to read, so we write it like the prompt it is.
Our standard: every user-facing error carries three things — what was wrong (the specific field or value, and what was expected), the fix (a concrete next action), and a doc link when the fix doesn't fit in a sentence. "Invalid request" fails all three.
Bad: Invalid request. Good: Response is too large. To reduce the size, try a lower top_k value, or omit values and metadata.
The second error costs one turn. The first costs as many turns as the agent needs to guess our intent, if it ever does.
Alongside the prose, we expose a stable, machine-readable error code (RFC 9457's Problem Details is the standard shape). Codes are the contract agents and SDKs branch on; prose becomes non-contractual, free to improve anytime without a compatibility review.
Two failure patterns deserve explicit call-outs, because we've watched agents lose whole sessions to each. Missing and invalid get treated as different errors with different fixes: no credential and rejected credential aren't the same problem. A coarse check never masks a specific one either: validations are ordered so the most actionable error wins, or both signals return.
One objection came up repeatedly: rich errors seem like they'd leak information, since "index not found" tells an attacker which resources exist. The fix is a single invariant: authorized callers get the precise error, everyone else gets the same wall they always got. Enrichment for a caller who could legitimately reach the resource never expands the attack surface for one who couldn't.
We also gave errors one home. When public error text is authored independently in the gateway, the auth layer, and the service, the contract decays one layer at a time: the same failure teaches in one path and dead-ends in another. Every public message routes through a single choke point, where the contract is enforced.
Principle 2: Budget the reader's context
The response lands in a context window the agent needs for reasoning, so we spend that space carefully. Functionally, it's ours to spend or waste.
Everything gets bounded. No unbounded lists, no dumps, no firehoses. Pagination and caps apply to every list-like response, including tool output and docs search, not just REST endpoints. When truncating, we say so and say how to narrow: "Showing 20 of 1,340 results; filter by namespace to reduce." A silent cap reads as "that's everything," and the agent proceeds on a false premise.
Responses are shaped for a reader that pays per token. Anthropic's tool-writing guide has data on this: semantically meaningful identifiers measurably outperform opaque UUIDs for model precision, and offering a response_format of concise vs detailed cut token usage roughly threefold in their examples. High-signal fields come first; flexibility isn't a virtue when every field costs money.
Search wins over list. When the agent knows what it's looking for, search_contacts(query) beats list_contacts() plus agent-side filtering; query planning shouldn't happen in the agent's head.
Success is verifiable in-band. A successful write returns enough — IDs, counts, readiness state — that the agent can confirm the effect without a follow-up read.
Principle 3: Self-description beats documentation
An agent that can ask the API "what can I do here?" one-shots its task. An agent that has to guess, flails. We ship describe/capabilities endpoints that answer the operational questions in-band: what a resource accepts, which fields are filterable, what the limits are, what state it's in.
An OpenAPI spec is table stakes. Agents read descriptions exactly as written, so a complete spec with vague descriptions still fails them. A description that says what an endpoint returns but not when to use it leaves the choice to the model's priors, so every parameter gets a description and a realistic example.
Deprecation now means forever, unless someone acts on it. A deprecated shape that lingers in responses and canonical examples becomes every agent's default, because that's what the training data shows. We deprecate loudly, mark the old path unmistakably, and make the modern path the canonical example everywhere.
Principle 4: Safe at machine tempo
We design as if every operation will be retried, parallelized, and occasionally invoked with confidently wrong arguments, because it will be, at speeds no human operator ever achieved.
Idempotency is a contract, not a nicety. Agents retry by default, so a retried mutation is a no-op, not a duplicate, and whichever semantics apply are documented explicitly. Where natural idempotency doesn't fit, idempotency keys fill the gap.
Rate limits are pace-able. X-RateLimit-* headers and Retry-After let an agent throttle itself proactively; without them it slams into the wall and backs off blindly.
Predictability matters. Same input and state yield the same shape and outcome; where results can legitimately vary, the response says so. Agents build multi-step plans on top of that consistency, and every surprise invalidates a plan.
Guardrails sit at the boundary: dry-run and preview modes, reversibility where possible, confirmation gates on destructive operations. An agent will do the dumb thing faster than any human ever could, so the dumb thing, done fast, has to be recoverable.
Principle 5: Access without a human in the loop
Auth is where agent journeys die most often, and TTFSC includes credential acquisition. There's a maturity ladder here, and most APIs today are standing on the ground floor.
Short-lived keys — credentials with TTLs measured in minutes to hours, not the immortal keys that end up in a repo somewhere. Least-privilege scoping below the account: per-resource, read vs. write vs. admin. An agent that requests broad scopes early and holds them forever is a standing blast radius.
Delegation-native flows come next: OAuth 2.1 with PKCE for agents acting on behalf of a human, client credentials for autonomous service agents, RFC 8693 token exchange to narrow a broad credential to a task-scoped one. The Model Context Protocol's authorization spec is emerging as the common ground for how agent runtimes broker these flows.
The top rung is a zero-signup sandbox: claimable scratch resources, so a cold agent reaches its first successful call with no account at all, and a human claims the work afterward. Quotas and TTLs bound the abuse rather than a signup form — an abuse-economics trade, bounded spend for unbounded agent reach.
Through all of it, the human stays in the loop as an escalation, not a prerequisite: the agent operates freely within its scope, and privileged operations trigger approval.
Principle 6: The agent surface is a product, not a mirror
The reflexive move is one tool per endpoint, calling it an MCP server. We resisted it: a full mirror fails the agent twice. A large API can burn hundreds of thousands of tokens before the first call (Cloudflare measured over a million for its 2,500-endpoint surface), and endpoint granularity forces the agent to re-derive the API's workflows call by call.
The demand for curation is not hypothetical. In two of our three cold trials, the agent's very first action, before touching the API, was to search its harness for an installed tool for our product, only falling back to raw HTTP. Agents check for a front door before climbing through the window.
We curate instead. Anthropic's guidance is to build a few workflow-shaped tools rather than many endpoint-shaped ones, schedule_event rather than list_users plus list_events plus create_event. Stainless and Speakeasy converge on the same advice from the SDK side: expose capabilities instead of raw endpoints.
For large APIs, the spectrum runs further: dynamic meta-tools (list_endpoints / get_schema / invoke) let the agent discover operations on demand. At the far end sits Cloudflare's Code Mode, which exposes just search() and execute() over a typed SDK and lets the agent write code against an API, making those same 2,500 endpoints reachable for a fixed cost of about a thousand tokens. The common thread across the whole spectrum: someone has to design the agent surface. Generating it is how the mirror happens.
Two rules keep the curation honest. Capability parity: anything the SDK can do, the agent surface can do, or the gap is explicit and documented. Zero-config defaults: the path with the fewest decisions is the one every agent takes, so the default path is the good path. The long tail stays reachable through an escape hatch, a meta-tool, a code mode, or at minimum a documented pointer to the SDK, so no task dead-ends mid-flight.
Old wine in new bottles?
Every item here would look familiar to an API designer from a decade ago: actionable errors, bounded responses, self-description, idempotency, least privilege, honest docs. None of this is new; good API design always meant it, and the only reason the metrics looked fine is that human developers were quietly paying the cost themselves. Agents don't demand a new API discipline — they make the cost of ignoring the old one legible, billable, and churn-inducing. What's genuinely new is a shorter list: safety at machine tempo, delegation-native auth, the curated agent surface, and token cost as a design budget. The rest is the old religion, now with enforcement.
This is the experiment that started this post: point a cold agent at an API and count the turns to the first successful call. Not a demo agent with docs preloaded — a cold one. That number is the agent-experience baseline, and every principle above is a way to bring it down.
Nexus and the Pinecone agent skills (npx skills add pinecone-io/skills) are both built this way: a chance to see what a purpose-built agent surface feels like from the agent's side of the conversation.
Further reading
関連記事
今日のまとめ
AIデイリーブリーフで今日の重要ニュースをまとめ読み