observing-agentforce
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAgentforce Observability
Agentforce 可观测性
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 Agent。
三阶段工作流:
- 观测——从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)
开始前收集以下输入信息:
- 组织别名(必填)
- Agent API名称(预览和部署必填;若未提供请询问用户)
- Agent文件路径(可选)——文件的路径,通常为
.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
解析Agent名称
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查询前,将用户提供的Agent名称与组织进行匹配,获取准确的和:
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的Agent筛选器findSessions() - —— 不带
AGENT_API_NAME后缀的_vN,用于DeveloperNameCLI命令sf agent - —— 该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 withsubagentreasoning: instructions: - Each subagent should have distinct content (not identical across subagents)
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文件路径,请直接使用该路径。否则,搜索匹配的文件。
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脚本结构:
.agent- 包含块和
system:instructions: - 包含块和
config:developer_name: - 包含或
start_agent块以及subagentreasoning: instructions: - 每个subagent应具有不同的内容(subagent之间内容不重复)
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时的观测(备选路径)
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 subagent (from keywords), one per key action, one guardrail test, one multi-turn test.
description:如果不存在测试套件,生成测试语句:每个非入口subagent对应一条(来自关键字),每个关键操作对应一条,一条防护测试语句,一条多轮测试语句。
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 |
|---|---|
| Subagent 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 subagent 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| 问题类型 | 追踪命令 |
|---|---|
| Subagent路由错误 | |
| 未调用操作 | |
| 低依从性 | |
| 变量捕获失败 | |
| 模糊指令 | |
DefaultTopic追踪异常: 使用时,根字段通常显示,即使路由正常。始终使用查看真实的subagent链。
--authoring-bundle.topic"DefaultTopic"NodeEntryStateStep.data.agent_name入口直接回复(SMALL_TALK模式): 如果追踪显示基础设置和过渡工具可见但未被调用,请在指令中添加"你仅作为路由使用。请勿直接回答问题。"
start_agentSMALL_TALKstart_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使用中的分类对问题进行分类。呈现结果后,自动继续分析Agent配置证据。
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, subagent misroutes, missing actions, wrong inputs, variable capture failures, no transitions, slow actions, LOW adherence, abandoned sessions, dead subagents, 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
检查每个会话是否存在以下问题:操作错误、subagent路由错误、缺失操作、错误输入、变量捕获失败、无过渡、操作缓慢、低依从性、会话中断、无效subagent、发布漂移、无效中心反模式、入口直接回复、安全问题。
优先级:P1 = 操作错误、路由错误、低依从性;P2 = 缺失操作、变量错误、知识缺口;P3 = 性能问题、会话中断。
1.5 Present findings and agent config evidence
1.5 呈现结果和Agent配置证据
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 (subagent count vs action blocks, dead hub detection, orphan actions, cross-subagent variable dependencies), and cross-reference STDM symptoms against the file structure.
.agent呈现分析的会话、按根因类别分组的问题以及优化预估。然后自动继续分析文件以确认根因。
.agent完整的结构分析检查、交叉引用流程和发布漂移检测:请查看references/issue-classification.md
从组织中获取文件,运行自动化检查(subagent数量与操作块对比、无效中心检测、孤立操作、跨subagent变量依赖),并将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-subagent dependencies. Test adjacent subagents.
编辑前建立基准。进行最小化修改。每次编辑后立即测试。每个发布周期修复一个问题。检查跨subagent依赖。测试相邻subagent。
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、数据层级、质量说明、Agent名称解析 |