📋 Tool Description
Core Features
Analyzes the image input by the user, intelligently beautifies the people in the picture, and outputs the beautified image.
Available Commands
| Command | Function | Description |
|---|---|---|
python scripts/plan.py |
Package Query | Query the user's current Ark Claw package |
python scripts/beauty.py --file <图片路径> --output <输出文件> |
Smart Beauty Processing | Perform smart beauty processing on the image |
📥 Image Acquisition Methods
The following four methods are supported for acquiring images:
- Local File: Directly provide the absolute path of the local image file
- Network Image URL: Directly provide the network image URL address, no need to download first, the tool processes it automatically
- Multiple Image URLs: Provide multiple image URLs separated by commas, the tool processes them in sequence and packages them into a zip to return
- Image Compressed Package: The user can upload a compressed package containing multiple images,directly pass the compressed package path to beauty.py, the tool will automatically decompress and process all images in it, no need to manually decompress.
🚨 Mandatory Pre-check Process (Must Be Executed in Order; If Any Step Fails, Terminate the Process Directly)
All user requests must first complete the following 3-step verification, which must not be skipped:
1. Volcano Authentication Verification
- Execute the environment variable check command:
echo "ACCESS_KEY_ID: $ACCESS_KEY_ID" && echo "SECRET_ACCESS_KEY: $SECRET_ACCESS_KEY" - Determine the authentication result:
- Authentication Passed:
ACCESS_KEY_IDandSECRET_ACCESS_KEYare both non-empty values → authentication passed - Authentication Failed: Execute the following guidance plan
- Authentication Passed:
❌ Guidance Plan When Authentication Is Not Configured
- Guide the user to directly send the ACCESS_KEY_ID/SECRET_ACCESS_KEY content in the chat:
Directly send your Access Key ID and Secret Access Key here, and I will help you complete the temporary environment variable configuration
- After receiving the ACCESS_KEY_ID/SECRET_ACCESS_KEY sent by the user, execute the configuration command:
export ACCESS_KEY_ID=用户提供的ACCESS_KEY_ID值 export SECRET_ACCESS_KEY=用户提供的SECRET_ACCESS_KEY值 - After the configuration is complete, inform the user:
The temporary configuration of ACCESS_KEY_ID/SECRET_ACCESS_KEY has been completed. The current configuration is only effective in this session and will not be persistently stored. Please use it with confidence
- When all related scripts are executed subsequently, they will automatically pass
exportSpecify these two environment variables to ensure normal authentication, without the user needing to configure them repeatedly
2. Package Validity Verification
- Step 1: Python Version Verification
python3.12 --version || (echo "❌ Python 3.12+ 未安装,请先安装Python 3.12" && exit 1) - Step 2: Dependency Package Installation Verification
python3.12 -m pip install -r ./scripts/requirements.txt - Step 3: Execute the package query command
python scripts/plan.py - Step 4: Result Processing Logic
- ✅ Package Valid: In the returned result, the
messagefield is the valid expiration time (Beijing time), verification passed - ❌ Package Expired:
messageis less than or equal to the current time, guide the user to activate a package, terminate the process - ❌ API Call Error: Refer to the "Error Handling Specification" to match the error code, clearly inform the user of the cause of the error and the solution, and terminate the process
- ✅ Package Valid: In the returned result, the
🛠️ Intelligent Beauty Processing Execution Flow
Preliminary Preparation
- Ensure the output directory exists:
mkdir -p /tmp/openclaw/ai-beauty/output - Generate a unique output file name:
ai_beauty_<timestamp>_<random>.json - Prepare the local image files: JPG and PNG formats are supported, and a compressed package of batch images after compression is also supported.
Automatic Input Type Recognition
- Image compressed package: The path ends with
.zip,tar,tar.gzand other compressed package formats → automatically decompress and process in batches,just pass in the compressed package path directly, no need to manually decompress - Multiple URLs: Contains commas and contains
http://orhttps://→ process each URL in sequence and package as a zip - Single image/URL: Other cases → single image processing
Execution Steps
- Input: The local image file path, image URL, multiple image URLs (comma-separated), or image compressed package path provided by the user
- Tool Call: Execute the
python scripts/beauty.py --file <输入路径/URL> --output <输出文件>command - Output: Processing result in JSON format
Output JSON Format Description
Single Image
Processing succeeded:
{
"image_name": "原图片文件名",
"result_url": "美颜后的图片URL"
}
Processing failed:
{
"image_name": "原图片文件名",
"error_code": "错误码",
"error_msg": "错误原因"
}
Batch URLs or Image Compressed Package
{
"success_count": 3,
"failed_count": 1,
"total_count": 4,
"results": [
{
"image_name": "原图片文件名1",
"result_url": "美颜后的图片URL",
"success": true
},
{
"image_name": "原图片文件名2",
"error_code": "错误码",
"error_msg": "错误原因",
"success": false
}
],
"zip_path": "/path/to/beauty_images.zip"
}
| Field | Type | Description |
|---|---|---|
success_count |
int | Number of successfully processed images |
failed_count |
int | Number of failed images |
total_count |
int | Total number of images |
results |
array | List of processing results for all images |
zip_path |
string | Local zip path of all packaged beautified images |
Field description for each element in the results array:
| Field | Type | Description |
|---|---|---|
image_name |
string | Original image file name |
result_url |
string | Returns the beautified image URL on success |
success |
bool | Whether processing succeeded |
error_code |
string | Returns the error code on failure (0 indicates success, others are error codes) |
error_msg |
string | Returns the error reason on failure |
Return Format Description
❌ Do not improvise or add other content, such as text descriptions, image descriptions, etc. ❌ Do not return the optimization details of the beautification, only return the beautified image URL or ZIP package download link ❌ Do not return the intermediate details of script execution, such as task ID, processing time, etc., only return the beautified image URL or ZIP package download link
Return to the user strictly according to the following format
Single Image Input Scenario
- ✅ Processing completion status
- 🔗 Volcengine link URL with full signature (clickable)
Positive Example 1 ✅ AI beauty processing succeeded! Please click the link to preview or download the image (valid for 24 hours, please download promptly): https://example.com/beauty.jpg
Positive Example 2 ❌ AI beauty processing failed! No face detected, please upload an image containing a clear face and try again
Batch URL Input Scenario
- ✅ Processing completion status
- 🔗 Fully signed Volcengine link URL corresponding to each image (clickable)
- 📚 Local path of the compressed package
Positive Example 3 ✅ AI beauty processing successful! Please click the link to preview or download the image (valid for 24 hours, please download promptly): image1:https://example.com/beauty1.jpg image2:https://example.com/beauty2.jpg Package download path: /path/to/beauty_results.zip
Positive example 4 ✅ AI beauty processing successful! Please click the link to preview or download the image (valid for 24 hours, please download promptly): image1:https://example.com/beauty1.jpg image4:https://example.com/beauty3.jpg image2,image3: [specific failure reason returned by the script] Package download path: /path/to/beauty_results.zip
Image archive input scenario
- ✅ Processing completed status
- 🔗 Archive local path
Positive example 5 ✅ AI beauty processing successful! Please download the beautified image archive promptly: Package download path: /path/to/beauty_results.zip
Positive example 6 ✅ AI beauty processing successful!
- Successfully processed 4/6 images
- 2 images failed, sample1.jpg: [failure reason 1], sample2.jpg: [failure reason 2] Package download path: /path/to/beauty_results.zip
Positive example 7 ❌ AI beauty processing failed! No face was detected in any of the images. Please upload images containing clear faces and try again
Agent execution special requirements
- Timeout setting: When calling the exec tool to start the script, set yieldMs to ≥180000ms (3 minutes)
- Friendly prompt: If the script does not return a result immediately, first reply to the user: "Beauty processing is being performed for you. The task may take a long time to execute. Please wait a moment~"
- Exception handling: If the script exits due to timeout/exception, immediately use the persisted Task ID to call the task query API to confirm the backend status. Do not directly determine that the task has failed
- Return result: For a single image, return the image URL directly; for batch image processing, return the zip package download link. If the zip file is too large to send directly, return the zip package path
- Batch processing: If the user uploads an image archive, the tool will automatically extract it and process all images in it,automatically download all beautified images and package them into a zip package, no additional manual download and packaging is required.
⚠️ Error handling specification
All errors must clearly state the reason and an actionable solution. Vague prompts are prohibited!!!
| Error code | Error description | Detailed explanation | User handling suggestion |
|---|---|---|---|
| 0 | No return value | The API call succeeded, but the service returned an empty result | Please try again later. If the problem persists, please contact Volcano technical support |
| 1400 | ParamErr parameter error | Parameter error | Contact technical support |
| 1402 | Insufficient credits | When calling the API, the user account does not have enough credit balance | Please go to Credit Recharge Page to recharge credits or upgrade the plan |
| 1410 | Service ID does not exist | When calling the API, the input parameters contained a non-existent service ID | |
| 1411 | Input resolution error | When calling the API, the image or video resolution in the input parameters does not meet the requirements | Please check whether the material resolution meets the specification requirements (e.g., ≥480p) |
| 1412 | Invalid image format | When calling the API, the input parameters contain an unsupported image format | Please check whether the image format is a supported format such as jpg or png |
| 1413 | Invalid media URL error | When calling the API, the input parameters contain an invalid media URL | Please check whether the URL you provided is correct and avoid special characters or format errors |
| 1416 | Invalid input media count | The amount of material entered by the user exceeds the limit | The amount of media material provided exceeds the limit; excess material may not be used |
| 1417 | Large model call error | Model call error, usually due to incorrect input parameters | There is a problem processing the media material. Please try again. If the problem persists, contact Volcengine technical support |
| 1501 | User plan expired | When calling the API, the user plan has expired | Please go to Plan activation page to activate a plan |
| 100010 | Signature verification failed | AK/SK signature verification failed | Please check whether the Volcengine authentication AK/SK you provided is correct. You can visitVolcengine Consoleto confirm |
| 100013 | Missing service permission | Missing the RegisterArkClawCombo permission for the iccloud_muse service | Your enterprise account does not have Kickart permission enabled. Please contact the Volcengine primary account administrator to enable it for you, or consult Volcengine technical support for details |
| x01001 | AK/SK not configured | The user has not configured AK/SK | Please enter the Volcengine authentication AK/SK. You can visitVolcengine Consoleto obtain it |
| x01010 | Valid plan missing | An error occurred while uploading material, usually due to the plan | Please go to Plan activation page to activate a plan |
| 2000 | URL is invalid or no face detected | The submitted URL format is incorrect or no face was detected | Please check whether the URL is correct. Only face images are supported for beauty processing |
| Other | - | Other error cases not explicitly listed | Try again later. If the problem persists, contact Volcengine technical support |