> For the complete documentation index, see [llms.txt](https://docs.maiagent.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.maiagent.ai/maiagent-user-guide/maiagent-user-guide-ja/agent-builder/code-interpreter.md).

# Code Interpreter

## これは何ですか？ <a href="#what-is-this" id="what-is-this"></a>

Code Interpreter を使うと、Agent は**安全なサンドボックス環境**で Python のコードを実行し、プログラムによってタスクを完了できるようになります。

Code Interpreter を有効にすると、Agent はテキストで回答するだけでなく、次のようなこともできるようになります。自分でプログラムを書いて計算を行う、アップロードしたファイルを処理する、Word／PowerPoint／Excel などのファイルを生成する、そしてその結果をダウンロードできる形でお返しする、といったことです。

## ツールとの違いは？ <a href="#code-interpreter-vs-tool" id="code-interpreter-vs-tool"></a>

|               | ツール                          | Code Interpreter              |
| ------------- | ---------------------------- | ----------------------------- |
| **本質**        | 定義済みの外部 API を呼び出す            | サンドボックス内でその場で Python を記述・実行する |
| **柔軟性**       | API が提供する機能の範囲に制限される         | Python でできることは何でも可能           |
| **代表的な利用シーン** | メール送信、CRM の照会、サードパーティサービスの連携 | 計算、データ処理、ファイル生成、グラフ描画         |

**簡単な見分け方**：外部 API を呼び出したい → ツール。計算したい、ファイルを処理したい、ドキュメントを生成したい → Code Interpreter。

## 何ができますか？ <a href="#what-it-can-do" id="what-it-can-do"></a>

* **データ分析と計算**：CSV／Excel の集計、統計、ピボット、クレンジング
* **グラフ描画**：データを折れ線、棒、円などのグラフに描画
* **ドキュメント生成**：Word、PowerPoint、Excel、PDF を生成してダウンロード可能にする
* **ファイル処理**：PDF の解析、フォーマット変換、アップロードファイルの一括処理

## サンドボックス環境 <a href="#sandbox-environment" id="sandbox-environment"></a>

* 実行環境は**安全なサンドボックス**であり、本番システムから隔離されているため、他のデータに影響を与えることはありません
* 標準的な Python と、一般的なデータ／ドキュメント処理用ライブラリに対応しています
* Agent が生成したファイルはチャット画面の **Output** パネルに表示され、そのままダウンロードできます

## 適したシーン <a href="#when-to-use" id="when-to-use"></a>

* 社内の財務／営業チームが Agent に Excel の整理や週次レポートの作成を依頼する
* 人事／総務が Agent にアンケート結果のグラフ化や PowerPoint の作成を依頼する
* 法務／契約チームが Agent に PDF からの重要項目の抽出や Word での要約出力を依頼する
* 「その場での計算」や「その場でのファイル生成」が必要なあらゆる対話シーン

## 何をすればよいですか？ <a href="#what-do-i-need-to-do" id="what-do-i-need-to-do"></a>

1. **Agent 設定に入る** — 有効にしたい AI アシスタントの設定ページを開きます
2. **Code Interpreter を有効にする** — ツールまたは高度な機能のエリアで有効にします
3. **テスト** — 対話の中で Agent に計算やファイル生成が必要なタスクを依頼し、Output パネルから正常にダウンロードできることを確認します


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.maiagent.ai/maiagent-user-guide/maiagent-user-guide-ja/agent-builder/code-interpreter.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
