Dialogflow CX → CES Migration Skill
What This Skill Does
Migrates a Dialogflow CX v3beta1 agent to Google Customer Engagement Suite (CES) Conversational Agents format, producing:
| Output File | Contents |
|---|
| INLINECODE0 | CES agent definition (importable via Console or REST API) |
| INLINECODE1 |
CES batch evaluation CSV (golden test cases) |
|
entity_types.json | Entity type definitions for manual re-creation |
|
migration_report.md | Full migration summary with next steps |
Migration Mapping
| Dialogflow CX | → | CES Conversational Agents |
|---|
| Agent | → | Agent Application + Root Agent |
| Flow (non-default) |
→ | Sub-Agent |
| Pages + Routes | → | Agent Instructions (natural language) |
| Intent training phrases | → | Root agent routing hints |
| Entity Types | → | Exported JSON (manual import) |
| Webhook | → | Tool (OpenAPI schema) |
| Form Parameters | → | Instruction slot-filling steps |
| Test Cases | → | Golden Evaluations CSV |
Prerequisites
- 1. GCP Auth: INLINECODE4
- Project access: Dialogflow CX API enabled on the project
- Python: 3.10+
- Packages: INLINECODE5
Usage
Run Migration
CODEBLOCK0
Dry Run (fetch + preview, no files written)
CODEBLOCK1
Custom location (non-global agents)
CODEBLOCK2
Example (carconnect agent)
CODEBLOCK3
Expected output:
- - 14 flows → 13 sub-agents + root agent enrichment
- 31 intents → root routing hints
- 5 entity types → exported JSON
- 2 webhooks → 2 OpenAPI tools
- Test cases → golden_evals.csv
Post-Migration Steps
- 1. Review
ces_agent.json — check sub-agent instructions make sense, update tool endpoints - Import into CES Console:
- Go to
ces.cloud.google.com
- Select project → Import Agent → Upload
ces_agent.json
- 3. Upload Golden Evals:
- Evaluate tab → + Add test case → Golden → Upload file → select
golden_evals.csv
- 4. Re-create Entity Types from
entity_types.json (CES uses them as tool parameters) - Update webhook endpoints in the Tools section of your CES agent
- Run evaluation suite → review pass rates → iterate on instructions
Retry Logic
All Google API calls use exponential backoff (up to 4 attempts, base delay 1.5s × 2ⁿ). If the API is rate-limited or temporarily unavailable, the tool retries automatically.
Limitations & Known Gaps
- - Rich response types (carousels, chips, images) are converted to text messages. Update manually in CES.
- Conditional routes using session parameter syntax (
$session.params.X) are preserved as-is in instructions but may need updating for CES parameter syntax. - DTMF / telephony settings are not migrated (CES has different telephony config).
- Entity type import: CES does not have a direct batch import API for entity types — use the exported JSON as reference to create them manually or via REST.
- Webhook auth: OAuth and mTLS configs are noted but credentials must be re-configured in CES.
Autoresearch Evals (binary pass/fail)
When running autoresearch on this skill, use these evals:
- 1. EVALFLOWS: All non-default flows appear as sub-agents in
ces_agent.json? - EVALTOOLS: All webhooks appear as tools with OpenAPI schemas in
ces_agent.json? - EVALENTITIES: All entity types exported to
entity_types.json? - EVALEVALSCSV:
golden_evals.csv has correct header + at least one golden eval row? - EVALINSTRUCTIONS: Each sub-agent has non-empty instructions?
- EVAL_REPORT:
migration_report.md exists and contains a stats table?
Dialogflow CX → CES 迁移技能
技能功能
将 Dialogflow CX v3beta1 代理迁移至 Google Customer Engagement Suite (CES) 对话代理 格式,生成以下文件:
| 输出文件 | 内容 |
|---|
| cesagent.json | CES 代理定义(可通过控制台或 REST API 导入) |
| goldenevals.csv |
CES 批量评估 CSV(黄金测试用例) |
| entity_types.json | 实体类型定义(用于手动重建) |
| migration_report.md | 完整迁移摘要及后续步骤 |
迁移映射
| Dialogflow CX | → | CES 对话代理 |
|---|
| 代理 | → | 代理应用 + 根代理 |
| 流程(非默认) |
→ | 子代理 |
| 页面 + 路由 | → | 代理指令(自然语言) |
| 意图训练短语 | → | 根代理路由提示 |
| 实体类型 | → | 导出的 JSON(手动导入) |
| Webhook | → | 工具(OpenAPI 架构) |
| 表单参数 | → | 指令槽位填充步骤 |
| 测试用例 | → | 黄金评估 CSV |
前提条件
- 1. GCP 认证:gcloud auth application-default login
- 项目访问权限:项目上已启用 Dialogflow CX API
- Python:3.10+
- 依赖包:pip install google-cloud-dialogflow-cx google-auth
使用方法
运行迁移
bash
python migrate.py \
--project 你的项目ID \
--agent-id 你的代理UUID \
--output ./migration_output
试运行(获取+预览,不写入文件)
bash
python migrate.py \
--project 你的项目ID \
--agent-id 你的代理UUID \
--dry-run
自定义位置(非全局代理)
bash
python migrate.py \
--project 你的项目ID \
--agent-id 你的代理UUID \
--location us-central1 \
--output ./migration_output
示例(carconnect 代理)
bash
python migrate.py \
--project genaiguruyoutube \
--agent-id 3736c564-5b3b-4f93-bbb2-367e7f04e4e8 \
--output ./carconnect_ces
预期输出:
- - 14 个流程 → 13 个子代理 + 根代理增强
- 31 个意图 → 根路由提示
- 5 个实体类型 → 导出的 JSON
- 2 个 webhook → 2 个 OpenAPI 工具
- 测试用例 → golden_evals.csv
迁移后步骤
- 1. 审查 ces_agent.json — 检查子代理指令是否合理,更新工具端点
- 导入到 CES 控制台:
- 访问
ces.cloud.google.com
- 选择项目 → 导入代理 → 上传 ces_agent.json
- 3. 上传黄金评估:
- 评估标签页 → + 添加测试用例 → 黄金 → 上传文件 → 选择 golden_evals.csv
- 4. 从 entity_types.json 重新创建实体类型(CES 将其用作工具参数)
- 在 CES 代理的工具部分更新 webhook 端点
- 运行评估套件 → 审查通过率 → 迭代优化指令
重试逻辑
所有 Google API 调用均使用指数退避策略(最多 4 次尝试,基础延迟 1.5 秒 × 2ⁿ)。如果 API 受到速率限制或暂时不可用,工具将自动重试。
限制与已知差距
- - 富响应类型(轮播、快捷选项、图片)将转换为文本消息。请在 CES 中手动更新。
- 使用会话参数语法($session.params.X)的条件路由将在指令中保持原样,但可能需要根据 CES 参数语法进行更新。
- DTMF/电话设置不会迁移(CES 具有不同的电话配置)。
- 实体类型导入:CES 没有直接的实体类型批量导入 API — 请使用导出的 JSON 作为参考,手动或通过 REST 创建。
- Webhook 认证:OAuth 和 mTLS 配置会被记录,但凭据必须在 CES 中重新配置。
自动研究评估(二进制通过/不通过)
对此技能进行自动研究时,请使用以下评估项:
- 1. EVALFLOWS:cesagent.json 中所有非默认流程是否都作为子代理出现?
- EVALTOOLS:cesagent.json 中所有 webhook 是否都作为带有 OpenAPI 架构的工具出现?
- EVALENTITIES:所有实体类型是否都导出到 entitytypes.json?
- EVALEVALSCSV:goldenevals.csv 是否具有正确的标题行且至少包含一个黄金评估行?
- EVALINSTRUCTIONS:每个子代理是否都有非空指令?
- EVALREPORT:migrationreport.md 是否存在并包含统计表?