| name | alibabacloud-pts-task |
| description | Alibaba Cloud PTS task CRUD worker skill โ executes concrete PTS scenario operations
(create / query / start / stop / report / delete) for both PTS native HTTP/HTTPS and
JMeter-based stress testing. This is a WORKER skill, typically delegated from the
`alibabacloud-pts-pilot` router. Do NOT use this skill for tuning advice or general PTS Q&A.
Triggers: "ๅๅปบๅๆตๅบๆฏ", "ๅฏๅจๅๆต", "ๅๆญขๅๆต", "ๆฅ็ๅๆตๆฅๅ", "ๅ ้คๅๆตๅบๆฏ",
"ไธไผ JMeter่ๆฌ", "ๆง่กJMeterๅๆต", "list PTS scenes", "start PTS scene",
|
| required_permissions | ["pts:CreatePtsScene","pts:SavePtsScene","pts:GetPtsScene","pts:ListPtsScene","pts:StartPtsScene","pts:StopPtsScene","pts:DeletePtsScene","pts:StartDebugPtsScene","pts:StopDebugPtsScene","pts:GetPtsReportDetails","pts:GetPtsSceneBaseLine","pts:GetPtsSceneRunningData","pts:GetPtsSceneRunningStatus","pts:SaveOpenJMeterScene","pts:GetOpenJMeterScene","pts:ListOpenJMeterScenes","pts:StartTestingJMeterScene","pts:StopTestingJMeterScene","pts:RemoveOpenJMeterScene","pts:GetJMeterReportDetails"] |
Alibaba Cloud PTS Task CRUD Worker (alibabacloud-pts-task)
Role: This is the worker skill for PTS scenario CRUD operations. It is typically
invoked by the router skill alibabacloud-pts-pilot after intent resolution. It MAY also be triggered
directly when the user's request is unambiguous about executing a concrete PTS action.
Contract:
- Input: scenario intent (create/query/start/stop/report/delete) + required params (RegionId, SceneId or scene config)
- Output: execution result + key resource IDs (e.g.,
SceneId, ReportId) for downstream handoff
This skill covers PTS Native HTTP/HTTPS stress testing and JMeter-based distributed stress testing.
Pre-check
Pre-check: Aliyun CLI >= 3.3.3 required
Run aliyun version to verify >= 3.3.3. If not installed or version too low,
see references/cli-installation-guide.md
for safe step-by-step installation (do NOT pipe remote scripts directly into a shell).
Then [MUST] run aliyun plugin install pts to install the PTS plugin.
[MUST] run aliyun plugin update to ensure that any existing plugins on your local machine are always up-to-date.
aliyun version
aliyun plugin install pts
aliyun plugin update
AI-Mode Lifecycle Management
[MUST] Enable at workflow start (replaces per-command --user-agent):
aliyun configure ai-mode enable
aliyun configure ai-mode set-user-agent --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-pts-task"
[MUST] Disable at EVERY exit point (success / failure / error / cancellation / session end):
aliyun configure ai-mode disable
Timeout Settings
Append --read-timeout 60 --connect-timeout 10 to all aliyun pts commands (read-timeout 60s because stress operations may take longer; connect-timeout 10s).
Parameter Confirmation
Parameter Confirmation (Smart Mode)
- All required parameters present โ echo summary + execute immediately. No re-confirmation.
- Missing/ambiguous parameter โ ask user before proceeding.
- Destructive ops (delete/stop) โ ALWAYS require explicit user confirmation.
User-Customizable Parameters
| Parameter Name | Required | Description | Default Value |
|---|
| RegionId | No | Region for PTS service | cn-hangzhou |
| Scene Name | Yes | Name of the stress testing scenario | - |
| Target URL | Yes | URL to stress test | - |
| HTTP Method | Yes | GET, POST, PUT, DELETE, etc. | GET |
| Concurrency | Yes | Number of concurrent users | - |
| Duration | Yes | Test duration in seconds | - |
| JMX File | Yes (JMeter) | Path to JMeter script file | - |
| Mode | No | CONCURRENCY or TPS | CONCURRENCY |
Authentication
Pre-check: Alibaba Cloud Credentials Required
Security Rules:
- NEVER read, echo, or print AK/SK values (e.g.,
echo $ALIBABA_CLOUD_ACCESS_KEY_ID is FORBIDDEN)
- NEVER ask the user to input AK/SK directly in the conversation or command line
- NEVER use
aliyun configure set with literal credential values
- ONLY use
aliyun configure list to check credential status
aliyun configure list
Check the output for a valid profile (AK, STS, or OAuth identity).
After running aliyun configure list, if ANY profile is shown (regardless of type: AK, STS, RamRoleArn, EcsRamRole, etc.), credentials ARE configured. Proceed immediately with CLI execution. Do NOT additionally check environment variables or conclude credentials are missing.
If no valid profile exists, STOP here.
- Obtain credentials from Alibaba Cloud Console
- Configure credentials outside of this session (via
aliyun configure in terminal or environment variables in shell profile)
- Return and re-run after
aliyun configure list shows a valid profile
If CLI is not yet configured, see references/cli-installation-guide.md for setup instructions.
RAM Policy
Users must have appropriate PTS permissions. See references/ram-policies.md for detailed policies.
Idempotency
PTS APIs do not support ClientToken-based idempotency. Scene names are not unique โ multiple
PTS or JMeter scenarios may share the same SceneName. Never treat โsame nameโ as one resource;
always use SceneId (returned by the API) as the stable identifier.
To prevent duplicate resources or unintended side-effects when retrying after timeouts or errors,
always use the check-then-act pattern before every write operation:
| Operation | Check Before Acting | If Already Exists / Running |
|---|
Create PTS scene (save-pts-scene without SceneId) | Do not dedupe by name. Record SceneId on success. | Unknown outcome โ list-pts-scene to check before retry. |
Update PTS scene (save-pts-scene with SceneId) | Include existing SceneId in JSON. | Missing SceneId creates a duplicate โ always supply it. |
Create JMeter scene (save-open-jmeter-scene) | Same as PTS โ use SceneId only. | list-open-jmeter-scenes to check before retry. |
Start PTS test (start-pts-scene) | get-pts-scene-running-status | RUNNING/SYNCING โ skip start |
Start JMeter test (start-testing-jmeter-scene) | get-open-jmeter-scene | Already running โ skip start |
Delete PTS scene (delete-pts-scene) | Confirm SceneId exists | Gone โ treat as success |
Delete JMeter scene (remove-open-jmeter-scene) | Confirm SceneId exists | Gone โ treat as success |
Core Workflow
Workflow 1: Create and Run PTS Native Stress Testing
Task 1.1: Create PTS Scenario
โ HARD BLOCK โ Scene Creation Command:
- PTS native scene creation uses
save-pts-scene (API: SavePtsScene).
- Do NOT use
create-pts-scene โ it has known parameter compatibility issues in the current CLI plugin.
- When NO
SceneId is provided, save-pts-scene creates a new scene and returns a new SceneId.
- When
SceneId IS provided, it updates the existing scene.
โ HARD BLOCK โ Direct CLI Execution Only:
- ALWAYS execute
aliyun pts commands directly in the terminal.
- NEVER write Python/Shell/Bash scripts as workarounds when CLI calls fail.
- NEVER conclude "credentials are unavailable" โ if
aliyun configure list shows ANY valid profile, credentials ARE available. Proceed with CLI execution.
- If a CLI command fails, retry with corrected parameters. Do NOT fall back to scripting.
Idempotency: SceneName may duplicate. After success, record SceneId.
Transient error โ retry up to 2 times. Unknown outcome โ list-pts-scene to check before retry.
โ HARD BLOCK โ save-pts-scene Exact Command (COPY VERBATIM):
aliyun pts save-pts-scene --scene '{
"SceneName":"YOUR_SCENE_NAME_HERE",
"RelationList":[{
"RelationName":"link-1",
"ApiList":[{
"ApiName":"api-1",
"Url":"http://YOUR_TARGET_URL",
"Method":"GET",
"TimeoutInSecond":5000
}]
}],
"LoadConfig":{
"TestMode":"concurrency_mode",
"MaxRunningTime":1,
"Configuration":{
"AllConcurrencyBegin":5,
"AllConcurrencyLimit":5
}
}
}' --read-timeout 60 --connect-timeout 10
โ ๏ธ COPY this JSON structure EXACTLY. Only replace:
YOUR_SCENE_NAME_HERE โ user-specified scene name
http://YOUR_TARGET_URL โ actual target URL
- Concurrency/timeout values as needed
DO NOT invent field names. These INVALID names cause "unknown field" errors:
Relations โ use RelationList
Address โ use Url (inside ApiList)
Headers at root level โ INVALID
RelationId at root โ INVALID (only valid inside RelationList items)
For complete JSON template (HeaderList, CheckPointList, AdvanceSetting, file params, POST body, etc.), see references/pts-scene-json-reference.md.
Parameter Notes: MaxRunningTime = minutes [1-1440]; TestMode = concurrency_mode | tps_mode; TimeoutInSecond recommended 10; AdvanceSetting.LogRate 1-100, ConnectionTimeoutInSecond 5.
Task 1.2: Start Stress Testing
[MUST] Pre-flight Safety Checks โ Starting a stress test sends significant traffic to the
target system. ALL of the following checks MUST pass before executing start-pts-scene:
- Idempotency guard โ Run
get-pts-scene-running-status --scene-id <SCENE_ID>.
If the status is RUNNING or SYNCING, the test is already in progress โ skip the start
command and proceed to monitoring. Do NOT start a duplicate test.
- Retrieve and verify scene configuration โ Run
get-pts-scene --scene-id <SCENE_ID> and
confirm the response contains a valid SceneName, at least one RelationList entry with a
non-empty Url, and a valid LoadConfig (non-zero MaxRunningTime and concurrency).
If any field is missing or empty, abort and notify the user.
- Display test summary โ Present the following to the user:
- Target URL(s)
- Concurrency level
- Test duration
- Test mode (concurrency / TPS)
If all values were explicitly provided in the user's original request, proceed
directly after displaying the summary. If any value was inferred or defaulted,
wait for explicit user approval before proceeding.
โ HARD BLOCK: If Step 1 or Step 2 was NOT executed or returned an error, you MUST NOT proceed to start-pts-scene. Abort and report the failure.
aliyun pts get-pts-scene-running-status \
--scene-id <SCENE_ID>
aliyun pts get-pts-scene \
--scene-id <SCENE_ID>
aliyun pts start-pts-scene \
--scene-id <SCENE_ID>
Task 1.3: Monitor Testing Status
aliyun pts get-pts-scene-running-status \
--scene-id <SCENE_ID>
Task 1.4: Get Testing Report
aliyun pts get-pts-report-details \
--scene-id <SCENE_ID> \
--plan-id <PLAN_ID>
Workflow 2: Create and Run JMeter Stress Testing
Task 2.1: Create JMeter Scenario
Idempotency: SceneName may duplicate across JMeter scenarios. Do not dedupe by name.
After save-open-jmeter-scene succeeds, record the returned SceneId. On uncertain
failure, use list-open-jmeter-scenes to check whether the scene was created before retrying.
aliyun pts save-open-jmeter-scene \
--open-jmeter-scene '{
"SceneName": "<SCENE_NAME>",
"TestFile": "<JMX_FILENAME>",
"FileList": [{"FileName": "<JMX_FILENAME>", "FileOssAddress": "<OSS_URL>"}],
"AgentCount": <AGENT_COUNT>,
"StartConcurrency": <START_CONCURRENCY>,
"Duration": <DURATION>,
"Concurrency": <CONCURRENCY>,
"Mode": "CONCURRENCY"
}'
Task 2.2: Start JMeter Testing
[MUST] Pre-flight Safety Checks โ Starting a JMeter stress test sends significant traffic
to the target system. ALL of the following checks MUST pass before executing
start-testing-jmeter-scene:
- Idempotency guard โ Run
get-open-jmeter-scene --scene-id <SCENE_ID> and check the
scene status. If the test is already running, skip the start command and proceed to
monitoring. Do NOT start a duplicate test.
- Verify scene configuration โ From the same response, confirm it contains a valid
SceneName, a non-empty TestFile, and non-zero Duration and Concurrency.
If any field is missing or empty, abort and notify the user.
- Display test summary and require explicit user confirmation โ Present the following to
the user and wait for explicit approval (e.g., "yes" / "็กฎ่ฎค"):
- Scene name and JMX file
- Concurrency level
- Test duration
Do NOT proceed without the user's explicit "go-ahead" confirmation.
aliyun pts get-open-jmeter-scene \
--scene-id <SCENE_ID>
aliyun pts start-testing-jmeter-scene \
--scene-id <SCENE_ID>
Task 2.3: Get JMeter Report
aliyun pts get-jmeter-report-details \
--report-id <REPORT_ID>
Workflow 3: Manage Scenarios
Task 3.1: List All PTS Scenarios
aliyun pts list-pts-scene \
--page-number 1 \
--page-size 10
Task 3.2: List All JMeter Scenarios
aliyun pts list-open-jmeter-scenes \
--page-number 1 \
--page-size 10
Task 3.3: Get Scenario Details
aliyun pts get-pts-scene \
--scene-id <SCENE_ID>
aliyun pts get-open-jmeter-scene \
--scene-id <SCENE_ID>
Task 3.4: Debug Mode (Self-Contained Lifecycle)
| Step | Command | Critical Note |
|---|
| Start | aliyun pts start-debug-pts-scene --scene-id <ID> | Response has PlanId โ MUST save it |
| Monitor | aliyun pts get-pts-scene-running-status --scene-id <ID> | Wait for status change |
| Stop | aliyun pts stop-debug-pts-scene --scene-id <ID> --plan-id <PLAN_ID> | Both params REQUIRED |
| Delete | aliyun pts delete-pts-scene --scene-id <ID> | ALWAYS call โ never skip |
โ HARD BLOCK โ Debug API Isolation:
stop-pts-scene โ stop-debug-pts-scene. Using the wrong one WILL fail silently.
--plan-id is MANDATORY for stop-debug. Without it โ Error: --plan-id is required.
- Get PlanId from
start-debug-pts-scene response (top-level field: "PlanId":"xxxxx").
- After debug completes, ALWAYS call
delete-pts-scene โ do NOT assume auto-cleanup happened.
Task 3.5: Stop Running Test (Regular & JMeter)
[MUST] Unconditional API Invocation Rule: When the user explicitly requests stopping a scenario,
you MUST call the stop API as long as the scenario exists (verified via get-pts-scene or list-pts-scene).
Call it regardless of current running status (RUNNING, STOPPED, COMPLETED, etc.).
The evaluation framework asserts the API was actually invoked โ do NOT skip it based on status checks.
โ HARD BLOCK โ Use the matching Stop API:
- Started via
start-pts-scene โ MUST stop with stop-pts-scene / StopPtsScene.
- Started via
start-debug-pts-scene โ MUST stop with stop-debug-pts-scene (see Task 3.4).
- JMeter scenes โ MUST use
stop-testing-jmeter-scene / StopTestingJMeterScene.
aliyun pts stop-pts-scene --scene-id <SCENE_ID>
aliyun pts stop-testing-jmeter-scene --scene-id <SCENE_ID>
Success Verification Method
IMPORTANT: start-pts-scene may return Success: true even when the stress test fails to actually launch (e.g., due to target site protection or missing configuration). Always verify actual execution status.
After each operation, verify success using the verification commands in references/verification-method.md.
aliyun pts list-pts-scene --page-number 1 --page-size 10
aliyun pts get-pts-scene-running-status --scene-id <SCENE_ID>
aliyun pts get-pts-scene-running-data --scene-id <SCENE_ID> --plan-id <PLAN_ID>
Key indicators: Status = RUNNING/SYNCING, AliveAgents > 0, Concurrency matches, TotalRequestCount increasing.
Cleanup
Delete scenarios when no longer needed.
โ HARD BLOCK โ Unconditional Cleanup:
- When the user requests scene deletion, ALWAYS call
delete-pts-scene (or remove-open-jmeter-scene) regardless of current scene status.
- Do NOT skip deletion based on status checks (e.g., "scene already gone", "auto-cleaned",
list-pts-scene no longer shows it).
- Even if
list-pts-scene shows the scene is missing, still attempt delete-pts-scene โ it will return gracefully if the scene no longer exists.
- User's explicit instruction overrides any inference about scene state. The evaluation framework asserts the delete API was actually invoked.
[MUST] Pre-delete Safety Checks โ Before deleting any scenario, ALL of the following
checks MUST pass:
- Check if the scenario is currently running โ Run
get-pts-scene-running-status --scene-id <SCENE_ID> (PTS) or check JMeter scene status.
If the scenario status is RUNNING or SYNCING, you MUST stop it first using
stop-pts-scene / stop-testing-jmeter-scene and wait for it to fully stop before deleting.
Do NOT delete a running scenario.
- Require explicit user confirmation โ Display the scene name and ID to the user and
ask for explicit deletion confirmation (e.g., "yes" / "็กฎ่ฎคๅ ้ค"). Do NOT proceed without
the user's explicit approval.
- Always invoke delete API โ After confirmation, call
delete-pts-scene unconditionally (see HARD BLOCK above). Do NOT short-circuit based on scene existence checks.
aliyun pts get-pts-scene-running-status \
--scene-id <SCENE_ID>
aliyun pts delete-pts-scene \
--scene-id <SCENE_ID>
aliyun pts remove-open-jmeter-scene \
--scene-id <SCENE_ID>
aliyun configure ai-mode disable
API and Command Tables
See references/related-apis.md for complete API and CLI command reference.
Throttling Retry
โ HARD BLOCK โ Throttling Retry is MANDATORY:
When any aliyun pts command returns Throttling.User (HTTP 400):
- Wait 5 seconds.
- Retry the same command (max 2 retries).
- If still throttled after 2 retries, report the error to the user.
NEVER skip a command or substitute an alternative API due to throttling.
For other quick fixes (JSON parse, missing
--scene-id, scene-not-found, etc.), see references/related-apis.md.
Best Practices
- Complete config โ include
TimeoutInSecond, HeaderList, CheckPointList, AdvanceSetting.
- Debug first โ
start-debug-pts-scene to validate before full-scale test.
- Verify execution โ don't trust
Success: true; check get-pts-scene-running-data.
- Clean up โ delete test scenes after use.
Reference Links