AIDP ノートブック(対話的なコード実行環境)の作成・編集・実行と、そのカーネルセッション(計算処理の実行環境)の管理ができます。 次のような場合に使用: - ユーザーがノートブックを作成したい - セル(ノートブック内の実行単位)やコードをクラスター上で実行したい - カーネルセッションの接続・切断を行いたい - ウィジェット(対話的な操作部品)、Spark SQL、Plotly などを組み合わせた対話的なノートブックを構築したい ノートブックのファイル操作は Notebook contents REST API 経由で実行され、セルの実行は scripts/aidp_sql.py 経由で処理されます。
Create, edit, and execute AIDP notebooks and manage their kernel sessions. Use when the user wants to author a notebook, run cells/code on a cluster, attach/detach a kernel session, or build an interactive notebook (e.g. with widgets + Spark SQL + Plotly). Notebook FILE ops run via the Notebook contents REST API; CELL EXECUTION runs via scripts/aidp_sql.py.
aidp-notebooks — ノートブック作成 & カーネル実行Notebook contents REST API を通じて AIDP ノートブックを作成し、 バンドルされた SQL/セルヘルパーを使って Spark クラスター上でコードを実行します。 MCP サーバーは不要 — plugin は自己完結型です。
ノートブック内で外部 / 非レイクハウスのソース(Fusion、EPM、Essbase、Oracle ADB/ExaCS、Snowflake、S3、Kafka など)に接続する場合は、ここで手動接続を実装しないでください。 接続レシピには
oracle-ai-data-platform-workbench-spark-connectorsplugin のaidp-<source>skill を使用してください (例:aidp-fusion-rest/aidp-fusion-bicc、aidp-oracle-db、aidp-snowflake、aidp-object-storage)。 インストール確認(claude plugin list)を行い、未インストールの場合はユーザーにインストールを促してください。 その plugin が持つoracle_ai_data_platform_connectorsヘルパーパッケージは、aidp-connectors-bootstrapskill を通じて一度だけインストールされます (AIDP MCP 経由でパッケージを/Workspace/Sharedにプッシュし、サニティインポートを実行します。 MCP がインスタンスに到達できない場合は手動でアップロードしてください)。 この skill はノートブックの作成と実行のみを担います。複数ソースの結合についてはaidp-federateを参照してください。
.ipynb の作成 / 読み取り / リネーム / 保存、カーネルセッション管理)→
公式 aidp notebook … CLI(推奨)。利用できない場合は AIDP Notebook contents API への oci raw-request がフォールバックです。scripts/aidp_sql.py を使用します。これがカーネルセッションを作成し、WebSocket 経由でセルを実行します。
セルの実行は CLI コマンドではありません — 公式 aidp CLI/SDK のノートブックグループはファイルとセッションのみを扱い、セルを実行することはできません(ノートブックのエンドツーエンド実行はジョブベースです)。
インタラクティブな Spark-SQL は scripts/aidp_sql.py を使用します。2026-06-10 に de-agent 上でライブ検証済み:
scripts/aidp_sql.pyを経由した完全な WebSocket パス — ノートブックの自動作成、カーネルのアタッチ、セルの実行、/Workspace/Sharedでのリスト/削除 — がエンドツーエンドで動作することが確認されています。 一方、bare HTTP の…/notebook/api/contents/<path>による contents CRUD パスは、20240831インスタンス上のapi_keyraw-request において 500/404 が発生するため、ノートブックファイル操作には HTTP contents パスよりも WebSocket ヘルパーを優先してください(aidp-workspace-files参照)。
CLI(推奨): aidp notebook <command> …(Oracle サポート、バージョン管理あり —
references/aidp-cli-map.md 参照)。
aidp notebook create-content | get-content | update-content | modify-content | delete-content | export-contentsaidp notebook create-session | get-session | list-sessions | patch-session | delete-sessionフォールバック(oci raw-request — Notebook contents API):
CLI がインストールされていない、または対象の操作が CLI に公開されていない場合に使用します。
ベース URL(ホスト/バージョン/認証については references/oci-raw-request.md 参照):
…/20240831/dataLakes/<OCID>/workspaces/<WS>/notebook/api/contents/<url-encoded-path>
.ipynb)— PUT …/contents/<enc-path>、ボディ:
{"type":"notebook","format":"json","path":"<path>","content":{"cells":[…],"metadata":{},"nbformat":4,"nbformat_minor":5}}
(空のノートブックは "cells":[] を使用)GET …/contents/<enc-path>(?content=0 を追加するとメタデータのみ取得 / 存在確認)PATCH …/contents/<enc-path>、ボディ: {"path":"<new-path>"}DELETE …/contents/<enc-path>ノートブックのパスは URL エンコードしてください(例: Shared/my_nb.ipynb → Shared%2Fmy_nb.ipynb)。
認証には references/oci-raw-request.md の認証ラダーを使用してください(--profile DEFAULT の api_key を最初に試す)。
作成 / 更新 / 変更 / 削除(コンテンツ)、パッチ / 削除(セッション)などの変更操作では、
リクエストボディを .aidp/payloads/ に保存し、実行前に確認してください —
references/payloads.md 参照。
aidp_sql.py はこの plugin にバンドルされた唯一のヘルパーです。
api_key の DEFAULT プロファイルから UPST を生成し、必要に応じてスクラッチノートブックを自動作成し、
カーネルセッションを開き、WebSocket 経由でセルを実行し、JSON を返します。
AIDP_SESSION は不要です(--session-profile はオプション)。
python "$PLUGIN_DIR/scripts/aidp_sql.py" \
--region us-ashburn-1 --datalake <OCID> --workspace <WS> --cluster <cluster-key> \
--code "df = spark.sql('SELECT 1'); df.show()"
# optional: --notebook "Shared/_aidp_sql_scratch.ipynb" --profile DEFAULT \
# --session-profile AIDP_SESSION --timeout 180
返り値 JSON: {"status":"ok|error","execution_count":N,"outputs":[…],"spark_job_ids":[…],"error":{…}}
--code "spark.sql('…').show()"PUT でセルを書き戻すことで、結果を .ipynb に保存します。SELECT 1 セル(--code "spark.sql('SELECT 1').show()")。--profile DEFAULT。401/403 の場合は AIDP_SESSION にフォールバック —
references/oci-raw-request.md 参照)。aidp_sql.py は api_key の DEFAULT プロファイルから短命の UPST を自動生成します。
既存のセッショントークンを使用する場合のみ --session-profile AIDP_SESSION を渡してください。%run、oidlUtils、ターミナル)— ヘルパー経由でセル内で実行これらは セル 構造です — CLI ではなく scripts/aidp_sql.py --code "…" 経由で実行してください。
%run — 別のノートブックのコードをインライン実行:
%run /Workspace/folder/called.ipynb
呼び出し元のユーザープリンシパル + アタッチされたクラスターで即時実行され、
呼び出し先の関数/変数が呼び出し元で利用可能になります。oidlUtils.notebook.run/exit — ノートブック間の値の受け渡し:result = oidlUtils.notebook.run("NotebookB", timeout_seconds=0, parameters={"key": "value"}) # 呼び出し元
oidlUtils.notebook.exit(json.dumps(payload)) # 呼び出し先の返却
oidlUtils.notebook.exit(json.dumps(payload)) がタスク出力を設定します。
下流タスクは {{tasks.[name].…}} システムパラメーター(aidp-pipelines)または
jobs/runs/get-output API(response["notebook_output"]["result"])経由で読み取ります。! プレフィックス(例: !pip install …、!unzip …)または subprocess モジュールを使用します。
ノートブックスコープの !pip install は .ipynb 内でのみ機能し、そのノートブックとそのジョブタスクに適用されます。spark.stop() を絶対に呼び出さないでください。
AIDP はカーネルの Spark ライフサイクルを管理しており、spark.stop() を呼ぶとコンテキストが破壊され、
以降のすべてのセルが機能しなくなり、セッションの再起動が必要になります。どこでも使わないでください。%20 に URL エンコードします
(例: (85 groupBy + 33 slots) は 85%20groupBy… と表示されます)。
ダッシュで言い換えてください — -- 85 groupBy + 33 slots --。processNext() のような空括弧は問題ありません。--、→ の代わりに --> を使用し、Markdown セルに非 ASCII 文字は使用しないでください。fs.defaultFS は compute:///、FUSE ベース):
Path.resolve() を使用したり、ドライバーのローカル FS に書き込んだりしないでください — エグゼキューターからアクセスできません。compute:/// はサイズ 0 を報告します(getContentSummary().getLength() → 0)。
出力サイズを 計測 するには oci://<bucket>@<namespace>/… 経由で書き込み/読み取りを行ってください。
ワークスペース相対パスは読み書きには使えますが、サイズ計測には使えません。spark.sql.warehouse.dir からパスを導出しないでください — AIDP が管理する内部ストレージを指しています。/Workspace/(FUSE、断続的 + chmod 無効)ではなく /tmp/ 以下に置いてください。
ストリーミングチェックポイントは /Volumes/<catalog>/<schema>/<volume>/… 以下に置いてください。idle/busy 状態を確認し、
署名者パスの検証とエンドツーエンドの実行を切り分けてください。
busy 状態のままの古いセッションは再起動が必要なだけかもしれません(認証修正が失敗したと決めつけないでください)。
詳細なパフォーaidp-notebooks — notebook authoring & kernel executionAuthor AIDP notebooks via the Notebook contents REST API, and run code on a Spark cluster via the bundled SQL/cell helper. No MCP server is required — the plugin is self-contained.
Connecting to an external / non-lakehouse source in the notebook (Fusion, EPM, Essbase, Oracle ADB/ExaCS, Snowflake, S3, Kafka, …)? Do NOT hand-roll the connection here. Use the
oracle-ai-data-platform-workbench-spark-connectorsplugin'saidp-<source>skill for the connection recipe (e.g.aidp-fusion-rest/aidp-fusion-bicc,aidp-oracle-db,aidp-snowflake,aidp-object-storage). Check it's installed (claude plugin list); if not, tell the user to install it. Itsoracle_ai_data_platform_connectorshelper package is installed once via that plugin's ownaidp-connectors-bootstrapskill (it pushes the package to/Workspace/Sharedvia the AIDP MCP + runs a sanity import; if the MCP can't reach your instance, upload it manually). This skill then just authors + runs the notebook; for multi-source joins seeaidp-federate.
.ipynb, manage kernel sessions) →
the official aidp notebook … CLI (preferred); oci raw-request against the AIDP Notebook
contents API is the fallback.scripts/aidp_sql.py,
which creates the kernel session and runs the cell over the WebSocket for you. Cell execution is NOT
a CLI command — the official aidp CLI/SDK Notebook group is files + sessions only and cannot exec
cells (running a notebook end-to-end is job-based). Interactive Spark-SQL stays on scripts/aidp_sql.py.Live-verified 2026-06-10 on de-agent: the full WebSocket path via
scripts/aidp_sql.py— auto-create notebook, attach kernel, execute cells, and list/delete at/Workspace/Shared— is proven working end-to-end. The bare HTTP…/notebook/api/contents/<path>contents-CRUD path, by contrast, 500/404s forapi_keyraw-request on20240831instances, so prefer the WebSocket helper over the HTTP contents path for notebook file ops (seeaidp-workspace-files).
CLI (preferred): aidp notebook <command> … (Oracle-supported, versioned — see
references/aidp-cli-map.md).
aidp notebook create-content | get-content | update-content | modify-content | delete-content | export-contents.aidp notebook create-session | get-session | list-sessions | patch-session | delete-session.Fallback (oci raw-request — Notebook contents API) when the CLI isn't installed or doesn't expose
the op. Base (see references/oci-raw-request.md for host/version/auth):
…/20240831/dataLakes/<OCID>/workspaces/<WS>/notebook/api/contents/<url-encoded-path>
.ipynb — PUT …/contents/<enc-path> with body
{"type":"notebook","format":"json","path":"<path>","content":{"cells":[…],"metadata":{},"nbformat":4,"nbformat_minor":5}}
(an empty notebook uses "cells":[]).GET …/contents/<enc-path> (add ?content=0 to fetch metadata only / probe existence).PATCH …/contents/<enc-path> with body {"path":"<new-path>"}.DELETE …/contents/<enc-path>.URL-encode the notebook path (e.g. Shared/my_nb.ipynb → Shared%2Fmy_nb.ipynb). Use the auth ladder
in references/oci-raw-request.md (--profile DEFAULT api_key first).
For mutating ops (create/update/modify/delete content, patch/delete session), persist the request body to
.aidp/payloads/ and confirm first — see references/payloads.md.
aidp_sql.py is the plugin's one bundled helper. It mints a UPST from the api_key DEFAULT profile,
auto-creates a scratch notebook if needed, opens the kernel session, runs the cell over the WebSocket,
and returns JSON. No AIDP_SESSION required (--session-profile is optional).
python "$PLUGIN_DIR/scripts/aidp_sql.py" \
--region us-ashburn-1 --datalake <OCID> --workspace <WS> --cluster <cluster-key> \
--code "df = spark.sql('SELECT 1'); df.show()"
# optional: --notebook "Shared/_aidp_sql_scratch.ipynb" --profile DEFAULT \
# --session-profile AIDP_SESSION --timeout 180
Returns JSON: {"status":"ok|error","execution_count":N,"outputs":[…],"spark_job_ids":[…],"error":{…}}.
--code "spark.sql('…').show()"..ipynb by writing the cells back via the contents PUT above.SELECT 1 cell (--code "spark.sql('SELECT 1').show()").--profile DEFAULT; on 401/403 fall back to
AIDP_SESSION — see references/oci-raw-request.md).aidp_sql.py mints a short-lived UPST from
the api_key DEFAULT profile automatically; pass --session-profile AIDP_SESSION only if you want to
use an existing session token instead.%run, oidlUtils, terminal) — runs inside a cell via the helperThese are cell constructs — run them through scripts/aidp_sql.py --code "…", not the CLI.
%run — inline another notebook's code: %run /Workspace/folder/called.ipynb. Runs immediately with
the caller's user principal + attached cluster; the callee's functions/variables become available in
the caller.oidlUtils.notebook.run/exit — value passing between notebooks:result = oidlUtils.notebook.run("NotebookB", timeout_seconds=0, parameters={"key": "value"}) # caller
oidlUtils.notebook.exit(json.dumps(payload)) # callee returns
oidlUtils.notebook.exit(json.dumps(payload)) sets the task
output; downstream tasks read it via {{tasks.[name].…}} system params (aidp-pipelines) or the
jobs/runs/get-output API (response["notebook_output"]["result"]).! (e.g. !pip install …, !unzip …) or use the subprocess module.
Notebook-scoped !pip install works only in .ipynb and applies to that notebook + its job tasks.spark.stop() in an AIDP notebook. AIDP manages the kernel's Spark lifecycle; spark.stop()
kills the context, breaks every later cell, and forces a session restart. Omit it everywhere.%20 (e.g. (85 groupBy + 33 slots)
renders as 85%20groupBy…). Rephrase with dashes — -- 85 groupBy + 33 slots --. Empty parens like
processNext() are fine.-- not an em-dash, --> not →; avoid non-ASCII characters in markdown cells.fs.defaultFS is compute:///, FUSE-backed):
Path.resolve() / write to the driver's local FS for distributed output — executors can't reach it.compute:/// reports size 0 (getContentSummary().getLength() → 0); to measure output size, write/read
via oci://<bucket>@<namespace>/… instead. Workspace-relative paths work for read/write but not sizing.spark.sql.warehouse.dir — it points at AIDP-managed internal storage./tmp/, not /Workspace/ (FUSE, intermittent + chmod no-op); streaming
checkpoints under /Volumes/<catalog>/<schema>/<volume>/….idle/busy, and isolate signer-path validation from end-to-end exec. A stale
busy session may just need a restart (don't assume the auth fix failed). For deep perf tuning see
aidp-spark-optimization; for failure triage see aidp-spark-debugging.Spark Structured Streaming runs as cell code via scripts/aidp_sql.py --code "…" (cluster RUNNING).
Canonical Delta pattern (platform-ref §21, lines 937–946):
# Read stream — table source/sink is Delta format only (3-part name)
streaming_df = spark.readStream.format("delta").table("catalog.schema.deltatable")
# Write stream
streaming_df.writeStream.format("delta") \
.outputMode("append") \
.option("checkpointLocation", "/Volumes/checkpoints1/") \
.toTable("catalog.schema.deltatable")
/Volume/…, recommended) or workspace path; OCI Object Storage
(oci://) is not supported as a checkpoint location (platform-ref §21, lines 930–933, 927).oci:// and Oracle ALH/ATP/AI DB are not supported for streaming
(platform-ref §21, lines 918–928).aidp-pipelines (platform-ref §21, lines 948–954)..show(n) / LIMIT to protect context.status:ok) before
assuming output.GET …/contents/<path>?content=0 first; only PUT an empty notebook if it 404s.aidp CLI command map (primary engine)scripts/aidp_sql.py — the bundled cell/SQL executoraidp-analyzing-data, aidp-ai-sql, aidp-pipelines原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。