HarmonyOS Agent: Shortcut Command Config & On-Device Verification
This tutorial details configuring six shortcut commands for a HarmonyOS intelligent agent, setting up a test whitelist for on-device debugging, and verifying each command's workflow triggering, card rendering, and content quality on real devices to ensure production readiness.
Objective
Transition from configuration complete to real-world usability by ensuring every shortcut entry triggers stably on-device and returns expected structured content, avoiding cases that work only in the orchestration layer.
Shortcut Command Configuration
Navigate to Orchestration → Shortcut Commands . Configure the following commands (label and content only). These commands abstract high-frequency user scenarios into fixed expressions so the agent can precisely hit the corresponding workflow, reducing NLU errors and improving trigger success rate and response consistency.
1. Write a Spring Couplet
Shortcut label: 写一副春联
Command content: 帮我写一副马年春联Verifies structured generation: couplet parallelism, semantic coherence, and complete horizontal scroll.
2. Gentle Greeting
Shortcut label: 温柔贺词
Command content: 写一段温柔风格的新春贺词Verifies style-specific output: stable gentle tone with emotional expression.
3. Solar Term Knowledge
Shortcut label: 节气知识
Command content: 介绍一下立春Verifies knowledge content generation: information completeness and structural clarity.
4. New Year Customs
Shortcut label: 年俗文化
Command content: 讲讲贴春联的来历Verifies long-form generation and multi-paragraph logical organization.
5. One Sentence Blessing
Shortcut label: 一句祝福
Command content: 生成一句简短的新春祝福Verifies short-form output: concise and expressive.
6. Today's Solar Term
Shortcut label: 今日节气
Command content: 今天是什么节气Verifies real-time query response and content accuracy.
On-Device Debug Preparation (Test Whitelist)
Navigate to Test Whitelist . This step controls test scope: only whitelisted accounts can access the agent on-device, preventing external triggers before release.
1. Create User Group
Click New User Group , fill:
Group name: testUnifies test account management; supports batch extension for multi-person collaborative testing.
2. Add Test Users
Enter Manage Users , click Add User , fill:
Account type: Phone number
Phone number: Test device login account
Device ID: Optional
Remark: Test accountAfter adding, confirm the test device logs into the Xiaoyi App with that phone number; otherwise the whitelist will not take effect.
On-Device Item-by-Item Verification
Open the agent in the Xiaoyi App, tap each shortcut command to verify. Verification checks not only "whether there is a response" but also "whether the response is correct", including field completeness, card style, and content quality.
1. Write a Spring Couplet
Verify:
Triggers couplet workflow
Returns couplet card
Upper/lower scrolls and horizontal scroll complete
Focus: parallelism naturalness and festival context relevance.
2. Gentle Greeting
Verify:
Triggers greeting workflow
Returns greeting card
Content in gentle style
Focus: tone consistency, avoid style drift.
3. Solar Term Knowledge
Verify:
Triggers solar term workflow
Returns solar term card
All fields display completely
Focus: information completeness, no missing fields.
4. New Year Customs
Verify:
Triggers customs workflow
Multi-block content complete
Information structure clear
Focus: content hierarchy clarity and smooth reading experience.
Completed in This Article
Unified shortcut command configuration
Test whitelist configured for on-device debugging
All capabilities verified item-by-item on real device
Card rendering and chain confirmed normal
The agent now completes a full closed loop from configuration to on-device verification; all commands trigger stably and return correct results, providing a reliable foundation for subsequent experience optimization and official release. This phase also validated chain stability, laying a good foundation for extending more capabilities.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
51CTO HarmonyOS Developer Community
The HarmonyOS Developer Community is a learning-oriented community for developers to learn, communicate, ask questions, and share.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
