feat: tool_code_execution() — provider-executed code execution

オープン
#364 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
静か
技術スタック
python

調査の方向性

docs/plans のドラフトと、issue に記載されている既存の Web 検索/取得実装から始めます。provider annotation と content-type の先例を追跡し、コンテナの永続化とサポート対象外プラットフォームを含め、Anthropic、OpenAI Responses、Google に必要な作業を定義します。完了とは、設計が確定し、3 つの provider すべてに一貫した first-class tool path があることを意味します。

索引モデルが issue の本文から書いたものです。

説明

ai-triage:needs-review

Code execution is the last provider-executed tool that is GA across all three first-class providers (Anthropic, OpenAI Responses API, Google Gemini) — the same footprint as tool_web_search(). A first-class tool_code_execution() would let the model run Python server-side for data analysis, math, and file processing with zero local sandbox setup, which is squarely in the wheelhouse of chatlas's data-science audience.

chat.register_tool(tool_code_execution())
chat.chat("Compute the eigenvalues of this matrix and plot them: ...")

Provider mapping

Provider Tool spec Notes
Anthropic {"type": "code_execution_20250825", ...} (newer dated variants exist) Server sandbox (Python 3.11, no internet). Container reusable across requests via container param. Free when combined with recent web search/fetch variants; otherwise ~1,550 free container-hours/org/month, then $0.05/hr. Docs
OpenAI (Responses) {"type": "code_interpreter", "container": {"type": "auto"}} Or an explicit container ID from /v1/containers. Billed per memory tier per 20-min session ($0.03–$1.92). Docs
Google types.Tool(code_execution=types.ToolCodeExecution()) No extra fee (standard token billing). Python only, ~30s per execution, no custom packages. Returns executable_code / code_execution_result parts. Docs

Design considerations

  • New content types (ContentToolRequestCodeExecution / ContentToolResponseCodeExecution) following the web search/fetch precedent, registered in PROVIDER_ANNOTATION_TYPES so each provider replays only its own blocks.
  • Container/session persistence across turns (Anthropic container, OpenAI container IDs) — likely: scan turn history for the most recent container ID and resend it.
  • Gemini models before Gemini 3 cannot mix built-in tools with custom function declarations in the same request.
  • Availability gaps: not supported on Amazon Bedrock; not supported on Vertex AI for Anthropic models (see the guard issue for how unsupported platforms should fail).

Design work for this is already underway locally (docs/plans draft + worktree).

主要言語
Python
スター
179
フォーク
32
平均マージ
1日 3時間
マージ済み PR(30日)
10

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

posit-dev/chatlas のほかの issue

posit-dev/chatlas の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。