observing-agentforce
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAgentforce Observability
Agentforce Observability
Improve Agentforce agents using session trace data and live preview testing.
Three-phase workflow:
- Observe -- Query STDM sessions from Data Cloud (if available), OR run test suites + preview with local traces as fallback
- Reproduce -- Use to simulate problematic conversations live
sf agent preview - Improve -- Edit the file directly, validate, publish, verify
.agent
利用会话跟踪数据和实时预览测试优化Agentforce代理。
三阶段工作流:
- 观察 -- 从Data Cloud查询STDM会话(若可用),或运行测试套件+本地跟踪预览作为备选方案
- 重现 -- 使用实时模拟有问题的对话
sf agent preview - 改进 -- 直接编辑文件,验证、发布、确认
.agent
Platform Notes
平台说明
- Shell examples below use bash syntax. On Windows, use PowerShell equivalents or Git Bash.
- Replace with
python3on Windows.python - Replace with
/tmp/(PowerShell) or$env:TEMP\(cmd).%TEMP%\ - Replace with
jqif jq is not installed.python -c "import json,sys; ..."
- 以下Shell示例使用bash语法。在Windows上,请使用PowerShell等效命令或Git Bash。
- 在Windows上将替换为
python3。python - 将替换为
/tmp/(PowerShell)或$env:TEMP\(cmd)。%TEMP%\ - 若未安装jq,将替换为
jq。python -c "import json,sys; ..."
Routing
路由逻辑
Gather these inputs before starting:
- Org alias (required)
- Agent API name (required for preview and deploy; ask if not provided)
- Agent file path (optional) -- path to the file, typically
.agent. Auto-detect if not provided.force-app/main/default/aiAuthoringBundles/<AgentName>/<AgentName>.agent - Session IDs (optional) -- analyze specific sessions; if absent, query last 7 days
- Days to look back (optional, default 7)
Determine intent from user input:
- No specific action -> run all three phases: Observe -> surface issues -> ask if user wants to Reproduce and/or Improve
- "analyze" / "sessions" / "what's wrong" -> Phase 1 only, then suggest next steps
- "reproduce" / "test" / "preview" -> Phase 2 (run Phase 1 first if no issues in hand)
- "fix" / "improve" / "update" -> Phase 3 (run Phase 1 first if no issues in hand)
开始前收集以下输入信息:
- 组织别名(必填)
- 代理API名称(预览和部署必填;若未提供请询问用户)
- 代理文件路径(可选)-- 文件的路径,通常为
.agent。若未提供则自动检测。force-app/main/default/aiAuthoringBundles/<AgentName>/<AgentName>.agent - 会话ID(可选)-- 分析特定会话;若未提供则查询最近7天的数据
- 回溯天数(可选,默认7天)
根据用户输入确定意图:
- 无特定操作 -> 运行全部三个阶段:观察 -> 发现问题 -> 询问用户是否要进行重现和/或改进
- 包含"analyze" / "sessions" / "what's wrong" -> 仅运行第一阶段,然后建议下一步操作
- 包含"reproduce" / "test" / "preview" -> 运行第二阶段(若未掌握问题,先运行第一阶段)
- 包含"fix" / "improve" / "update" -> 运行第三阶段(若未掌握问题,先运行第一阶段)
Resolve agent name
解析代理名称
Before any STDM query, resolve the user-provided agent name against the org to get the exact and :
MasterLabelDeveloperNamebash
sf data query --json \
--query "SELECT Id, MasterLabel, DeveloperName FROM GenAiPlannerDefinition WHERE MasterLabel LIKE '%<user-provided-name>%' OR DeveloperName LIKE '%<user-provided-name>%'" \
-o <org>- = display name used by STDM
MasterLabeland Agent Builder UI (e.g. "Order Service")findSessions - = API name with version suffix used in metadata (e.g. "OrderService_v9")
DeveloperName - The flag for
--api-nameusessf agent preview/activate/publishwithout theDeveloperNamesuffix (e.g. "OrderService")_vN
Store these values:
- -- for
AGENT_MASTER_LABELagent filterfindSessions() - --
AGENT_API_NAMEwithoutDeveloperNamesuffix, for_vNCLI commandssf agent - -- the Salesforce record ID for this agent
PLANNER_ID
在执行任何STDM查询前,将用户提供的代理名称与组织进行匹配,获取准确的和:
MasterLabelDeveloperNamebash
sf data query --json \
--query "SELECT Id, MasterLabel, DeveloperName FROM GenAiPlannerDefinition WHERE MasterLabel LIKE '%<user-provided-name>%' OR DeveloperName LIKE '%<user-provided-name>%'" \
-o <org>- = STDM
MasterLabel和Agent Builder UI使用的显示名称(例如"Order Service")findSessions - = 元数据中使用的带版本后缀的API名称(例如"OrderService_v9")
DeveloperName - 的
sf agent preview/activate/publish参数使用不带--api-name后缀的_vN(例如"OrderService")DeveloperName
存储以下值:
- -- 用于
AGENT_MASTER_LABEL代理过滤器findSessions() - -- 不带
AGENT_API_NAME后缀的_vN,用于DeveloperNameCLI命令sf agent - -- 该代理的Salesforce记录ID
PLANNER_ID
Locate the .agent file
定位.agent文件
Step 1 -- Search locally:
bash
find <project-root>/force-app/main/default/aiAuthoringBundles -name "*.agent" 2>/dev/nullIf the user provided an agent file path, use that directly. Otherwise, search for files matching .
AGENT_API_NAMEStep 2 -- If not found locally, retrieve from the org:
bash
sf project retrieve start --json --metadata "AiAuthoringBundle:<AGENT_API_NAME>" -o <org>Known bug:creates a double-nested path:sf project retrieve start. Fix it immediately after retrieve:force-app/main/default/main/default/aiAuthoringBundles/...
bash
if [ -d "force-app/main/default/main/default/aiAuthoringBundles" ]; then
mkdir -p force-app/main/default/aiAuthoringBundles
cp -r force-app/main/default/main/default/aiAuthoringBundles/* \
force-app/main/default/aiAuthoringBundles/
rm -rf force-app/main/default/main
fiStep 3 -- Validate the retrieved file:
Read the file and verify it has proper Agent Script structure:
.agent- block with
system:instructions: - block with
config:developer_name: - or
start_agentblocks withtopicreasoning: instructions: - Each topic should have distinct content (not identical across topics)
instructions:
Store the resolved path as for Phase 3.
AGENT_FILE步骤1 -- 本地搜索:
bash
find <project-root>/force-app/main/default/aiAuthoringBundles -name "*.agent" 2>/dev/null若用户提供了代理文件路径,则直接使用该路径。否则,搜索与匹配的文件。
AGENT_API_NAME步骤2 -- 若本地未找到,从组织获取:
bash
sf project retrieve start --json --metadata "AiAuthoringBundle:<AGENT_API_NAME>" -o <org>已知问题:会创建双重嵌套路径:sf project retrieve start。获取后立即修复:force-app/main/default/main/default/aiAuthoringBundles/...
bash
if [ -d "force-app/main/default/main/default/aiAuthoringBundles" ]; then
mkdir -p force-app/main/default/aiAuthoringBundles
cp -r force-app/main/default/main/default/aiAuthoringBundles/* \
force-app/main/default/aiAuthoringBundles/
rm -rf force-app/main/default/main
fi步骤3 -- 验证获取的文件:
读取文件并验证其是否具有正确的Agent Script结构:
.agent- 包含带的
instructions:块system: - 包含带的
developer_name:块config: - 包含带的
reasoning: instructions:或start_agent块topic - 每个主题应有不同的内容(主题间内容不重复)
instructions:
将解析后的路径存储为,用于第三阶段。
AGENT_FILEPhase 0: Discover Data Space
阶段0:发现数据空间
Before running any STDM query, determine the correct Data Cloud Data Space API name.
bash
sf api request rest "/services/data/v63.0/ssot/data-spaces" -o <org>Note: is a beta command -- do not add (that flag is unsupported and causes an error).
sf api request rest--jsonThe response shape is:
json
{
"dataSpaces": [
{
"id": "0vhKh000000g3DjIAI",
"label": "default",
"name": "default",
"status": "Active",
"description": "Your org's default data space."
}
],
"totalSize": 1
}The field is the API name to pass to .
nameAgentforceOptimizeServiceDecision logic:
- If the command fails (e.g. 404 or permission error), fall back to and note it as an assumption.
'default' - Filter to only entries.
status: "Active" - If exactly one active Data Space exists, use it automatically and confirm to the user: "Using Data Space: ".
<name> - If multiple active Data Spaces exist, show the list (label + name) and ask the user which to use.
Store the selected value as for all subsequent steps.
nameDATA_SPACE在执行任何STDM查询前,确定正确的Data Cloud数据空间API名称。
bash
sf api request rest "/services/data/v63.0/ssot/data-spaces" -o <org>注意:是beta版命令 -- 请勿添加(该参数不支持,会导致错误)。
sf api request rest--json响应格式如下:
json
{
"dataSpaces": [
{
"id": "0vhKh000000g3DjIAI",
"label": "default",
"name": "default",
"status": "Active",
"description": "Your org's default data space."
}
],
"totalSize": 1
}nameAgentforceOptimizeService决策逻辑:
- 若命令执行失败(例如404或权限错误),则默认使用并向用户说明这是假设值。
'default' - 仅筛选的条目。
status: "Active" - 若仅存在一个活跃数据空间,则自动使用该空间并向用户确认:"使用数据空间:"。
<name> - 若存在多个活跃数据空间,则显示列表(标签+名称)并询问用户使用哪个。
将选定的值存储为,用于后续所有步骤。
nameDATA_SPACEPrerequisite check: STDM DMOs
前置检查:STDM DMO
After deploying the helper class (step 1.0), run a quick probe to verify the STDM Data Model Objects exist in Data Cloud:
bash
sf apex run -o <org> -f /dev/stdin << 'APEX'
ConnectApi.CdpQueryInput qi = new ConnectApi.CdpQueryInput();
qi.sql = 'SELECT ssot__Id__c FROM "ssot__AiAgentSession__dlm" LIMIT 1';
try {
ConnectApi.CdpQueryOutputV2 out = ConnectApi.CdpQuery.queryAnsiSqlV2(qi, '<DATA_SPACE>');
System.debug('STDM_CHECK:OK rows=' + (out.data != null ? out.data.size() : 0));
} catch (Exception e) {
System.debug('STDM_CHECK:FAIL ' + e.getMessage());
}
APEXIf : STDM is not activated. Inform the user and switch to Phase 1-ALT:
STDM_CHECK:FAILSTDM (Session Trace Data Model) is not available in this org. To enable: Setup -> Data Cloud -> Data Streams and verify "Agentforce Activity" is active. Proceeding with fallback: test suites + local traces.
If , proceed to Phase 1 (STDM path).
STDM_CHECK:OK部署辅助类(步骤1.0)后,运行快速检测以验证Data Cloud中是否存在STDM数据模型对象:
bash
sf apex run -o <org> -f /dev/stdin << 'APEX'
ConnectApi.CdpQueryInput qi = new ConnectApi.CdpQueryInput();
qi.sql = 'SELECT ssot__Id__c FROM "ssot__AiAgentSession__dlm" LIMIT 1';
try {
ConnectApi.CdpQueryOutputV2 out = ConnectApi.CdpQuery.queryAnsiSqlV2(qi, '<DATA_SPACE>');
System.debug('STDM_CHECK:OK rows=' + (out.data != null ? out.data.size() : 0));
} catch (Exception e) {
System.debug('STDM_CHECK:FAIL ' + e.getMessage());
}
APEX若返回: STDM未激活。告知用户并切换到阶段1-备选方案:
STDM_CHECK:FAIL此组织中未启用STDM(会话跟踪数据模型)。启用方法:设置 -> Data Cloud -> 数据流,确认"Agentforce Activity"处于活跃状态。将使用备选方案:测试套件+本地跟踪。
若返回,则进入阶段1(STDM路径)。
STDM_CHECK:OKPhase 1-ALT: Observe Without STDM (Fallback Path)
阶段1-备选方案:无STDM时的观察( fallback路径)
When STDM is not available, use test suites and with local trace analysis.
sf agent preview --authoring-bundle| Data source | When to use | Pros | Cons |
|---|---|---|---|
| STDM (Phase 1) | Historical production analysis | Real user data, volume | Requires Data Cloud, 15-min lag |
| Test suites + local traces (Phase 1-ALT) | Dev iteration, orgs without STDM | Instant, full LLM prompt, variable state | Preview only, no real user data |
当STDM不可用时,使用测试套件和带本地跟踪分析的。
sf agent preview --authoring-bundle| 数据源 | 使用场景 | 优势 | 劣势 |
|---|---|---|---|
| STDM(阶段1) | 历史生产数据分析 | 真实用户数据,数据量大 | 需要Data Cloud,存在15分钟延迟 |
| 测试套件+本地跟踪(阶段1-备选方案) | 开发迭代,无STDM的组织 | 即时获取,完整LLM提示,变量状态可见 | 仅预览环境,无真实用户数据 |
1-ALT.1 Run existing test suite (if available)
1-备选方案.1 运行现有测试套件(若可用)
bash
sf agent test list --json -o <org>
sf agent test run --json --api-name <TestSuiteName> --wait 10 --result-format json -o <org> | tee /tmp/test_run.json
JOB_ID=$(python3 -c "import json; print(json.load(open('/tmp/test_run.json'))['result']['runId'])")
sf agent test results --json --job-id "$JOB_ID" --result-format json -o <org>bash
sf agent test list --json -o <org>
sf agent test run --json --api-name <TestSuiteName> --wait 10 --result-format json -o <org> | tee /tmp/test_run.json
JOB_ID=$(python3 -c "import json; print(json.load(open('/tmp/test_run.json'))['result']['runId'])")
sf agent test results --json --job-id "$JOB_ID" --result-format json -o <org>1-ALT.2 Derive test utterances from .agent file (if no test suite)
1-备选方案.2 从.agent文件生成测试语句(若无测试套件)
If no test suite exists, derive utterances: one per non-entry topic (from keywords), one per key action, one guardrail test, one multi-turn test.
description:若不存在测试套件,则生成测试语句:每个非入口主题生成一条(基于关键字),每个关键操作生成一条,一条防护测试语句,一条多轮对话测试语句。
description:1-ALT.3 Preview with --authoring-bundle
(local traces)
--authoring-bundle1-备选方案.3 使用--authoring-bundle
进行预览(本地跟踪)
--authoring-bundleRun each test utterance through preview to generate local trace files:
bash
sf agent preview start --json --authoring-bundle <BundleName> -o <org> | tee /tmp/preview_start.json
SESSION_ID=$(python3 -c "import json; print(json.load(open('/tmp/preview_start.json'))['result']['sessionId'])")
sf agent preview send --json --session-id "$SESSION_ID" --authoring-bundle <BundleName> \
--utterance "$UTT" -o <org> | tee /tmp/preview_response.json
sf agent preview end --json --session-id "$SESSION_ID" --authoring-bundle <BundleName> -o <org>Trace file location:
.sfdx/agents/{BundleName}/sessions/{sessionId}/traces/{planId}.json将每条测试语句通过预览运行,生成本地跟踪文件:
bash
sf agent preview start --json --authoring-bundle <BundleName> -o <org> | tee /tmp/preview_start.json
SESSION_ID=$(python3 -c "import json; print(json.load(open('/tmp/preview_start.json'))['result']['sessionId'])")
sf agent preview send --json --session-id "$SESSION_ID" --authoring-bundle <BundleName> \
--utterance "$UTT" -o <org> | tee /tmp/preview_response.json
sf agent preview end --json --session-id "$SESSION_ID" --authoring-bundle <BundleName> -o <org>跟踪文件位置:
.sfdx/agents/{BundleName}/sessions/{sessionId}/traces/{planId}.json1-ALT.4 Local trace diagnosis
1-备选方案.4 本地跟踪诊断
| Issue type | Trace command |
|---|---|
| Topic misroute | |
| Action not called | |
| LOW adherence | |
| Variable capture fail | |
| Vague instructions | |
DefaultTopic trace quirk: With , the root field often shows even when routing works. Always use for the real topic chain.
--authoring-bundle.topic"DefaultTopic"NodeEntryStateStep.data.agent_nameEntry answering directly (SMALL_TALK pattern): If trace shows grounding and transition tools visible but none invoked, add "You are a router only. Do NOT answer questions directly." to instructions.
start_agentSMALL_TALKstart_agent| 问题类型 | 跟踪命令 |
|---|---|
| 主题路由错误 | |
| 未调用操作 | |
| 低合规性 | |
| 变量捕获失败 | |
| 模糊指令 | |
DefaultTopic跟踪特性: 使用时,根字段通常显示,即使路由正常。请始终使用查看真实的主题链。
--authoring-bundle.topic"DefaultTopic"NodeEntryStateStep.data.agent_name入口直接响应(SMALL_TALK模式): 若跟踪显示SMALL_TALK基础和过渡工具可见但未调用任何工具,请在指令中添加"你仅作为路由使用。请勿直接回答问题。"
start_agentstart_agent1-ALT.5 Classify and present
1-备选方案.5 分类与展示
Classify issues using the categories in . After presenting findings, automatically proceed to agent config evidence analysis.
references/issue-classification.md使用中的分类对问题进行分类。展示结果后,自动进入代理配置证据分析环节。
references/issue-classification.mdPhase 1: Observe -- Query STDM
阶段1:观察 -- 查询STDM
Full STDM query details, Apex service deployment, and response parsing: seereferences/stdm-queries.md
完整的STDM查询细节、Apex服务部署和响应解析:请查看references/stdm-queries.md
1.0 Deploy helper class (once per org)
1.0 部署辅助类(每个组织部署一次)
Deploy Apex class to the org. Check if already deployed first:
AgentforceOptimizeServicebash
sf data query --json --query "SELECT Id, Name FROM ApexClass WHERE Name = 'AgentforceOptimizeService'" -o <org>If not deployed, copy from skill directory and deploy. See for full steps.
references/stdm-queries.md将 Apex类部署到组织。先检查是否已部署:
AgentforceOptimizeServicebash
sf data query --json --query "SELECT Id, Name FROM ApexClass WHERE Name = 'AgentforceOptimizeService'" -o <org>若未部署,则从技能目录复制并部署。完整步骤请查看。
references/stdm-queries.md1.1 Find sessions
1.1 查找会话
Query recent sessions using . Parse from the Apex debug log. If returns empty, switch to Phase 1-ALT.
findSessions()DEBUG|STDM_RESULT:findSessions使用查询最近的会话。从Apex调试日志中解析。若返回空结果,则切换到阶段1-备选方案。
findSessions()DEBUG|STDM_RESULT:findSessions1.2 Get conversation details
1.2 获取对话详情
Use for up to 5 sessions (most recent first). Returns turn-by-turn data with messages, steps, topics, and action results.
getMultipleConversationDetails()使用获取最多5个会话的详情(按时间从新到旧排序)。返回包含消息、步骤、主题和操作结果的逐轮对话数据。
getMultipleConversationDetails()1.2b Get LLM prompt/response (optional)
1.2b 获取LLM提示/响应(可选)
When LOW adherence detected, use to get the actual LLM prompt and response.
getLlmStepDetails()检测到低合规性时,使用获取实际的LLM提示和响应。
getLlmStepDetails()1.2c Get aggregated metrics (recommended first step)
1.2c 获取聚合指标(推荐第一步)
Use for high-level health dashboard: session rates, top intents, quality distribution, RAG averages.
getAggregatedMetrics()使用获取高级健康仪表盘:会话率、热门意图、质量分布、RAG平均值。
getAggregatedMetrics()1.2d Get moment insights (per-session detail)
1.2d 获取会话洞察(单会话详情)
Use for intent summaries, quality scores (1-5), and retriever metrics per session.
getMomentInsights()使用获取每个会话的意图摘要、质量分数(1-5)和检索器指标。
getMomentInsights()1.2e Run observability queries (RAG deep-dive)
1.2e 运行可观测性查询(RAG深度分析)
Use for targeted RAG analysis: KnowledgeGap, Hallucination, RetrievalQuality, AnswerRelevancy, Leaderboard.
runObservabilityQuery()使用进行针对性RAG分析:知识缺口、幻觉、检索质量、答案相关性、排行榜。
runObservabilityQuery()1.3 Reconstruct conversations
1.3 重构对话
Render turn-by-turn timeline from JSON for each session.
ConversationData从每个会话的 JSON中渲染逐轮对话时间线。
ConversationData1.4 Identify issues
1.4 识别问题
Full issue pattern table and classification categories: seereferences/issue-classification.md
Check each session for: action errors, topic misroutes, missing actions, wrong inputs, variable capture failures, no transitions, slow actions, LOW adherence, abandoned sessions, dead topics, publish drift, dead hub anti-pattern, entry answering directly, and safety issues.
Priority: P1 = action errors, misroutes, LOW adherence; P2 = missing actions, variable bugs, knowledge gaps; P3 = performance, abandoned sessions.
完整的问题模式表和分类类别:请查看references/issue-classification.md
检查每个会话是否存在以下问题:操作错误、主题路由错误、缺失操作、错误输入、变量捕获失败、无过渡、操作缓慢、低合规性、会话放弃、无效主题、发布漂移、无效枢纽反模式、入口直接响应、安全问题。
优先级:P1 = 操作错误、路由错误、低合规性;P2 = 缺失操作、变量错误、知识缺口;P3 = 性能问题、会话放弃。
1.5 Present findings and agent config evidence
1.5 展示结果和代理配置证据
Present sessions analyzed, issues grouped by root cause category, and uplift estimate. Then automatically proceed to analyze the file to confirm root causes.
.agentFull structural analysis checks, cross-reference procedures, and publish drift detection: seereferences/issue-classification.md
Retrieve the file from the org, run automated checks (topic count vs action blocks, dead hub detection, orphan actions, cross-topic variable dependencies), and cross-reference STDM symptoms against the file structure.
.agent展示分析的会话、按根本原因分类的问题,以及改进预估。然后自动获取文件进行分析,确认根本原因。
.agent完整的结构分析检查、交叉引用流程和发布漂移检测:请查看references/issue-classification.md
从组织获取文件,运行自动化检查(主题数量与操作块对比、无效枢纽检测、孤立操作、跨主题变量依赖),并将STDM症状与文件结构进行交叉引用。
.agentPhase 2: Reproduce -- Live Preview
阶段2:重现 -- 实时预览
Full preview procedures, trace diagnosis commands, and classification criteria: seereferences/reproduce-reference.md
Build one test scenario per confirmed issue from Phase 1. Run each through with (generates local traces). Run each scenario 3 times and classify:
sf agent preview--authoring-bundle| Verdict | Criteria |
|---|---|
| Same failure in 3/3 runs |
| Failure in 1-2 of 3 runs |
| Passes in 3/3 runs |
Only and issues proceed to Phase 3.
[CONFIRMED][INTERMITTENT]Key commands:
bash
sf agent preview start --json --authoring-bundle <Name> -o <org>
sf agent preview send --json --session-id "$SID" --utterance "<text>" --authoring-bundle <Name> -o <org>
sf agent preview end --json --session-id "$SID" --authoring-bundle <Name> -o <org>Trace location:
.sfdx/agents/{Name}/sessions/{sessionId}/traces/{planId}.json完整的预览流程、跟踪诊断命令和分类标准:请查看references/reproduce-reference.md
针对阶段1中确认的每个问题构建一个测试场景。通过带的运行每个场景(生成本地跟踪)。每个场景运行3次并分类:
--authoring-bundlesf agent preview| 结论 | 标准 |
|---|---|
| 3次运行均出现相同故障 |
| 1-2次运行出现故障 |
| 3次运行均通过 |
仅和问题进入阶段3。
[CONFIRMED][INTERMITTENT]关键命令:
bash
sf agent preview start --json --authoring-bundle <Name> -o <org>
sf agent preview send --json --session-id "$SID" --utterance "<text>" --authoring-bundle <Name> -o <org>
sf agent preview end --json --session-id "$SID" --authoring-bundle <Name> -o <org>跟踪文件位置:
.sfdx/agents/{Name}/sessions/{sessionId}/traces/{planId}.jsonPhase 3: Improve -- Edit .agent File Directly
阶段3:改进 -- 直接编辑.agent文件
Full procedures for pre-flight checks, fix mapping, instruction principles, regression prevention, deployment chain, verification, safety re-verification, and test case creation: seereferences/improve-reference.md
完整的预检检查、修复映射、指令原则、回归预防、部署流程、验证、安全重新验证和测试用例创建流程:请查看references/improve-reference.md
3.0 Pre-flight
3.0 预检
Verify all action targets exist and are registered in the org before editing. If targets are missing, present options: deploy stubs, remove actions, register via UI, or proceed with routing-only fixes.
编辑前验证所有操作目标是否存在并已在组织中注册。若目标缺失,则提供选项:部署存根、移除操作、通过UI注册,或仅进行路由修复。
3.1-3.3 Map issue, edit, and follow instruction principles
3.1-3.3 问题映射、编辑和遵循指令原则
Map each confirmed issue to a fix location in the file (description, instructions, actions, bindings, transitions). Use the Edit tool for targeted changes. Follow instruction principles: name actions explicitly, state pre-conditions, scope tightly, keep persona in only.
.agentsystem:将每个确认的问题映射到文件中的修复位置(描述、指令、操作、绑定、过渡)。使用编辑工具进行针对性修改。遵循指令原则:明确命名操作、说明前置条件、严格限定范围、仅在中定义角色。
.agentsystem:3.4 Regression prevention
3.4 回归预防
Establish baseline before editing. Make minimal edits. Test immediately after each edit. One fix per publish cycle. Check cross-topic dependencies. Test adjacent topics.
编辑前建立基准。尽量减少修改量。每次编辑后立即测试。每次发布仅修复一个问题。检查跨主题依赖。测试相邻主题。
3.5 Apply fixes
3.5 应用修复
Read the file, edit with the Edit tool (tabs for indentation), show the diff.
.agent读取文件,使用编辑工具进行修改(用制表符缩进),显示差异。
.agent3.6 Validate, deploy, publish, activate
3.6 验证、部署、发布、激活
bash
undefinedbash
undefinedValidate (dry run)
验证(试运行)
sf agent validate authoring-bundle --json --api-name <AGENT_API_NAME> -o <org>
sf agent validate authoring-bundle --json --api-name <AGENT_API_NAME> -o <org>
Publish (compile + deploy + activate)
发布(编译+部署+激活)
sf agent publish authoring-bundle --json --api-name <AGENT_API_NAME> -o <org>
If publish fails, use deploy + activate fallback (note: incomplete -- does not propagate `reasoning: actions:` to live metadata).sf agent publish authoring-bundle --json --api-name <AGENT_API_NAME> -o <org>
若发布失败,则使用部署+激活的备选方案(注意:该方案不完整 -- 不会将`reasoning: actions:`同步到实时元数据)。3.7 Verify
3.7 验证
Run Phase 2 scenarios post-fix. Check trace for correct routing, grounding, tools, and variables. After 24-48 hours, re-run Phase 1 to compare against baseline.
修复后运行阶段2的场景。检查跟踪是否存在正确的路由、基础设置、工具和变量。24-48小时后,重新运行阶段1与基准进行对比。
3.7b Safety re-verification (required)
3.7b 安全重新验证(必填)
Re-run safety review () on the modified file. Revert any changes that introduce BLOCK findings.
Section 15 of /developing-agentforce.agent对修改后的文件重新进行安全审查(的第15节)。若修改引入BLOCK级问题,则回滚。
.agent/developing-agentforce3.8 Update Testing Center test cases
3.8 更新测试中心测试用例
Create regression test cases from confirmed issues in Testing Center YAML format. Deploy with and verify all previously-broken scenarios pass.
sf agent test create从确认的问题中创建回归测试用例,采用测试中心YAML格式。使用部署并验证所有之前失败的场景均已通过。
sf agent test createReference Files
参考文件
| Reference | Contents |
|---|---|
| STDM query procedures, Apex service deployment, response parsing |
| Issue pattern table, root cause categories, structural analysis checks |
| Phase 2 preview procedures, trace diagnosis, classification criteria |
| Phase 3 editing, deployment chain, verification, safety, test cases |
| DMO field schemas, data hierarchy, quality notes, agent name resolution |
| 参考文件 | 内容 |
|---|---|
| STDM查询流程、Apex服务部署、响应解析 |
| 问题模式表、根本原因分类、结构分析检查 |
| 阶段2预览流程、跟踪诊断、分类标准 |
| 阶段3编辑流程、部署链、验证、安全、测试用例 |
| DMO字段 schema、数据层级、质量说明、代理名称解析 |