关于
This skill executes code in a secure sandbox environment when users request to run, execute, or evaluate code snippets. It supports multiple languages including Python, JavaScript, R, and Java through the AgentBay SDK's run_code function. Developers should use it for any code execution tasks like running scripts, plotting graphs, or checking output results.
快速安装
Claude Code
推荐npx skills add agentbay-ai/agentbay-skills -a claude-code/plugin add https://github.com/agentbay-ai/agentbay-skillsgit clone https://github.com/agentbay-ai/agentbay-skills.git ~/.claude/skills/agentbay-aio-skills在 Claude Code 中复制并粘贴此命令以安装该技能
技能文档
AgentBay AIO 技能
触发条件:何时使用本技能
当用户意图运行或执行代码时即应使用本技能,即使用户没有说「沙箱」。典型表述(遇到即触发):
- 英文:run this code、execute this script、run the code、execute the script、plot with Python、draw a graph、evaluate this snippet、what's the output of this code、can you run this
- 中文:帮我跑一下这段代码、运行这段代码、执行这个脚本、用 Python 画个图、跑一下、看下运行结果、执行一下、帮我运行
依赖与环境
本技能依赖 wuying-agentbay-sdk 包。
最佳实践(Agent 必读):
为避免污染用户当前项目的环境,请务必使用技能目录下的独立虚拟环境:
-
检查/创建虚拟环境:
# 检查是否存在 .venv,不存在则创建 if [ ! -d ".venv" ]; then python3 -m venv .venv; fi -
激活并安装依赖(仅首次或缺失时安装,使用阿里云镜像):
source .venv/bin/activate pip show wuying-agentbay-sdk >/dev/null 2>&1 || pip install wuying-agentbay-sdk -i https://mirrors.aliyun.com/pypi/simple/ -
运行脚本(在虚拟环境中):
# 确保在 venv 下运行 python scripts/run_code.py --code "..." --language python
(若用户明确要求在全局环境运行,或当前已在特定环境中,可跳过创建 venv,但仍建议使用镜像源安装。)
API Key(仅报错时引导)
默认先直接执行脚本,不要每次运行前都提醒用户配置 API Key。 仅当脚本报错「Missing API key」或类似信息时,再引导用户配置:
- 到 AgentBay 控制台 申请 API Key。
- 在本地创建配置文件(脚本会从该路径读取):
- macOS / Linux:
~/.config/agentbay/api_key(或$XDG_CONFIG_HOME/agentbay/api_key) - Windows:
%USERPROFILE%\.config\agentbay\api_key
- macOS / Linux:
- 示例(macOS/Linux):
mkdir -p ~/.config/agentbay,再将密钥写入~/.config/agentbay/api_key。Windows:在%USERPROFILE%\.config\agentbay下创建名为api_key的无扩展名文件。 - 告知用户完成后重试,不要只复述报错。
使用场景
所有代码执行类请求均默认使用本技能。 只要用户要求运行代码、执行脚本、评估片段或查看代码输出(Python、JavaScript、R 或 Java),即使用本技能——即使用户未提「沙箱」。使用 code_latest 创建 AgentBay 沙箱,通过 run_code 执行代码并返回结果。在本技能可用时,不要在本地终端执行用户代码;应使用沙箱以保证隔离与行为一致。
概述
使用 AgentBay SDK 以 code_latest 镜像创建会话,在沙箱中通过 run_code 执行代码,解析 EnhancedCodeExecutionResult,并销毁会话。
执行方式(Agent 必读)
请通过本技能自带的脚本执行用户代码 在技能目录下执行:
python scripts/run_code.py --code "用户要执行的代码" --language python
从文件执行:
python scripts/run_code.py --code-file /path/to/file.py --language python
需要结构化输出时加 --json。脚本会从配置文件或环境变量读取 API Key,创建沙箱、执行并返回结果。
(若用户在自己的 Python 项目中集成 AgentBay,可参考 wuying-agentbay-sdk 的同步/异步用法;Agent 执行本技能时仅需调用上述脚本。)
脚本输出
- 成功:脚本 exit code 0,结果在 stdout(或加
--json时输出 JSON:success、result、logs、error_message)。 - 失败:exit code 非 0,错误信息在 stderr;根据输出提示用户(如缺 API Key 则按「API Key(仅报错时引导)」处理)。
重要约束
language支持:python、javascript、r、java(不区分大小写)。- 单次执行超时 60 秒(可用
--timeout-s指定,不超过 60)。
GitHub 仓库
Frequently asked questions
What is the agentbay-aio-skills skill?
agentbay-aio-skills is a Claude Skill by agentbay-ai. Skills package instructions and resources that Claude loads on demand, so Claude can perform agentbay-aio-skills-related tasks without extra prompting.
How do I install agentbay-aio-skills?
Use the install commands on this page: add agentbay-aio-skills to Claude Code as a plugin, or clone its repository into your skills directory, then restart Claude so it picks up the skill.
What category does agentbay-aio-skills belong to?
agentbay-aio-skills is in the Meta category, tagged ai and testing.
Is agentbay-aio-skills free to use?
Yes. agentbay-aio-skills is listed on AIMCP and free to install. It runs inside Claude, so no separate service account is required to use the skill itself.
相关推荐技能
Content Collections 是一个 TypeScript 优先的构建工具,可将本地 Markdown/MDX 文件转换为类型安全的数据集合。它专为构建博客、文档站和内容密集型 Vite+React 应用而设计,提供基于 Zod 的自动模式验证。该工具涵盖从 Vite 插件配置、MDX 编译到生产环境部署的完整工作流。
这个Claude Skill为开发者提供完整的Polymarket预测市场开发支持,涵盖API调用、交易执行和市场数据分析。关键特性包括实时WebSocket数据流,可监控实时交易、订单和市场动态。开发者可用它构建预测市场应用、实施交易策略并集成实时市场预测功能。
该Skill帮助开发者创建OpenCode插件,用于接入命令、文件、LSP等25+种事件。它提供了插件结构、事件API规范和JavaScript/TypeScript实现模式,适合需要拦截操作、扩展功能或自定义事件处理的场景。开发者可通过它快速构建响应式模块来增强OpenCode AI助手的能力。
SGLang是一个专为LLM设计的高性能推理框架,特别适用于需要结构化输出的场景。它通过RadixAttention前缀缓存技术,在处理JSON、正则表达式、工具调用等具有重复前缀的复杂工作流时,能实现极速生成。如果你正在构建智能体或多轮对话系统,并追求远超vLLM的推理性能,SGLang是理想选择。
