cxas-autolabel-rules
Author, validate, and manage Contact Center AI (CCAI) Insights Autolabeling Rules. Use when users want to translate business labeling logic into CEL condition expressions, maintain declarative autolabel_rules.yaml configurations, or synchronize rules to GCP projects.
GoogleCloudPlatform · 已有 AI 审核记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add GoogleCloudPlatform/cxas-scrapi --skill cxas-autolabel-rules技能说明
name: cxas-autolabel-rules description: >- Author, validate, and manage Contact Center AI (CCAI) Insights Autolabeling Rules. Use when users want to translate business labeling logic into CEL condition expressions, maintain declarative autolabel_rules.yaml configurations, or synchronize rules to GCP projects.
CCAI Insights Autolabeling Rules Skill
This skill guides you in authoring, refining, validating, and synchronizing Contact Center AI (CCAI) Insights Autolabeling Rules.
Autolabeling rules enrich ingested conversations with custom key-value metadata evaluated via Common Expression Language (CEL).
1. Overview & Declarative YAML Schema
Rules are defined declaratively in autolabel_rules.yaml:
version: "1.0"
project_id: "your-gcp-project-id"
location: "us-central1"
autolabeling_rules:
- rule_id: "agent_domain"
display_name: "Agent Domain Classifier"
label_key: "agent_domain"
label_key_type: "LABEL_KEY_TYPE_CUSTOM"
active: true
conditions:
- condition: "containsSubAgent(conversation, 'billing_specialist')"
value: "'billing'"
- condition: "containsSubAgent(conversation, 'tech_support')"
value: "'tech_support'"
- condition: ""
value: "'general'"
Core Schema Requirements
rule_id: Unique alphanumeric identifier (snake_case or kebab-case).label_key: The metadata key name to attach toconversation.labels.conditions: Ordered array of conditions evaluated top-to-bottom.condition: CEL boolean expression (e.g.conversation.duration > 300).value: CEL expression or quoted string literal (e.g.'vip','escalated').- Mandatory Fallback: The final condition in every rule MUST be
condition: ""to act as the default fallback value.
2. Common Expression Language (CEL) Authoring Rules
Refer to the CEL Cookbook for full syntax and function references.
Built-in Helper Functions
- Sub-Agent / Flow Detection:
containsSubAgent(conversation, "billing_subagent") - Session Parameter Matching:
hasSessionParam(conversation, "authenticated", "true") - Sentiment Analysis:
hasCallerSentiment(conversation, "NEGATIVE") - Turn & Duration Checks:
conversation.duration > 300 && conversation.turnCount >= 10
3. Step-by-Step Workflow
Follow these steps when helping a user build or update autolabeling rules:
Step 1: Ingest Requirements
- Ask the user what conversation properties or behaviors they want to classify (e.g., specific sub-agents, customer sentiment, authentication status, duration thresholds).
- Determine target GCP project ID and location.
Step 2: Draft or Edit Declarative YAML
- Create or update
autolabel_rules.yamlin the user's workspace. - Translate business logic into clear, prioritized CEL expressions.
- Ensure every rule ends with a fallback (
condition: "").
Step 3: Compare with Active Remote Rules (diff)
Run diff to preview additions, modifications, and deletions:
uv run cxas insights diff-autolabel-rules --file autolabel_rules.yaml
Step 4: Dry-Run Deploy
Run push with --dry-run to verify API compatibility:
uv run cxas insights push-autolabel-rules --file autolabel_rules.yaml --dry-run
Step 5: Deploy to GCP Project (push)
Deploy the changes:
uv run cxas insights push-autolabel-rules --file autolabel_rules.yaml
(To delete remote rules that are no longer in the local YAML, append --force.)
Step 6: Export Existing Rules (pull)
To export existing active rules from an environment into YAML:
uv run cxas insights pull-autolabel-rules --parent projects/<PROJECT>/locations/<LOCATION> --out autolabel_rules.yaml
4. References & Tooling
- CEL Cookbook: Curated expressions and helper function recipes.
- JSON Schema: Schema definition for YAML linting.
- Design Document: Architectural specification.