UNPKG

agentsphere-js

Version:

云端代码沙箱 SDK - 为 AI agents 提供安全的代码执行环境

51 lines (31 loc) 1.04 kB
# agentsphere-js 云端代码沙箱 SDK - 为 AI agents 提供安全的代码执行环境 ## 简介 这是一个强大的云端代码执行平台 SDK,专为 AI agents 和自动化系统设计。提供安全隔离的沙箱环境,支持在云端运行各种编程语言的代码。 ## 安装 ```bash npm install agentsphere-js ``` ## 快速开始 ### 1. 获取 API 密钥 ### 2. Get your agentsphere API key 1. Sign up to agentsphere [here](https://www.agentsphere.run). 2. Get your API key [here](https://www.agentsphere.run/apikey). 3. Set environment variable with your API key. ``` AS_API_KEY=ac_*** ``` ```bash SANDBOX_API_KEY=your_api_key_here ``` ### 2. 使用代码解释器 ## API 文档 ### 核心方法 ```typescript import { Sandbox } from 'agentsphere' const sandbox = await Sandbox.create() await sbx.runCode('x = 1') const execution = await sbx.runCode('x+=1; x') console.log(execution.text) // outputs 2 ``` **开始使用云端沙箱,让您的应用拥有安全的代码执行能力!** 🚀