创建环境不会开沙盒。沙盒在引用它的会话第一次运行时才创建。
创建环境
string
必填
环境名称。
object
沙盒模板。
curl
绑定到会话
curl
其它操作
错误码
下一步
会话
创建长期会话并追加事件
管理专家
用 API 创建和发布专家
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
/v1/environments — 定义可复用的沙盒运行时、模板与依赖
POST https://api.profy.cn/v1/environments
显示 template 字段
curl -X POST https://api.profy.cn/v1/environments \
-H "Authorization: Bearer sk-pro-your-key" \
-H "Content-Type: application/json" \
-d '{
"name": "报关处理环境",
"template": {
"runtime": "python",
"dependencies": ["pandas", "openpyxl"],
"resource_limits": { "timeout_seconds": 600 }
}
}'
{
"code": 0,
"data": {
"id": "env_abc",
"name": "报关处理环境",
"template": { "runtime": "python", "dependencies": ["pandas", "openpyxl"] },
"created_at": "...",
"updated_at": "..."
}
}
curl -X POST https://api.profy.cn/v1/sessions \
-H "Authorization: Bearer sk-pro-your-key" \
-H "Content-Type: application/json" \
-d '{"agent": "my-expert", "environment_id": "env_abc"}'
| 方法 | 路径 | 说明 |
|---|---|---|
GET | /v1/environments?limit= | 列出你的环境,最多 100 条 |
GET | /v1/environments/{id} | 环境详情 |
PATCH | /v1/environments/{id} | 改名或改模板 |
DELETE | /v1/environments/{id} | 软删除,正在运行的沙盒不受影响 |
| HTTP 状态码 | 说明 |
|---|---|
400 | 缺少 name,或 template 字段非法(runtime 取值、依赖数量等) |
401 | 认证失败 |
404 | 环境不存在或不属于你 |
