Generate and validate OOS automation templates from natural language requirements by using the OOS template generation Skill in AI agent platforms such as OpenClaw and Cursor.
Overview
The OOS template generation Skill is built on Alibaba Cloud CloudOps Orchestration Service (OOS). It converts natural language operational requirements into standard OOS automation templates through an AI agent platform. The Skill provides these capabilities:
Requirement analysis and template generation: Extracts operation types, target resources, and parameters from natural language descriptions to generate
YAML-formattedtemplates that meet OOS specifications.Action query and matching: Queries available OOS cloud product actions by using Alibaba Cloud CLI, matches the most suitable action, and retrieves its property definitions.
Template syntax validation: Calls the OOS
ValidateTemplateContentAPI to validate the syntax and semantics of the generated template.Iterative fixing: If validation fails, the Skill analyzes the error, fixes the template, and re-validates until it passes.
Prerequisites
Control endpoint (the environment where the AI agent platform runs):
An AI agent platform that supports the Skill protocol, such as OpenClaw, Cursor, or Claude, is installed and configured.
Alibaba Cloud CLI 3.3.3 or later is installed. Run
aliyun versionto check the current version. If the version is outdated, see Install or update Alibaba Cloud CLI.Alibaba Cloud account credentials: You have configured and managed identity credentials. Run
aliyun configure listto confirm the credential status.RAM permissions: Your Alibaba Cloud account or RAM user requires the following permissions. For instructions, see Manage RAM user permissions.
API | Permission | Purpose |
ListActions |
| Queries the list of available OOS actions. |
ValidateTemplateContent |
| Validates the syntax and semantics of a template. |
Add the skill
The OOS template generation Skill is available on the Alibaba Cloud Skill Platform and GitHub. You can add it in one of the following ways:
Add through conversation (recommended)
In the Agent mode of your AI agent platform, send the following prompt to add and configure the Skill:
Install the skill "alibabacloud-oos-template-generation" from GitHub repo aliyun/alibabacloud-aiops-skills. Skill path: skills/migrationom/oos/alibabacloud-oos-template-generation. After install, inspect the skill metadata and help me finish setup.Add manually
Download the Skill definition file from the GitHub repository and follow the documentation of your AI agent platform to add the Skill file to your project.
Use cases
The Skill supports the following use cases. Describe your requirements in natural language in the conversational interface of your AI agent platform to start generating templates.
Generate a basic O&M template
Generates an OOS automation template based on your operational requirements. The Skill performs requirement analysis, action queries, template generation, and syntax validation.
Example prompts:
"Help me generate an OOS template to reboot an ECS instance."
"Write an automation template to run a command on a specified instance."
"Create a scheduled orchestration template to stop an ECS instance."
The Skill extracts the operation type, target resource, and region from the conversation, uses Alibaba Cloud CLI to find a suitable OOS action, and generates a complete template that includes FormatVersion, Description, Parameters, and Tasks. It then calls the ValidateTemplateContent API to validate the syntax before outputting the result.
Generate a batch operation template
Generates a template for batch operations on multiple resources. The Skill uses the OOS Loop mechanism to implement batch logic.
Example prompts:
"Help me write a template to reboot multiple ECS instances in a batch."
"Generate a template that first queries all instances and then stops them one by one."
For batch operations, the Skill uses the Loop property of a Task and the {{ ACS::TaskLoopItem }} loop variable to iterate through items. It also defines Outputs in a preceding Task for reference by subsequent Tasks.
Generate a multi-step orchestration template
Generates a multi-step orchestration template that supports output passing between steps and conditional branching.
Example prompts:
"Generate a template that first creates a snapshot, and then reboots the instance after the snapshot is complete."
"Help me orchestrate an automated task that decides whether to perform a reboot based on the instance status."
The Skill breaks down a requirement into multiple Tasks, passes output between steps by using the {{ taskName.outputField }} format, and uses the ACS::Choice action for conditional branching.
Template generation process
The Skill follows these steps to generate OOS templates:
Requirement analysis: Extract parameters such as operation type, target resource, and region (the default is
cn-hangzhou) from the conversation. Any uncertain parameters are extracted as the Parameters of the template, which eliminates the need to repeatedly ask the user.Action query: Uses Alibaba Cloud CLI to find available OOS actions, matches the most suitable one, and retrieves its property definitions. Actions are categorized as follows:
Atomic actions (built-in): Actions such as
ACS::ExecuteAPI,ACS::WaitFor, andACS::Choicecan be used directly.Action on a cloud product (query required): The format is
ACS::<Product>::<Name>, such asACS::ECS::RebootInstance. You can query for actions by using thealiyun oos list-actionscommand.
Template generation: Generates a complete OOS template in YAML format, including
FormatVersion,Description(in both English and Chinese),Parameters, andTasks.Syntax validation: Run the
aliyun oos validate-template-contentcommand to validate the template. If the validation passes, the final template is output. If the validation fails, the command automatically analyzes and fixes the errors, and then re-validates the template until it passes.
Template example
The following example shows a template generated by the Skill to reboot an ECS instance:
FormatVersion: OOS-2019-06-01
Description:
en: 'Reboot an ECS instance'
zh-cn: '重启一台ECS实例'
Parameters:
regionId:
Type: String
Description: 'Region ID'
Default: 'cn-hangzhou'
instanceId:
Type: String
Description: 'Instance ID'
Tasks:
- Name: rebootInstance
Action: ACS::ECS::RebootInstance
Description: 'Reboot ECS instance'
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ instanceId }}'Parameters in a template are referenced in the {{ paramName }} format (double curly braces with spaces). When you create an OOS execution, enter the actual parameter values to run the template.
FAQ
Template validation failures
When validation fails, the Skill analyzes and fixes the error automatically. Common error types include:
Invalid action: A non-existent action name is used. The Skill requeries the correct action name by using Alibaba Cloud CLI.
Property name case mismatch: The case of action property names must exactly match the API definition. The Skill corrects the case based on the retrieved property definition.
Incorrect YAML format: The indentation or quotation marks are incorrect. The Skill corrects the format and re-validates.
Missing required fields: Fields such as
FormatVersion,Description, orTasksare missing. The Skill adds them and re-validates.
Outdated CLI version
The OOS template generation Skill requires Alibaba Cloud CLI 3.3.3 or later. Run the following command to install or update it:
curl -fsSL https://aliyuncli.alicdn.com/setup.sh | bashAfter installation, run aliyun version to confirm the version number.
Common action pitfalls
The following actions do not exist in OOS. The Skill automatically uses an alternative.
Non-existent action | Alternative |
| Use the |
| Use |
| Use |
| Use |
Referencing task outputs
Before you can reference the output of another Task, that Task must first define an Outputs block. The reference format is {{ taskName.outputField }}.
For example, use ACS::ExecuteAPI to query a list of instances and define the output, then iterate through the results in a subsequent Task by using a Loop:
Tasks:
- Name: listInstances
Action: ACS::ExecuteAPI
Properties:
Service: ecs
API: DescribeInstances
Parameters:
RegionId: '{{ regionId }}'
Outputs:
instanceIds:
Type: List
ValueSelector: 'Instances.Instance[].InstanceId'
- Name: rebootInstances
Action: ACS::ECS::RebootInstance
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ ACS::TaskLoopItem }}'
Loop:
Items: '{{ listInstances.instanceIds }}'Insufficient permissions
If you encounter a permission error when you run a CLI command, the Skill indicates the required RAM permissions. Contact an administrator to grant the oos:ListActions and oos:ValidateTemplateContent permissions to the current account and then retry.