Search the alley

記事を検索

2文字以上でタイトル・カテゴリ・タグを検索できます。

GPT-5.6のProgrammatic Tool Callingとは?function callingとの違い・使い方・注意点

GPT-5.6のProgrammatic Tool Callingを初心者向けに解説。通常のfunction callingとの違い、isolated V8 runtime、allowed_callers、MCP・shell対応、ZDR、向く処理、承認が必要な操作で使わない理由を整理します。

公開 2026.07.10 / 更新 2026.07.10

この記事のポイント

  • modelがisolated V8でJavaScriptを実行し、parallel call・loop・condition・中間結果処理を組み立てる
  • direct / programmatic / bothをallowed_callersでtoolごとに制御する
  • write・approval-sensitive action・citation・native artifactの最終確認はdirectを基本にし、代表taskでbaseline比較する

一言でいうと:toolの呼び出し手順を、modelがJavaScriptで組み立てる

Programmatic Tool Callingは、Responses API request内でmodelがJavaScriptを生成・実行し、複数toolの呼び出し、parallel処理、loop、condition、中間結果の絞り込みを組み立てる仕組みです。通常のfunction callingを無条件に置き換えるものではなく、予測可能なcontrol flowを小さなstructured resultへ縮約できるstageで使います。

API model ID位置づけ入力 / 1M tokens出力 / 1M tokens主な選び方
gpt-5.6-sol(alias: gpt-5.6)flagship$5$30難しい推論・coding・品質優先
gpt-5.6-terra性能と費用の均衡$2.50$15日常のproduction workflow
gpt-5.6-luna高速・低コスト$1$6大量・低遅延・費用重視

direct tool callingとの違い

task形状推奨理由
単発lookup / actiondirectprogramを挟む必要がない
filter・join・rank・dedupe・aggregate・validateprogrammatic大量の中間結果を小さくできる
予測可能な依存callprogrammatic後続argumentと停止条件をcodeで表せる
検索結果ごとに意味判断direct各結果をmodelが読み直す必要がある
write / approval-sensitive actiondirectを基本明確なauthorization boundaryを残す
citation / native artifactの最終確認directを基本元のevidenceやartifactを保つ

isolated V8 runtimeでできること・できないこと

できるできない外部へ触る方法
JavaScript、top-level await、parallel、loop、condition、中間結果処理Node.js、package install、direct network、general filesystem、subprocess、console、persistent JS staterequestで許可されたtoolsだけを使う
text(...) / image(...)で出力任意の環境変数やlocal fileへ直接アクセスfunction、custom、MCP、apply_patch、shell、code_interpreterなど対応tool経由

programmatic_tool_callingとallowed_callers

allowed_callers動作使いどころ
省略 / ["direct"]modelがtoolを直接call単発、承認、意味判断
["programmatic"]program item内のcodeだけがcallboundedな集約stage
["direct", "programmatic"]どちらからもcall可能stageごとのroutingをpromptで明確にする
const response = await client.responses.create({
  model: "gpt-5.6-terra",
  input: "複数店舗の在庫を比較し、欠品候補だけをJSONで返してください。",
  tools: [
    {
      type: "function",
      name: "get_inventory",
      description: "店舗別の在庫数を返す",
      parameters: {
        type: "object",
        properties: { store_id: { type: "string" } },
        required: ["store_id"],
        additionalProperties: false
      },
      output_schema: {
        type: "object",
        properties: { store_id: { type: "string" }, units: { type: "number" } },
        required: ["store_id", "units"],
        additionalProperties: false
      },
      allowed_callers: ["programmatic"]
    },
    { type: "programmatic_tool_calling" }
  ]
});

この例は最小構成です。application側はclient-owned function callを実行し、call_idとcallerの関係を保って結果を返し、program_outputまたは最終messageまで継続する必要があります。generated JavaScriptを自分のNode.js processで実行する設計ではありません。

supported tools・MCP approval・ZDR

  • programmatic callerに対応する主なtool typeはfunction / custom、MCP、apply_patch、local / hosted shell、code_interpreter
  • MCPのrequire_approvalはprogramを停止して人間承認を待てる
  • ZDRはorganizationまたはprojectで有効化が必要で、store: falseだけではZDRにならない
  • model、tools、third-party servicesを含むrequest全体のretention条件を確認する
  • OpenAI-hosted toolも個別のdata retentionとsecurity guidanceを見る

multi-agentとの違い

Programmatic Tool Callingは一つのmodel response内でcodeがtoolをorchestrateする仕組みです。Responses APIのmulti-agent betaは、複数subagentを並列に動かして結果を統合する仕組みです。ultraに近い並列分担と、toolのfilter・join処理を同じものとして扱わないでください。

retry・stop条件と安全境界

  • programを使うbounded stageと利用toolを明示する
  • 必要なresult shapeとevidenceを定義する
  • stop conditionとretry上限を先に決める
  • 完了済みcallを繰り返さない
  • side effectをprogrammatic stageへ混ぜない
  • 高影響actionはapplication-level approvalを必須にする
  • argumentとpermissionをapplication側でも検証する

baseline比較で見る指標

Programmatic Tool Callingは中間tool出力をmodel contextへ戻す量を減らせますが、token削減や高速化をすべてのtaskで断定できません。direct tool callingをbaselineにし、代表taskで正確性、完全性、evidence、input / total tokens、latency、cost、tool call、retry、安全性を比較します。

prompt cachingとの費用境界

GPT-5.6以降はcache writeがuncached inputの1.25倍、cache readは90%割引です。explicit cache breakpointと最低30分のcache lifeを使えますが、1回しか再利用しない長文を毎回writeすると得とは限りません。Programmatic Tool Callingの効果とcachingの効果を分けて計測します。

Programmatic Tool Calling FAQ

通常のfunction callingより常に優れていますか?

いいえ。単発call、意味判断、write、承認、citationやnative artifactの最終確認はdirectが向きます。予測可能な集約stageで比較します。

generated JavaScriptはNode.jsで動きますか?

いいえ。OpenAIがfresh isolated V8 runtimeで実行し、Node.js、package install、direct network、general filesystem、subprocess、console、persistent stateは提供されません。

store: falseならZDRですか?

それだけではZDRになりません。organization / projectでZDRが有効か、model・tool・third-party serviceを含むrequest全体が対象か確認します。

MCP toolも呼べますか?

対応します。allowed_callersでprogrammaticを許可し、require_approvalが設定されたMCP callは承認待ちでprogramを停止できます。

tokenは必ず減りますか?

必ずとは言えません。directをbaselineにし、代表taskで品質、evidence、token、latency、cost、retry、安全性を比較します。

関連記事