name: jupyter-notebook-executor description: 用于以编程方式运行Jupyter笔记本、参数化输入并提取输出以支持机器学习工作流的技能。 allowed-tools:
- Read
- Write
- Bash
- Glob
- Grep
jupyter-notebook-executor
概述
用于以编程方式运行Jupyter笔记本、参数化输入并提取输出以支持机器学习工作流的技能。
能力
- 参数化笔记本执行
- 输出提取与验证
- 笔记本格式转换(转为HTML/PDF)
- 单元格执行控制
- 错误处理与报告
- 环境管理
- 内核指定
- 超时管理
目标流程
- 探索性数据分析(EDA)流程
- 模型可解释性与可说明性分析
- 实验规划与假设检验
工具与库
- papermill
- nbconvert
- jupyter
- nbformat
输入模式
{
"type": "object",
"required": ["action", "notebookPath"],
"properties": {
"action": {
"type": "string",
"enum": ["execute", "convert", "extract", "validate"],
"description": "对笔记本执行的操作"
},
"notebookPath": {
"type": "string",
"description": "Jupyter笔记本的路径"
},
"executeConfig": {
"type": "object",
"properties": {
"parameters": { "type": "object" },
"outputPath": { "type": "string" },
"kernel": { "type": "string" },
"timeout": { "type": "integer" },
"cwd": { "type": "string" }
}
},
"convertConfig": {
"type": "object",
"properties": {
"format": { "type": "string", "enum": ["html", "pdf", "markdown", "script"] },
"outputPath": { "type": "string" },
"template": { "type": "string" },
"excludeInput": { "type": "boolean" },
"excludeOutput": { "type": "boolean" }
}
},
"extractConfig": {
"type": "object",
"properties": {
"cellTags": { "type": "array", "items": { "type": "string" } },
"outputTypes": { "type": "array", "items": { "type": "string" } },
"variableNames": { "type": "array", "items": { "type": "string" } }
}
}
}
}
输出模式
{
"type": "object",
"required": ["status", "action"],
"properties": {
"status": {
"type": "string",
"enum": ["success", "error", "timeout"]
},
"action": {
"type": "string"
},
"executionResult": {
"type": "object",
"properties": {
"outputPath": { "type": "string" },
"executionTime": { "type": "number" },
"cellsExecuted": { "type": "integer" },
"errors": { "type": "array" }
}
},
"conversionResult": {
"type": "object",
"properties": {
"outputPath": { "type": "string" },
"format": { "type": "string" }
}
},
"extractedData": {
"type": "object",
"properties": {
"variables": { "type": "object" },
"outputs": { "type": "array" },
"figures": { "type": "array", "items": { "type": "string" } }
}
}
}
}
使用示例
{
kind: 'skill',
title: '使用参数执行EDA笔记本',
skill: {
name: 'jupyter-notebook-executor',
context: {
action: 'execute',
notebookPath: 'notebooks/eda_template.ipynb',
executeConfig: {
parameters: {
data_path: 'data/train.csv',
output_dir: 'results/eda/',
sample_size: 10000
},
outputPath: 'notebooks/eda_results.ipynb',
kernel: 'python3',
timeout: 3600
}
}
}
}