RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
Translate Chinese text to English in agent/sandbox (#13356)
Copilot33ba955b02a7
diff --git a/agent/sandbox/providers/aliyun_codeinterpreter.py b/agent/sandbox/providers/aliyun_codeinterpreter.pyindex 56e66977a3..8d9eba691e 100644--- a/agent/sandbox/providers/aliyun_codeinterpreter.py+++ b/agent/sandbox/providers/aliyun_codeinterpreter.py@@ -68,7 +68,7 @@ class AliyunCodeInterpreterProvider(SandboxProvider):config: Configuration dictionary with keys:- access_key_id: Aliyun AccessKey ID- access_key_secret: Aliyun AccessKey Secret- - account_id: Aliyun primary account ID (主账号ID)+ - account_id: Aliyun primary account ID- region: Region (default: "cn-hangzhou")- template_name: Optional sandbox template name- timeout: Request timeout in seconds (default: 30, max 30)@@ -97,7 +97,7 @@ class AliyunCodeInterpreterProvider(SandboxProvider):return Falseif not self.account_id:- logger.error("Aliyun Code Interpreter: Missing account_id (主账号ID)")+ logger.error("Aliyun Code Interpreter: Missing account_id (primary account ID)")return False# Create SDK configuration@@ -429,7 +429,7 @@ console.log(typeof result === 'object' ? JSON.stringify(result) : String(result)"required": True,"label": "Account ID","placeholder": "1234567890...",- "description": "Aliyun primary account ID (主账号ID), required for API calls",+ "description": "Aliyun primary account ID, required for API calls",},"region": {"type": "string",diff --git a/agent/sandbox/sandbox_spec.md b/agent/sandbox/sandbox_spec.mdindex 56e832aaef..5b35fa548b 100644--- a/agent/sandbox/sandbox_spec.md+++ b/agent/sandbox/sandbox_spec.md@@ -654,7 +654,7 @@ class AliyunCodeInterpreterProvider(SandboxProvider):"type": "string","required": True,"label": "Account ID",- "description": "Aliyun primary account ID (主账号ID), required for API calls"+ "description": "Aliyun primary account ID, required for API calls"},"region": {"type": "string",diff --git a/agent/sandbox/tests/MIGRATION_GUIDE.md b/agent/sandbox/tests/MIGRATION_GUIDE.mdindex 93bb27ba87..bdc4f7d61d 100644--- a/agent/sandbox/tests/MIGRATION_GUIDE.md+++ b/agent/sandbox/tests/MIGRATION_GUIDE.md@@ -1,53 +1,53 @@-# Aliyun Code Interpreter Provider - 使用官方 SDK+# Aliyun Code Interpreter Provider - Using the Official SDK-## 重要变更+## Important Changes-### 官方资源+### Official Resources- **Code Interpreter API**: https://help.aliyun.com/zh/functioncompute/fc/sandbox-sandbox-code-interepreter-- **官方 SDK**: https://github.com/Serverless-Devs/agentrun-sdk-python-- **SDK 文档**: https://docs.agent.run+- **Official SDK**: https://github.com/Serverless-Devs/agentrun-sdk-python+- **SDK Documentation**: https://docs.agent.run-## 使用官方 SDK 的优势+## Advantages of Using the Official SDK-从手动 HTTP 请求迁移到官方 SDK (`agentrun-sdk`) 有以下优势:+Migrating from manual HTTP requests to the official SDK (`agentrun-sdk`) offers the following benefits:-### 1. **自动签名认证**-- SDK 自动处理 Aliyun API 签名(无需手动实现 `Authorization` 头)-- 支持多种认证方式:AccessKey、STS Token-- 自动读取环境变量+### 1. **Automatic Signature Authentication**+- The SDK automatically handles Aliyun API signing (no need to manually implement `Authorization` headers)+- Supports multiple authentication methods: AccessKey, STS Token+- Automatically reads environment variables-### 2. **简化的 API**+### 2. **Simplified API**```python-# 旧实现(手动 HTTP 请求)+# Old implementation (manual HTTP requests)response = requests.post(f"{DATA_ENDPOINT}/sandboxes/{sandbox_id}/execute",headers={"X-Acs-Parent-Id": account_id},json={"code": code, "language": "python"})-# 新实现(使用 SDK)+# New implementation (using SDK)sandbox = CodeInterpreterSandbox(template_name="python-sandbox", config=config)result = sandbox.context.execute(code="print('hello')")```-### 3. **更好的错误处理**-- 结构化的异常类型 (`ServerError`)-- 自动重试机制-- 详细的错误信息+### 3. **Better Error Handling**+- Structured exception types (`ServerError`)+- Automatic retry mechanism+- Detailed error messages-## 主要变更+## Key Changes-### 1. 文件重命名+### 1. File Renames-| 旧文件名 | 新文件名 | 说明 |+| Old Filename | New Filename | Description ||---------|---------|------|-| `aliyun_opensandbox.py` | `aliyun_codeinterpreter.py` | 提供商实现 |-| `test_aliyun_provider.py` | `test_aliyun_codeinterpreter.py` | 单元测试 |-| `test_aliyun_integration.py` | `test_aliyun_codeinterpreter_integration.py` | 集成测试 |+| `aliyun_opensandbox.py` | `aliyun_codeinterpreter.py` | Provider implementation |+| `test_aliyun_provider.py` | `test_aliyun_codeinterpreter.py` | Unit tests |+| `test_aliyun_integration.py` | `test_aliyun_codeinterpreter_integration.py` | Integration tests |-### 2. 配置字段变更+### 2. Configuration Field Changes-#### 旧配置(OpenSandbox)+#### Old Configuration (OpenSandbox)```json{"access_key_id": "LTAI5t...",@@ -57,59 +57,59 @@ result = sandbox.context.execute(code="print('hello')")}```-#### 新配置(Code Interpreter)+#### New Configuration (Code Interpreter)```json{"access_key_id": "LTAI5t...","access_key_secret": "...",- "account_id": "1234567890...", // 新增:阿里云主账号ID(必需)+ "account_id": "1234567890...", // New: Aliyun primary account ID (required)"region": "cn-hangzhou",- "template_name": "python-sandbox", // 新增:沙箱模板名称- "timeout": 30 // 最大 30 秒(硬限制)+ "template_name": "python-sandbox", // New: sandbox template name+ "timeout": 30 // Max 30 seconds (hard limit)}```-### 3. 关键差异+### 3. Key Differences-| 特性 | OpenSandbox | Code Interpreter |+| Feature | OpenSandbox | Code Interpreter ||------|-------------|-----------------|-| **API 端点** | `opensandbox.{region}.aliyuncs.com` | `agentrun.{region}.aliyuncs.com` (控制面) |-| **API 版本** | `2024-01-01` | `2025-09-10` |-| **认证** | 需要 AccessKey | 需要 AccessKey + 主账号ID |-| **请求头** | 标准签名 | 需要 `X-Acs-Parent-Id` 头 |-| **超时限制** | 可配置 | **最大 30 秒**(硬限制) |-| **上下文** | 不支持 | 支持上下文(Jupyter kernel) |+| **API Endpoint** | `opensandbox.{region}.aliyuncs.com` | `agentrun.{region}.aliyuncs.com` (control plane) |+| **API Version** | `2024-01-01` | `2025-09-10` |+| **Authentication** | AccessKey required | AccessKey + primary account ID required |+| **Request Headers** | Standard signature | Requires `X-Acs-Parent-Id` header |+| **Timeout Limit** | Configurable | **Max 30 seconds** (hard limit) |+| **Context** | Not supported | Supports context (Jupyter kernel) |-### 4. API 调用方式变更+### 4. API Call Changes-#### 旧实现(假设的 OpenSandbox)+#### Old Implementation (assumed OpenSandbox)```python-# 单一端点+# Single endpointAPI_ENDPOINT = "https://opensandbox.cn-hangzhou.aliyuncs.com"-# 简单的请求/响应+# Simple request/responseresponse = requests.post(f"{API_ENDPOINT}/execute",json={"code": "print('hello')", "language": "python"})```-#### 新实现(Code Interpreter)+#### New Implementation (Code Interpreter)```python-# 控制面 API - 管理沙箱生命周期+# Control plane API - manage sandbox lifecycleCONTROL_ENDPOINT = "https://agentrun.cn-hangzhou.aliyuncs.com/2025-09-10"-# 数据面 API - 执行代码+# Data plane API - execute codeDATA_ENDPOINT = "https://{account_id}.agentrun-data.cn-hangzhou.aliyuncs.com"-# 创建沙箱(控制面)+# Create sandbox (control plane)response = requests.post(f"{CONTROL_ENDPOINT}/sandboxes",headers={"X-Acs-Parent-Id": account_id},json={"templateName": "python-sandbox"})-# 执行代码(数据面)+# Execute code (data plane)response = requests.post(f"{DATA_ENDPOINT}/sandboxes/{sandbox_id}/execute",headers={"X-Acs-Parent-Id": account_id},@@ -117,13 +117,13 @@ response = requests.post()```-### 5. 迁移步骤+### 5. Migration Steps-#### 步骤 1: 更新配置+#### Step 1: Update Configuration-如果您之前使用的是 `aliyun_opensandbox`:+If you were previously using `aliyun_opensandbox`:-**旧配置**:+**Old configuration**:```json{"name": "sandbox.provider_type",@@ -131,7 +131,7 @@ response = requests.post(}```-**新配置**:+**New configuration**:```json{"name": "sandbox.provider_type",@@ -139,123 +139,123 @@ response = requests.post(}```-#### 步骤 2: 添加必需的 account_id+#### Step 2: Add the Required account_id-在 Aliyun 控制台右上角点击头像,获取主账号 ID:-1. 登录 [阿里云控制台](https://ram.console.aliyun.com/manage/ak)-2. 点击右上角头像-3. 复制主账号 ID(16 位数字)+Get your primary account ID from the Aliyun console:+1. Log in to the [Aliyun Console](https://ram.console.aliyun.com/manage/ak)+2. Click on your avatar in the top-right corner+3. Copy the primary account ID (16-digit number)-#### 步骤 3: 更新环境变量+#### Step 3: Update Environment Variables```bash-# 新增必需的环境变量+# New required environment variableexport ALIYUN_ACCOUNT_ID="1234567890123456"-# 其他环境变量保持不变+# Other environment variables remain unchangedexport ALIYUN_ACCESS_KEY_ID="LTAI5t..."export ALIYUN_ACCESS_KEY_SECRET="..."export ALIYUN_REGION="cn-hangzhou"```-#### 步骤 4: 运行测试+#### Step 4: Run Tests```bash-# 单元测试(不需要真实凭据)+# Unit tests (no real credentials required)pytest agent/sandbox/tests/test_aliyun_codeinterpreter.py -v-# 集成测试(需要真实凭据)+# Integration tests (real credentials required)pytest agent/sandbox/tests/test_aliyun_codeinterpreter_integration.py -v -m integration```-## 文件变更清单+## File Change Checklist-### ✅ 已完成+### ✅ Completed-- [x] 创建 `aliyun_codeinterpreter.py` - 新的提供商实现-- [x] 更新 `sandbox_spec.md` - 规范文档-- [x] 更新 `admin/services.py` - 服务管理器-- [x] 更新 `providers/__init__.py` - 包导出-- [x] 创建 `test_aliyun_codeinterpreter.py` - 单元测试-- [x] 创建 `test_aliyun_codeinterpreter_integration.py` - 集成测试+- [x] Created `aliyun_codeinterpreter.py` - new provider implementation+- [x] Updated `sandbox_spec.md` - specification document+- [x] Updated `admin/services.py` - service manager+- [x] Updated `providers/__init__.py` - package exports+- [x] Created `test_aliyun_codeinterpreter.py` - unit tests+- [x] Created `test_aliyun_codeinterpreter_integration.py` - integration tests-### 📝 可选清理+### 📝 Optional Cleanup-如果您想删除旧的 OpenSandbox 实现:+If you want to remove the old OpenSandbox implementation:```bash-# 删除旧文件(可选)+# Remove old files (optional)rm agent/sandbox/providers/aliyun_opensandbox.pyrm agent/sandbox/tests/test_aliyun_provider.pyrm agent/sandbox/tests/test_aliyun_integration.py```-**注意**: 保留旧文件不会影响新功能,只是代码冗余。+**Note**: Keeping the old files does not affect the new functionality; it just results in redundant code.-## API 参考+## API Reference-### 控制面 API(沙箱管理)+### Control Plane API (Sandbox Management)-| 端点 | 方法 | 说明 |+| Endpoint | Method | Description ||------|------|------|-| `/sandboxes` | POST | 创建沙箱实例 |-| `/sandboxes/{id}/stop` | POST | 停止实例 |-| `/sandboxes/{id}` | DELETE | 删除实例 |-| `/templates` | GET | 列出模板 |+| `/sandboxes` | POST | Create a sandbox instance |+| `/sandboxes/{id}/stop` | POST | Stop an instance |+| `/sandboxes/{id}` | DELETE | Delete an instance |+| `/templates` | GET | List templates |-### 数据面 API(代码执行)+### Data Plane API (Code Execution)-| 端点 | 方法 | 说明 |+| Endpoint | Method | Description ||------|------|------|-| `/sandboxes/{id}/execute` | POST | 执行代码(简化版) |-| `/sandboxes/{id}/contexts` | POST | 创建上下文 |-| `/sandboxes/{id}/contexts/{ctx_id}/execute` | POST | 在上下文中执行 |-| `/sandboxes/{id}/health` | GET | 健康检查 |-| `/sandboxes/{id}/files` | GET/POST | 文件读写 |-| `/sandboxes/{id}/processes/cmd` | POST | 执行 Shell 命令 |+| `/sandboxes/{id}/execute` | POST | Execute code (simplified) |+| `/sandboxes/{id}/contexts` | POST | Create a context |+| `/sandboxes/{id}/contexts/{ctx_id}/execute` | POST | Execute within a context |+| `/sandboxes/{id}/health` | GET | Health check |+| `/sandboxes/{id}/files` | GET/POST | File read/write |+| `/sandboxes/{id}/processes/cmd` | POST | Execute shell command |-## 常见问题+## FAQ-### Q: 为什么要添加 account_id?+### Q: Why is account_id required?-**A**: Code Interpreter API 需要在请求头中提供 `X-Acs-Parent-Id`(阿里云主账号ID)进行身份验证。这是 Aliyun Code Interpreter API 的必需参数。+**A**: The Code Interpreter API requires the `X-Acs-Parent-Id` (Aliyun primary account ID) header for authentication. This is a required parameter for the Aliyun Code Interpreter API.-### Q: 30 秒超时限制可以绕过吗?+### Q: Can the 30-second timeout limit be bypassed?-**A**: 不可以。这是 Aliyun Code Interpreter 的**硬限制**,无法通过配置或请求参数绕过。如果代码执行时间超过 30 秒,请考虑:-1. 优化代码逻辑-2. 分批处理数据-3. 使用上下文保持状态+**A**: No. This is a **hard limit** of Aliyun Code Interpreter and cannot be bypassed through configuration or request parameters. If your code execution exceeds 30 seconds, consider:+1. Optimizing the code logic+2. Processing data in batches+3. Using contexts to maintain state-### Q: 旧的 OpenSandbox 配置还能用吗?+### Q: Can the old OpenSandbox configuration still be used?-**A**: 不能。OpenSandbox 和 Code Interpreter 是两个不同的服务,API 不兼容。必须迁移到新的配置格式。+**A**: No. OpenSandbox and Code Interpreter are two different services with incompatible APIs. You must migrate to the new configuration format.-### Q: 如何获取阿里云主账号 ID?+### Q: How do I get the Aliyun primary account ID?**A**:-1. 登录阿里云控制台-2. 点击右上角的头像-3. 在弹出的信息中可以看到"主账号ID"+1. Log in to the Aliyun console+2. Click on your avatar in the top-right corner+3. The primary account ID will be displayed in the popup-### Q: 迁移后会影响现有功能吗?+### Q: Will the migration affect existing functionality?**A**:-- **自我管理提供商(self_managed)**: 不受影响-- **E2B 提供商**: 不受影响-- **Aliyun 提供商**: 需要更新配置并重新测试+- **Self-managed provider (self_managed)**: Not affected+- **E2B provider**: Not affected+- **Aliyun provider**: Configuration update and re-testing required-## 相关文档+## Related Documentation-- [官方文档](https://help.aliyun.com/zh/functioncompute/fc/sandbox-sandbox-code-interepreter)-- [sandbox 规范](../docs/develop/sandbox_spec.md)-- [测试指南](./README.md)-- [快速开始](./QUICKSTART.md)+- [Official Documentation](https://help.aliyun.com/zh/functioncompute/fc/sandbox-sandbox-code-interepreter)+- [Sandbox Specification](../docs/develop/sandbox_spec.md)+- [Testing Guide](./README.md)+- [Quick Start](./QUICKSTART.md)-## 技术支持+## Support-如有问题,请:-1. 查看官方文档-2. 检查配置是否正确-3. 查看测试输出中的错误信息-4. 联系 RAGFlow 团队+If you have any issues:+1. Review the official documentation+2. Verify the configuration is correct+3. Check the error messages in the test output+4. Contact the RAGFlow teamdiff --git a/agent/sandbox/tests/QUICKSTART.md b/agent/sandbox/tests/QUICKSTART.mdindex 51a23eeae1..81cf3f8790 100644--- a/agent/sandbox/tests/QUICKSTART.md+++ b/agent/sandbox/tests/QUICKSTART.md@@ -1,45 +1,45 @@-# Aliyun OpenSandbox Provider - 快速测试指南+# Aliyun OpenSandbox Provider - Quick Test Guide-## 测试说明+## Test Overview-### 1. 单元测试(不需要真实凭据)+### 1. Unit Tests (No Credentials Required)-单元测试使用 mock,**不需要**真实的 Aliyun 凭据,可以随时运行。+Unit tests use mocks and do **not** require real Aliyun credentials; they can be run at any time.```bash-# 运行 Aliyun 提供商的单元测试+# Run unit tests for the Aliyun providerpytest agent/sandbox/tests/test_aliyun_provider.py -v-# 预期输出:+# Expected output:# test_aliyun_provider.py::TestAliyunOpenSandboxProvider::test_provider_initialization PASSED# test_aliyun_provider.py::TestAliyunOpenSandboxProvider::test_initialize_success PASSED# ...# ========================= 48 passed in 2.34s ==========================```-### 2. 集成测试(需要真实凭据)+### 2. Integration Tests (Real Credentials Required)-集成测试会调用真实的 Aliyun API,需要配置凭据。+Integration tests call the real Aliyun API and require credentials to be configured.-#### 步骤 1: 配置环境变量+#### Step 1: Configure Environment Variables```bash-export ALIYUN_ACCESS_KEY_ID="LTAI5t..." # 替换为真实的 Access Key ID-export ALIYUN_ACCESS_KEY_SECRET="..." # 替换为真实的 Access Key Secret-export ALIYUN_REGION="cn-hangzhou" # 可选,默认为 cn-hangzhou+export ALIYUN_ACCESS_KEY_ID="LTAI5t..." # Replace with your real Access Key ID+export ALIYUN_ACCESS_KEY_SECRET="..." # Replace with your real Access Key Secret+export ALIYUN_REGION="cn-hangzhou" # Optional, defaults to cn-hangzhou```-#### 步骤 2: 运行集成测试+#### Step 2: Run Integration Tests```bash-# 运行所有集成测试+# Run all integration testspytest agent/sandbox/tests/test_aliyun_integration.py -v -m integration-# 运行特定测试+# Run a specific testpytest agent/sandbox/tests/test_aliyun_integration.py::TestAliyunOpenSandboxIntegration::test_health_check -v```-#### 步骤 3: 预期输出+#### Step 3: Expected Output```test_aliyun_integration.py::TestAliyunOpenSandboxIntegration::test_initialize_provider PASSED@@ -49,130 +49,130 @@ test_aliyun_integration.py::TestAliyunOpenSandboxIntegration::test_execute_pytho========================== 10 passed in 15.67s ==========================```-### 3. 测试场景+### 3. Test Scenarios-#### 基础功能测试+#### Basic Functionality Tests```bash-# 健康检查+# Health checkpytest agent/sandbox/tests/test_aliyun_integration.py::TestAliyunOpenSandboxIntegration::test_health_check -v-# 创建实例+# Create instancepytest agent/sandbox/tests/test_aliyun_integration.py::TestAliyunOpenSandboxIntegration::test_create_python_instance -v-# 执行代码+# Execute codepytest agent/sandbox/tests/test_aliyun_integration.py::TestAliyunOpenSandboxIntegration::test_execute_python_code -v-# 销毁实例+# Destroy instancepytest agent/sandbox/tests/test_aliyun_integration.py::TestAliyunOpenSandboxIntegration::test_destroy_instance -v```-#### 错误处理测试+#### Error Handling Tests```bash-# 代码执行错误+# Code execution errorpytest agent/sandbox/tests/test_aliyun_integration.py::TestAliyunOpenSandboxIntegration::test_execute_python_code_with_error -v-# 超时处理+# Timeout handlingpytest agent/sandbox/tests/test_aliyun_integration.py::TestAliyunOpenSandboxIntegration::test_execute_python_code_timeout -v```-#### 真实场景测试+#### Real-World Scenario Tests```bash-# 数据处理工作流+# Data processing workflowpytest agent/sandbox/tests/test_aliyun_integration.py::TestAliyunRealWorldScenarios::test_data_processing_workflow -v-# 字符串操作+# String manipulationpytest agent/sandbox/tests/test_aliyun_integration.py::TestAliyunRealWorldScenarios::test_string_manipulation -v-# 多次执行+# Multiple executionspytest agent/sandbox/tests/test_aliyun_integration.py::TestAliyunRealWorldScenarios::test_multiple_executions_same_instance -v```-## 常见问题+## FAQ-### Q: 没有凭据怎么办?+### Q: What if I don't have credentials?-**A:** 运行单元测试即可,不需要真实凭据:+**A:** Just run the unit tests — no real credentials needed:```bashpytest agent/sandbox/tests/test_aliyun_provider.py -v```-### Q: 如何跳过集成测试?+### Q: How do I skip integration tests?-**A:** 使用 pytest 标记跳过:+**A:** Use pytest markers to skip them:```bash-# 只运行单元测试,跳过集成测试+# Run only unit tests, skip integration testspytest agent/sandbox/tests/ -v -m "not integration"```-### Q: 集成测试失败怎么办?+### Q: What should I do if integration tests fail?-**A:** 检查以下几点:+**A:** Check the following:-1. **凭据是否正确**+1. **Are the credentials correct?**```bashecho $ALIYUN_ACCESS_KEY_IDecho $ALIYUN_ACCESS_KEY_SECRET```-2. **网络连接是否正常**+2. **Is the network connection working?**```bashcurl -I https://opensandbox.cn-hangzhou.aliyuncs.com```-3. **是否有 OpenSandbox 服务权限**- - 登录阿里云控制台- - 检查是否已开通 OpenSandbox 服务- - 检查 AccessKey 权限+3. **Do you have OpenSandbox service permissions?**+ - Log in to the Aliyun console+ - Check if the OpenSandbox service is enabled+ - Verify AccessKey permissions-4. **查看详细错误信息**+4. **View detailed error messages:**```bashpytest agent/sandbox/tests/test_aliyun_integration.py -v -s```-### Q: 测试超时怎么办?+### Q: What should I do if tests time out?-**A:** 增加超时时间或检查网络:+**A:** Increase the timeout or check network connectivity:```bash-# 使用更长的超时+# Use a longer timeoutpytest agent/sandbox/tests/test_aliyun_integration.py -v --timeout=60```-## 测试命令速查表+## Quick Reference: Test Commands-| 命令 | 说明 | 需要凭据 |+| Command | Description | Credentials Required ||------|------|---------|-| `pytest agent/sandbox/tests/test_aliyun_provider.py -v` | 单元测试 | ❌ |-| `pytest agent/sandbox/tests/test_aliyun_integration.py -v` | 集成测试 | ✅ |-| `pytest agent/sandbox/tests/ -v -m "not integration"` | 仅单元测试 | ❌ |-| `pytest agent/sandbox/tests/ -v -m integration` | 仅集成测试 | ✅ |-| `pytest agent/sandbox/tests/ -v` | 所有测试 | 部分需要 |--## 获取 Aliyun 凭据--1. 访问 [阿里云控制台](https://ram.console.aliyun.com/manage/ak)-2. 创建 AccessKey-3. 保存 AccessKey ID 和 AccessKey Secret-4. 设置环境变量--⚠️ **安全提示:**-- 不要在代码中硬编码凭据-- 使用环境变量或配置文件-- 定期轮换 AccessKey-- 限制 AccessKey 权限--## 下一步--1. ✅ **运行单元测试** - 验证代码逻辑-2. 🔧 **配置凭据** - 设置环境变量-3. 🚀 **运行集成测试** - 测试真实 API-4. 📊 **查看结果** - 确保所有测试通过-5. 🎯 **集成到系统** - 使用 admin API 配置提供商--## 需要帮助?--- 查看 [完整文档](README.md)-- 检查 [sandbox 规范](../../../../../docs/develop/sandbox_spec.md)-- 联系 RAGFlow 团队+| `pytest agent/sandbox/tests/test_aliyun_provider.py -v` | Unit tests | ❌ |+| `pytest agent/sandbox/tests/test_aliyun_integration.py -v` | Integration tests | ✅ |+| `pytest agent/sandbox/tests/ -v -m "not integration"` | Unit tests only | ❌ |+| `pytest agent/sandbox/tests/ -v -m integration` | Integration tests only | ✅ |+| `pytest agent/sandbox/tests/ -v` | All tests | Partially required |++## Getting Aliyun Credentials++1. Visit the [Aliyun Console](https://ram.console.aliyun.com/manage/ak)+2. Create an AccessKey+3. Save your AccessKey ID and AccessKey Secret+4. Set the environment variables++⚠️ **Security Tips:**+- Do not hardcode credentials in your code+- Use environment variables or configuration files+- Rotate AccessKeys regularly+- Restrict AccessKey permissions++## Next Steps++1. ✅ **Run unit tests** - Verify code logic+2. 🔧 **Configure credentials** - Set environment variables+3. 🚀 **Run integration tests** - Test the real API+4. 📊 **Review results** - Ensure all tests pass+5. 🎯 **Integrate into your system** - Configure the provider via the admin API++## Need Help?++- See the [full documentation](README.md)+- Check the [sandbox specification](../../../../../docs/develop/sandbox_spec.md)+- Contact the RAGFlow teamdiff --git a/agent/sandbox/tests/test_aliyun_codeinterpreter_integration.py b/agent/sandbox/tests/test_aliyun_codeinterpreter_integration.pyindex 5aa11d52ef..491d19ba42 100644--- a/agent/sandbox/tests/test_aliyun_codeinterpreter_integration.py+++ b/agent/sandbox/tests/test_aliyun_codeinterpreter_integration.py@@ -22,7 +22,7 @@ To run these tests, set the following environment variables:export AGENTRUN_ACCESS_KEY_ID="LTAI5t..."export AGENTRUN_ACCESS_KEY_SECRET="..."- export AGENTRUN_ACCOUNT_ID="1234567890..." # Aliyun primary account ID (主账号ID)+ export AGENTRUN_ACCOUNT_ID="1234567890..." # Aliyun primary account IDexport AGENTRUN_REGION="cn-hangzhou" # Note: AGENTRUN_REGION (SDK will read this)Then run: