演習 › 全問
問題 Q3-10
48 / 120分野3・パフォーマンス上の制約要因の解消
まだ解いていません。
エージェントが、請求の突合のために、同じツールを50回ずつ呼び、毎回の結果を文脈に戻している。遅延が大きく、トークンも多い。最も適切な変更はどれか。
正解は B
- A小さくしても、往復の回数と、文脈に戻す量は変わりません。
- B正解です。コードで繰り返すと、途中の結果が文脈に入らず、呼び出しごとの往復も省けて、遅延とトークンの両方が減ります。
- Cツールの数を増やしても、同じ呼び出しの回数は減りません。
- D確認を挟むと、遅延がさらに悪化します。
考え方:多数の繰り返しは、コードで回して、集計結果だけを文脈に戻す。
出典:Programmatic tool calling
This reduces latency for multi-tool workflows and decreases token consumption by allowing Claude to filter or process data before it reaches the model’s context window.https://platform.claude.com/docs/en/agents-and-tools/tool-use/programm…(取得 2026-11-23)
出典:Programmatic tool calling
You provide the tool result, and code execution continues (intermediate results are not loaded into Claude’s context window).https://platform.claude.com/docs/en/agents-and-tools/tool-use/programm…(取得 2026-11-23)