service-itsm-agentic-setup-fulfiller-agent-configure
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCreate the IT Service Fulfiller Agent
创建IT Service Fulfiller Agent
Create and activate the IT Service Fulfiller Agent as a Next-Gen Authoring (NGA) native agent — Agent-Script-based (/bundle), appearing natively in Agentforce Studio's Agents list with no external-link icon — entirely through the Salesforce CLI (). This skill does not call the legacy ; instead it reuses the shipped ITSM Fulfiller template's and feeds it into the NGA bundle pipeline:
AiAuthoringBundleDefVersf/connect/service-itsm/createAgentagentScript- (
POST /nextgen-authoring/bundles) — creates the bundle + first version from the template's Agent Script.createBundleWithVersion - — publishes the version (creates the underlying
POST /nextgen-authoring/bundle-versions/{id}/publish/BotDefinition).BotVersion - — activates it.
POST /nextgen-authoring/bundle-versions/{id}/activate
Commands: for Connect API GET/POST; for the SOQL idempotency + verify reads.
sf api request restsf data queryHelper scripts (invoked via ) hold every JSON-parsing / decision rule so the model never eyeballs a response body (A9): (Studio-access + template-provisioning verdict), (idempotency + reactivation-need from the SOQL), (HTML-decodes and substitutes the template's , writes the bundle-create body to a JSON file so large content and free-text quotes never hit an inline shell string), (deterministic report renderer — single source of report text for chat-turn and harness file).
Bashclassify-preflight.mjsclassify-agent-existence.mjsBotDefinitionbuild-create-body.mjsagentScriptrender-report.mjsThe Fulfiller agent is the IT-technician-facing assistant — incident triage, case summarization, field updates, related-record automations. The employee self-service surface is .
service-itsm-agentic-setup-employee-agent-configure将IT Service Fulfiller Agent创建并激活为Next-Gen Authoring(NGA)原生Agent——基于Agent Script(/包),会原生显示在Agentforce Studio的Agent列表中,无外部链接图标——全程通过**Salesforce CLI()**完成。本技能不会调用旧版接口;而是复用已内置的ITSM履行者模板的,将其传入NGA包流程:
AiAuthoringBundleDefVersf/connect/service-itsm/createAgentagentScript- (
POST /nextgen-authoring/bundles)——从模板的Agent Script创建包及首个版本。createBundleWithVersion - ——发布该版本(创建底层的
POST /nextgen-authoring/bundle-versions/{id}/publish/BotDefinition)。BotVersion - ——激活该版本。
POST /nextgen-authoring/bundle-versions/{id}/activate
命令:使用调用Connect API的GET/POST请求;使用执行SOQL幂等性检查及验证读取操作。
sf api request restsf data query通过调用的辅助脚本包含所有JSON解析/决策规则,确保模型无需手动处理响应体(A9):(Studio访问权限+模板配置结果判定)、(基于 SOQL的幂等性+重新激活需求判定)、(HTML解码并替换模板的,将包创建请求体写入JSON文件,避免大内容和自由文本引号破坏内联shell字符串)、(确定性报告渲染器——为对话回合和测试工具文件提供统一的报告文本来源)。
Bashclassify-preflight.mjsclassify-agent-existence.mjsBotDefinitionbuild-create-body.mjsagentScriptrender-report.mjsFulfiller Agent是面向IT技术人员的助手——用于事件分类、案例摘要、字段更新以及相关记录自动化。员工自助服务端面对应的是。
service-itsm-agentic-setup-employee-agent-configureScope
范围
- In scope: Reading ; extracting the Fulfiller template's Agent Script (
agent-templates); creating the Fulfiller agent as an NGA-native agent viasvc_itsm_intelligence__ITSrvcMgmtFulfiller→createBundleWithVersion→publish; SOQL-verifying live; idempotent skip on duplicate developer name — all viaactivate.sf - Out of scope: The Employee agent — broad or ~47 specializations under (
svc_emp_intelligence__); enabling org-level feature toggles (validated byservice-itsm-agentic-setup-employee-agent-configure); low-level topic/action authoring; perm-set assignment; content-bundle deployment; CMDB CRUD; Discovery / Service Graph; the legacyservice-itsm-agentic-setup-agentforce-studio-validateroute.createAgent
- 包含范围:读取;提取履行者模板的Agent Script(
agent-templates);通过svc_itsm_intelligence__ITSrvcMgmtFulfiller→createBundleWithVersion→publish流程将履行者Agent创建为NGA原生Agent;通过SOQL验证其处于可用状态;基于重复开发者名称实现幂等跳过——所有操作均通过activate完成。sf - 排除范围:员工Agent——下的通用或约47个专用Agent(对应
svc_emp_intelligence__);启用组织级功能开关(由service-itsm-agentic-setup-employee-agent-configure验证);底层主题/操作创建;权限集分配;内容包部署;CMDB增删改查;Discovery/服务图谱;旧版service-itsm-agentic-setup-agentforce-studio-validate路由。createAgent
Preconditions
前置条件
If any of these are unmet, surfaces an auth error or a //; surface the raw error verbatim and stop — do not fabricate state.
sf401403404- CLI authenticated to the target org (
sfshows Connected). All calls usesf org display -o <alias>; never extract the access token by hand.--target-org <alias> - API v67.0+ — pinned in the URL path; do not hand-edit below the minimum.
- ITSM features + Fulfiller template provisioned (). If
svc_itsm_intelligence__ITSrvcMgmtFulfillerreturns nothing or the routes 404, runagent-templates.service-itsm-agentic-setup-agentforce-studio-validate - ≥ 18 on PATH.
node
若以下任意条件不满足,会返回认证错误或//;直接显示原始错误并终止操作——请勿伪造状态。
sf401403404- CLI已认证至目标组织(
sf显示已连接)。所有调用均使用sf org display -o <alias>参数;切勿手动提取访问令牌。--target-org <alias> - API版本v67.0+——在URL路径中固定指定;请勿手动修改为低于该版本。
- 已配置ITSM功能及履行者模板()。若
svc_itsm_intelligence__ITSrvcMgmtFulfiller返回空结果或路由返回404,请运行agent-templates。service-itsm-agentic-setup-agentforce-studio-validate - PATH中存在≥ 18。
node
Operations at a glance
操作概览
| Concern | Command | Notes |
|---|---|---|
| Studio access (precondition read) | | |
| List agent templates + Agent Script (read) | | |
| Enumerate the existing agent + latest version status (read) | | Keyed PRIMARILY on the template's |
| Create the NGA bundle (write) | | Body built by |
| Publish the bundle version (write) | | Returns |
| Activate the bundle version (write) | | Empty response on success; agent is now live and NGA-native |
| Activate an existing inactive version (write) | | Reactivation path only (Phase 2b) — skips create/publish |
| Verify agent is live (read) | | |
Full command shapes and the ITSM Connect API reference live in ; the reactivation-path call + idempotency verdict table live in ; the response-body error codes and recurring gotchas live in .
references/cli-invocation.mdreferences/reactivation.mdreferences/error-taxonomy.mdNever extract the access token. Use/sf api request restdirectly — they use the CLI's stored session for the target org. Do not pull thesf data queryout ofaccessTokenand hand-build an HTTP request with it; that bypasses the CLI session and leaks a bearer token into shell context.sf org display
rule.--jsontakessf data query(results come back in a--jsonenvelope — that's what the classifier expects)..result.records[]does not — omitsf api request restthere; its raw stdout body is already JSON.--json
| 关注点 | 命令 | 说明 |
|---|---|---|
| Studio访问权限(前置条件检查) | | |
| 列出Agent模板及Agent Script(读取) | | 必须指定 |
| 枚举现有Agent及最新版本状态(读取) | | 主要基于模板的 |
| 创建NGA包(写入) | | 请求体由 |
| 发布包版本(写入) | | 返回 |
| 激活包版本(写入) | | 成功时返回空响应;Agent此时处于可用状态且为NGA原生Agent |
| 激活现有非活跃版本(写入) | | 仅用于重新激活流程(第二阶段b)——跳过创建/发布步骤 |
| 验证Agent处于可用状态(读取) | | |
完整命令格式及ITSM Connect API参考位于;重新激活流程调用及幂等性判定表位于;响应体错误码及常见问题位于。
references/cli-invocation.mdreferences/reactivation.mdreferences/error-taxonomy.md切勿提取访问令牌。直接使用/sf api request rest——它们会使用CLI存储的目标组织会话。请勿从sf data query中提取sf org display并手动构建HTTP请求;这会绕过CLI会话并将Bearer令牌泄露至shell上下文。accessToken
规则。--json需要添加sf data query参数(结果会封装在--json中——这是分类器所需的格式)。.result.records[]不需要添加该参数;其标准输出本身已是JSON格式。sf api request rest
Shipped ITSM Fulfiller agent template
内置ITSM履行者Agent模板
| Template identifier | Default developer name |
|---|---|
| |
Thefield is the source of truth for the NGA create — notagentScript.idmatches onscripts/build-create-body.mjs, HTML-decodesmasterLabel, and substitutes the collectedagentScript/<developerName>into<label>/config.developer_namebefore it becomes the bundle'sconfig.agent_label. The Employee-facing agent is handled byresourceContent.service-itsm-agentic-setup-employee-agent-configure
| 模板标识符 | 默认开发者名称 |
|---|---|
| |
字段是NGA创建流程的唯一可信来源——而非agentScript。id会匹配scripts/build-create-body.mjs,HTML解码masterLabel,并将收集到的agentScript/<developerName>替换为<label>/config.developer_name,然后将其作为包的config.agent_label。面向员工的Agent由resourceContent处理。service-itsm-agentic-setup-employee-agent-configure
Architecture — Creation stages
架构——创建阶段
| Stage | What happens | Tool used |
|---|---|---|
| Preflight | Confirm Studio access ( | |
| Enumerate | Read the Fulfiller template ( | |
| Confirm-to-write | Present the exact developerName + label (the NGA create target), OR — if the existing agent is inactive — present the reactivation option instead, and require explicit "yes" either way | |
| Create (create path only) | POST | |
| Publish (create path only) | POST | |
| Activate | POST | |
| Verify | SOQL-read | |
Idempotency: keyed PRIMARILY on the template's (Phase-1 row — the platform's authoritative template→ link) and FALLING BACK to the collected . The Phase-2 read is (the half is both the null- fallback — the normal Fulfiller case — AND the guard for a dangling Id link whose target was deleted, so a stale link can't slip through to create), + latest (classified by the helper script). Outcomes: no match on either key ⇒ ⇒ create; ⇒ ALREADY-CREATED (skip the write, fall through to Phase 7 verification); (latest version ) ⇒ offer to activate the existing version instead of creating a new agent (Phase 2b) rather than silently skipping or duplicating. Why the fallback matters: the Fulfiller is never pre-provisioned and this skill's create path never stamps , so the template's is always — the -keyed fallback is the guard that actually catches a repeat run; short-circuiting straight to create on a null would re-create and collide with . The server does reject a duplicate at publish (unique-constraint → bundle cleanup), but only this Phase-2 read turns a repeat into a graceful skip instead of that hard error.
botDefinitionIdagent-templatesBotDefinition<developerName>BotDefinition WHERE Id='<botDefinitionId>' OR DeveloperName='<developerName>'ORbotDefinitionIdBotDefinitionBotVersion.Statusexists:falselatestVersionStatus:"Active"needsActivation:trueInactivetemplateNamebotDefinitionIdnull<developerName>botDefinitionIdDUPLICATE_VALUEDeveloperName| 阶段 | 操作内容 | 使用工具 |
|---|---|---|
| 预检 | 确认Studio访问权限( | |
| 枚举 | 读取履行者模板( | |
| 确认写入权限 | 显示确切的开发者名称+标签(NGA创建目标),或——若现有Agent处于非活跃状态——显示重新激活选项,且无论哪种情况均需用户明确回复“yes” | |
| 创建(仅创建流程) | 调用 | |
| 发布(仅创建流程) | 调用 | |
| 激活 | 调用 | |
| 验证 | 对 | |
幂等性:主要基于模板的(第一阶段行——平台官方的模板→关联),当该值为空时回退至收集到的。第二阶段的查询为(部分既是为空时的回退方案——履行者Agent的常规场景,也是针对无效Id链接(目标已删除)的防护措施,避免因陈旧链接导致重复创建),结合最新(由辅助脚本分类)。结果:两个键均无匹配 ⇒ ⇒ 创建; ⇒ 已创建(跳过写入步骤,直接进入第七阶段验证);(最新版本为Inactive) ⇒ 提供激活现有版本的选项而非创建新Agent(第二阶段b),而非静默跳过或重复创建。回退方案的重要性:履行者Agent从未预配置,且本技能的创建流程不会标记,因此模板的始终为空——基于的回退方案是防止重复运行的关键;若因为空直接跳过检查进入创建流程,会导致重复创建并触发错误。服务器会在发布阶段拒绝重复的(唯一约束→包清理),但只有第二阶段的查询能将重复运行转化为优雅跳过,而非硬错误。
botDefinitionIdagent-templatesBotDefinition<developerName>BotDefinition WHERE Id='<botDefinitionId>' OR DeveloperName='<developerName>'ORbotDefinitionIdBotDefinitionBotVersion.Statusexists:falselatestVersionStatus:"Active"needsActivation:truetemplateNamebotDefinitionId<developerName>botDefinitionIdDUPLICATE_VALUEDeveloperNameClarifying Questions
澄清问题
Collect from the user (ask only what is not already in conversation context):
| Field | Description | Default |
|---|---|---|
| Target org | The | Default org ( |
| Developer name | Unique | |
| Label | User-facing label for the agent | |
| Confirm the write | Explicit confirmation before the create/publish/activate sequence | REQUIRED — present the developerName + label and require "yes" via |
The idempotency read keys PRIMARILY on the template's (Phase-1 row) and FALLS BACK to the collected when that is null; the verify read keys on the publish response's (create path) or the template's (ALREADY-CREATED / reactivation). The collected and (defaults / ) also thread through the body — both the outer / AND the substituted / inside the Agent Script. Never hardcode the name in one call and collect it in another — a mismatch between the bundle's outer and the script's internal causes the platform to diverge the two. Creating an agent provisions a live, activated agent on the org; the user must explicitly approve the write.
botDefinitionId<developerName>publishedBotIdbotDefinitionId<developerName><label>IT_Service_Fulfiller_AgentIT Service Fulfiller AgentcreateBundleWithVersionapiNamelabelconfig.developer_nameconfig.agent_labelapiNamedeveloper_name需向用户收集以下信息(仅询问对话上下文中未包含的内容):
| 字段 | 描述 | 默认值 |
|---|---|---|
| 目标组织 | 创建Agent的 | 默认组织( |
| 开发者名称 | Agent的唯一 | |
| 标签 | Agent的用户可见标签 | |
| 确认写入权限 | 在创建/发布/激活序列前需用户明确确认 | 必填——显示开发者名称+标签,通过 |
幂等性查询主要基于模板的(第一阶段行),当该值为空时回退至收集到的;验证查询基于发布响应中的(创建流程)或模板的(已创建/重新激活流程)。收集到的和(默认值为/)也会贯穿请求体——包括外层的/以及Agent Script内部替换后的/。切勿在一处硬编码名称而在另一处收集名称——包的外层与脚本内部不匹配会导致平台状态不一致。创建Agent会在组织中配置一个可用的已激活Agent;用户必须明确批准写入操作。
botDefinitionId<developerName>publishedBotIdbotDefinitionId<developerName><label>IT_Service_Fulfiller_AgentIT Service Fulfiller AgentcreateBundleWithVersionapiNamelabelconfig.developer_nameconfig.agent_labelapiNamedeveloper_nameWorkflow
工作流
Substitute with the collected target org and / with the collected values. Full command shapes + per-phase verdict-branch handling live in — the phase summary below names each step and its load-bearing rule; the reference file holds the exact / invocations to copy.
<alias><developerName><label>references/workflow-detail.mdsfnode- Phase 0 — Establish . Invoke the deterministic helper (path is skill-root-qualified so it resolves regardless of the shell's CWD):
${SCRATCH_DIR}. Helper picks the base dir (SCRATCH_DIR="$(node "<skill_dir>/scripts/create-scratch-dir.mjs" "${outputDir:-}")", else${TMPDIR}, else the harness/tmplast-resort — scratch stays OUT of the scored${outputDir}tree) and emits the created dir on stdout. All transient JSON lands under${outputDir}; the durable${SCRATCH_DIR}stays under the harness dir.${outputDir}/report.md - Phase 1 — Preflight. Capture the Studio-access read + read (with the required
agent-templatesquery param) intoagentType=AgentforceEmployeeAgent, then classify via${SCRATCH_DIR}/agent-templates.json. The classifier also emitsscripts/classify-preflight.mjs "IT Service Fulfiller"from the matched row — capture it; it is the primary Phase-2 idempotency key (the collectedtemplate.botDefinitionIdis the fallback key). Branch on<developerName>:verdict⇒ Phase 2;READY⇒ prerequisite hand-off viaNOT-READY(delegate toAskUserQuestionon "yes");service-itsm-agentic-setup-agentforce-studio-validate⇒ surface + stop;ERROR(confirmed 404) does not block.studio.signal="CANNOT-CONFIRM" - Phase 2 — Idempotency (primary key , fallback key
botDefinitionId). Take<developerName>from Phase 1. Present ⇒ SOQLtemplate.botDefinitionIdwith theBotDefinition WHERE Id='<botDefinitionId>' OR DeveloperName='<developerName>'subquery (subquery is required — otherwiseBotVersionsis permanently false; theneedsActivationclause makes a dangling Id link — deleted target — fall back to the live same-name agent instead of a falseOR→ duplicate create). Empty/null (the normal Fulfiller case — the template row is never back-filled) ⇒ do NOT skip to create; fall back toexists:false(a self-created agent from a prior run has a null templateBotDefinition WHERE DeveloperName='<developerName>'but still exists). Either way classify viabotDefinitionId. Branch:scripts/classify-agent-existence.mjs ${SCRATCH_DIR}/bot-existing.json "<botDefinitionId-or-empty>" "<developerName>"⇒ Phase 2c (action-availability gate, then create);exists:false+exists:true⇒ ALREADY-CREATED (skip straight to Phase 7 — no action-availability gate; a live active agent's actions are already wired);needsActivation:false+exists:true⇒ Phase 2b. Non-zero exit ⇒ surface CLI error; never assume absent. Why the fallback: the Fulfiller is never pre-provisioned, soneedsActivation:trueis always null — a missing developerName check would re-create and hitbotDefinitionId.DUPLICATE_VALUE - Phase 2b — Reactivation offer. : "Fulfiller agent
AskUserQuestionexists but latest version is Inactive. Activate it?". On Yes:<developerName>withPOST /connect/bot-versions/<latestVersionId>/activationcaptured to{"status":"Active"}, then${SCRATCH_DIR}/activate-response.json—node "<skill_dir>/scripts/classify-activate-result.mjs" ${SCRATCH_DIR}/activate-response.json⇒ Phase 7 (verdict ACTIVATED);PASS⇒ surfaceFAILverbatim, offer the Phase 2c permset hand-off if a message names a missing invocable action, do NOT report ACTIVATED;messages[]⇒ fall through to Phase 7 SOQL verify. On No: stop, no writes.CANNOT-CONFIRM - Phase 2c — Action-availability preflight (create path only; reached only from Phase 2 ). Capture
exists:falsetosf api request rest "/services/data/v67.0/actions/custom/generatePromptResponse" --method GET, then${SCRATCH_DIR}/generate-prompt-response.json. Branch onnode "<skill_dir>/scripts/classify-action-availability.mjs" ${SCRATCH_DIR}/agent-templates.json "IT Service Fulfiller" ${SCRATCH_DIR}/generate-prompt-response.json:verdict⇒ Phase 3;READY⇒NOT-READYoffering hand-off toAskUserQuestion(surfaceservice-itsm-agentic-setup-itsm-agentforce-permset-assignverbatim — do NOT proceed to write; the activate call would return HTTP 200 with amissing[]silent-failure body);{success:false}⇒ surface reasons and proceed with caution (Phase 6 activate-result classifier catches the silent-failure body). Full contract inCANNOT-CONFIRM.references/action-availability.md - Phase 3 — Confirm-to-Write (REQUIRED, create path only). If was provided, first render the checkpoint file via
${outputDir}withrender-report.mjs(skip for interactive runs). THEN raise theverdict:"PENDING CONFIRMATION"gate presenting developerName + label + "NGA-native from the Fulfiller template's Agent Script". Proceed only on explicit "yes"; on "no", re-render withAskUserQuestion.verdict:"DECLINED" - Phase 4 — Create. (helper re-reads Phase-1 templates JSON, HTML-decodes the matched
scripts/build-create-body.mjs ${SCRATCH_DIR}/agent-templates.json "IT Service Fulfiller" "<developerName>" "<label>" ${SCRATCH_DIR}/create-bundle-body.json, substitutes internalagentScript/config.developer_name, writes body to file), thenconfig.agent_label. Capture responsePOST /nextgen-authoring/bundles --body @${SCRATCH_DIR}/create-bundle-body.json— that is theidfor Phases 5–6, notbundleVersionId.bundleId/403 FUNCTIONALITY_NOT_ENABLED⇒ trigger the Phase-1 hand-off; build-script exit 3 ⇒ surface stderr.404 - Phase 5 — Publish. (empty body required). Success:
POST /nextgen-authoring/bundle-versions/<bundleVersionId>/publish --body '{}'— this call creates the underlying{ lastPublishedOn, publishedBotId, publishedBotVersionId }/BotDefinition. Any error ⇒ surface verbatim; never activate an unpublished version.BotVersion - Phase 6 — Activate. captured to
POST /nextgen-authoring/bundle-versions/<bundleVersionId>/activate --body '{}', then${SCRATCH_DIR}/activate-response.json— activate can return HTTP 200 with anode "<skill_dir>/scripts/classify-activate-result.mjs" ${SCRATCH_DIR}/activate-response.jsonsilent-failure body when a referenced invocable action isn't surfaced; the classifier catches that.{success:false}⇒ Phase 7;PASS⇒ surfaceFAIL, offer Phase 2c permset hand-off if a message names a missing action, do NOT report CREATED;messages[]⇒ fall through to Phase 7 SOQL verify.CANNOT-CONFIRM - Phase 7 — Verify. SOQL (+
BotDefinition WHERE Id='<id>'subquery) and classify —BotVersionsis the create path's<id>(captured from Phase 5) or, on the ALREADY-CREATED / reactivation path, the live matched Id the Phase-2 classifier returned (itspublishedBotId/botDefinitionIdoutput — the actualagentIdof the matched record), not the Phase-1 templateBotDefinition.Id(which is always null for the Fulfiller, so on any existing-agent hit the verify would runbotDefinitionIdand falsely report failure after a successful skip/activation). ConfirmWHERE Id=''. Any discrepancy ⇒ report verbatim, do not fabricate success.exists:true, count:1, latestVersionStatus:"Active" - Phase 8 — Aggregate verdict. Emit CREATED / ALREADY-CREATED / ACTIVATED / FAILED (ACTIVATED on the Phase-2b path) + Id / bundle
BotDefinitionby re-invokingid— the single source of report text. Ifrender-report.mjswas provided, overwrite${outputDir}; otherwise emit stdout as the turn-side report.${outputDir}/report.md
将替换为收集到的目标组织,/替换为收集到的值。完整命令格式+各阶段判定分支处理逻辑位于——以下阶段摘要列出每个步骤及其核心规则;参考文件包含可直接复制的精确/调用命令。
<alias><developerName><label>references/workflow-detail.mdsfnode- 阶段0 — 创建。调用确定性辅助脚本(路径为技能根目录相对路径,确保无论shell的当前工作目录如何均可解析):
${SCRATCH_DIR}。辅助脚本会选择基础目录(优先SCRATCH_DIR="$(node "<skill_dir>/scripts/create-scratch-dir.mjs" "${outputDir:-}")",其次${TMPDIR},最后为测试工具的/tmp——临时文件会存放在评分用${outputDir}目录之外),并在标准输出中返回创建的目录。所有临时JSON文件均存放在${outputDir}下;持久化的${SCRATCH_DIR}存放在测试工具目录下。${outputDir}/report.md - 阶段1 — 预检。将Studio访问权限查询结果+查询结果(必须包含
agent-templates查询参数)保存至agentType=AgentforceEmployeeAgent,然后通过${SCRATCH_DIR}/agent-templates.json进行分类。分类器还会从匹配行中提取scripts/classify-preflight.mjs "IT Service Fulfiller"——请保存该值;它是第二阶段幂等性的主要键(收集到的template.botDefinitionId是回退键)。根据<developerName>分支:verdict⇒ 阶段2;READY⇒ 通过NOT-READY移交至前置条件检查流程(用户回复“yes”则委托给AskUserQuestion);service-itsm-agentic-setup-agentforce-studio-validate⇒ 显示错误并终止;ERROR(已确认404)不阻塞流程。studio.signal="CANNOT-CONFIRM" - 阶段2 — 幂等性检查(主键,回退键
botDefinitionId)。使用阶段1获取的<developerName>。执行⇒ 对template.botDefinitionId执行SOQL查询,包含BotDefinition WHERE Id='<botDefinitionId>' OR DeveloperName='<developerName>'子查询(必须包含子查询——否则BotVersions始终为false;needsActivation子句会使无效Id链接(目标已删除)回退至同名的可用Agent,而非错误地判定OR→重复创建)。空值/Null(履行者Agent的常规场景——模板行从未回填)⇒ 请勿直接跳过进入创建流程;回退至exists:false查询(之前运行创建的Agent的模板BotDefinition WHERE DeveloperName='<developerName>'为空,但Agent已存在)。无论哪种情况,均通过botDefinitionId进行分类。分支:scripts/classify-agent-existence.mjs ${SCRATCH_DIR}/bot-existing.json "<botDefinitionId-or-empty>" "<developerName>"⇒ 阶段2c(操作可用性检查,然后创建);exists:false+exists:true⇒ 已创建(直接跳至阶段7——无需操作可用性检查;可用的活跃Agent的操作已配置完成);needsActivation:false+exists:true⇒ 阶段2b。非零退出码 ⇒ 显示CLI错误;切勿假设结果不存在。回退方案的原因:履行者Agent从未预配置,因此needsActivation:true始终为空——若缺少开发者名称检查,会导致重复创建并触发botDefinitionId错误。DUPLICATE_VALUE - 阶段2b — 重新激活选项。调用:"履行者Agent
AskUserQuestion已存在,但最新版本处于非活跃状态。是否激活它?"。若用户回复是:调用<developerName>并传入POST /connect/bot-versions/<latestVersionId>/activation,将结果保存至{"status":"Active"},然后调用${SCRATCH_DIR}/activate-response.json——node "<skill_dir>/scripts/classify-activate-result.mjs" ${SCRATCH_DIR}/activate-response.json⇒ 阶段7(判定为已激活);PASS⇒ 直接显示FAIL内容,若消息中提到缺少可调用操作则提供阶段2c的权限集移交选项,请勿报告已激活;messages[]⇒ 直接进入阶段7的SOQL验证。若用户回复否:终止操作,不执行写入。CANNOT-CONFIRM - 阶段2c — 操作可用性预检(仅创建流程;仅当阶段2判定时进入)。将
exists:false的结果保存至sf api request rest "/services/data/v67.0/actions/custom/generatePromptResponse" --method GET,然后调用${SCRATCH_DIR}/generate-prompt-response.json。根据node "<skill_dir>/scripts/classify-action-availability.mjs" ${SCRATCH_DIR}/agent-templates.json "IT Service Fulfiller" ${SCRATCH_DIR}/generate-prompt-response.json分支:verdict⇒ 阶段3;READY⇒ 调用NOT-READY提供移交至AskUserQuestion的选项(直接显示service-itsm-agentic-setup-itsm-agentforce-permset-assign内容——请勿继续执行写入操作;激活调用会返回HTTP 200但包含missing[]的静默失败响应体);{success:false}⇒ 显示原因并谨慎继续(阶段6的激活结果分类器会捕获静默失败响应体)。完整约定位于CANNOT-CONFIRM。references/action-availability.md - 阶段3 — 确认写入权限(必填,仅创建流程)。若提供了,首先通过
${outputDir}渲染检查点文件,render-report.mjs(交互式运行可跳过)。然后调用verdict:"PENDING CONFIRMATION",显示开发者名称+标签+“基于履行者模板Agent Script的NGA原生Agent”。仅在用户明确回复“yes”时继续;若回复“no”,则重新渲染报告,AskUserQuestion。verdict:"DECLINED" - 阶段4 — 创建。调用(辅助脚本会重新读取阶段1的模板JSON,HTML解码匹配的
scripts/build-create-body.mjs ${SCRATCH_DIR}/agent-templates.json "IT Service Fulfiller" "<developerName>" "<label>" ${SCRATCH_DIR}/create-bundle-body.json,替换内部的agentScript/config.developer_name,将请求体写入文件),然后调用config.agent_label。保存响应中的POST /nextgen-authoring/bundles --body @${SCRATCH_DIR}/create-bundle-body.json——该值为阶段5-6使用的id,而非bundleVersionId。若返回bundleId/403 FUNCTIONALITY_NOT_ENABLED⇒ 触发阶段1的移交流程;构建脚本退出码为3 ⇒ 显示标准错误输出。404 - 阶段5 — 发布。调用(必须传入空请求体)。成功时返回:
POST /nextgen-authoring/bundle-versions/<bundleVersionId>/publish --body '{}'——此调用会创建底层的{ lastPublishedOn, publishedBotId, publishedBotVersionId }/BotDefinition。任何错误 ⇒ 直接显示错误内容;切勿激活未发布的版本。BotVersion - 阶段6 — 激活。调用并将结果保存至
POST /nextgen-authoring/bundle-versions/<bundleVersionId>/activate --body '{}',然后调用${SCRATCH_DIR}/activate-response.json——当引用的可调用操作未显示时,激活调用可能返回HTTP 200但包含node "<skill_dir>/scripts/classify-activate-result.mjs" ${SCRATCH_DIR}/activate-response.json的静默失败响应体;分类器会捕获此情况。{success:false}⇒ 阶段7;PASS⇒ 显示FAIL内容,若消息中提到缺少操作则提供阶段2c的权限集移交选项,请勿报告已创建;messages[]⇒ 直接进入阶段7的SOQL验证。CANNOT-CONFIRM - 阶段7 — 验证。对执行SOQL查询(包含
BotDefinition WHERE Id='<id>'子查询)并分类——BotVersions为创建流程中的<id>(从阶段5获取),或已创建/重新激活流程中第二阶段分类器返回的匹配Id(其publishedBotId/botDefinitionId输出——匹配记录的实际agentId),不可使用阶段1的模板BotDefinition.Id(履行者Agent的该值始终为空,因此若Agent已存在,验证查询会执行botDefinitionId并错误报告激活/跳过成功后的失败)。需确认WHERE Id=''。任何不一致 ⇒ 直接报告,请勿伪造成功。exists:true, count:1, latestVersionStatus:"Active" - 阶段8 — 汇总判定结果。通过重新调用输出CREATED / ALREADY-CREATED / ACTIVATED / FAILED(阶段2b流程判定为ACTIVATED)+
render-report.mjsId / 包BotDefinition——统一的报告文本来源。若提供了id,则覆盖${outputDir};否则在标准输出中显示对话回合报告。${outputDir}/report.md
Rules / Constraints
规则/约束
| Constraint | Rationale |
|---|---|
All calls go through | Leaks a bearer token into shell context; the CLI's stored session is the correct surface |
Idempotency read keys PRIMARILY on the template's | The Fulfiller is never pre-provisioned and the create path omits |
Preflight, idempotency, bundle-body construction, and report rendering all live in | JSON parsing + |
Three-call sequence: | Platform enforces DRAFT → published → active; response-body / empty-body / |
Enumerate | Subquery is what distinguishes Active/Inactive; the server rejects a duplicate |
| REQUIRED confirm-to-write checkpoint before create sequence or reactivation call | Both change live org state — explicit user approval required |
On | Enablement is a Setup-UI/admin action; |
| Report exact CLI response text on any error | Enables support to diagnose failures |
| 约束 | 理由 |
|---|---|
所有调用均通过 | 避免将Bearer令牌泄露至shell上下文;CLI存储的会话是正确的操作入口 |
幂等性查询主要基于模板的 | 履行者Agent从未预配置,且创建流程未包含 |
预检、幂等性检查、包请求体构建及报告渲染均通过 | JSON解析+ |
必须按顺序执行三次调用: | 平台强制要求流程为草稿→已发布→已激活;响应体/空请求体/ |
枚举 | 子查询是区分活跃/非活跃状态的关键;服务器会在发布阶段拒绝重复的 |
| 创建序列或重新激活调用前必须执行确认写入权限检查 | 两者都会修改组织的实时状态——需用户明确批准 |
若 | 功能启用是Setup UI/管理员操作; |
| 任何错误均需报告精确的CLI响应文本 | 便于支持人员诊断故障 |
Verification Checklist
验证清单
- Preflight classified by (PASS or documented CANNOT-CONFIRM); hand-off offered on FAIL; raw error surfaced on ERROR.
classify-preflight.mjs - Idempotency keyed on the template's (Phase-1 row) with the collected developerName as fallback;
botDefinitionId(theBotDefinition WHERE Id='<botDefinitionId>' OR DeveloperName='<developerName>'covers both a null and a danglingOR) + latestbotDefinitionId(subquery present) read + classified before any write.BotVersion.Status - If , Phase-2b reactivation offer presented — no silent skip, no duplicate create.
needsActivation:true - Explicit user confirmation at Phase 3 (create) or Phase 2b (reactivation) before any write.
- Bundle body built by , POSTed via
build-create-body.mjswith the collected--body @<file>/developerName; or write correctly skipped.label - Same (response
bundleVersionId) used for publish + activate; reactivation usedid; legacyPOST /connect/bot-versions/<id>/activationnever called.createAgent - Phase-7 verify confirmed present + latest version Active.
BotDefinition - Access token never extracted; final verdict + /bundle Id reported.
BotDefinition
- 预检已通过分类(通过或记录为CANNOT-CONFIRM);失败时提供移交选项;错误时显示原始错误。
classify-preflight.mjs - 幂等性检查基于模板的(阶段1行),回退至收集到的开发者名称;执行
botDefinitionId查询(BotDefinition WHERE Id='<botDefinitionId>' OR DeveloperName='<developerName>'覆盖OR为空或无效的情况)+ 最新botDefinitionId(包含子查询)并分类后再执行任何写入操作。BotVersion.Status - 若,则显示阶段2b的重新激活选项——不静默跳过,不重复创建。
needsActivation:true - 阶段3(创建)或阶段2b(重新激活)执行写入前已获得用户明确确认。
- 包请求体由生成,通过
build-create-body.mjs传入收集到的--body @<file>/developerName;或已正确跳过写入操作。label - 发布+激活使用相同的(响应中的
bundleVersionId);重新激活使用id;未调用旧版POST /connect/bot-versions/<id>/activation。createAgent - 阶段7验证已确认存在且最新版本为Active。
BotDefinition - 未提取访问令牌;已报告最终判定结果+/包Id。
BotDefinition
Output Format
输出格式
The report layout is generated deterministically by — the single source of report text for both the chat turn and the harness's . Never hand-compose the layout in prose (A9); always shell out to the helper. Full rendered shape, report-state JSON schema, and checkpoint-write rules live in .
scripts/render-report.mjs${outputDir}/report.mdreferences/report-format.mdTerminal verdicts: . When is set, write at Phase 3, Phase 6 (or Phase 2b), and Phase 8 — each write overwrites the same file. Skip these writes in interactive/chat surfaces.
CREATED | ALREADY-CREATED | ACTIVATED | PENDING CONFIRMATION | DECLINED | FAILED${outputDir}报告布局由确定性生成——为对话回合和测试工具的提供统一的报告文本来源。切勿手动编写报告布局(A9);始终调用辅助脚本。完整渲染格式、报告状态JSON schema及检查点写入规则位于。
scripts/render-report.mjs${outputDir}/report.mdreferences/report-format.md终端判定结果:。当设置时,需在阶段3、阶段6(或阶段2b)、阶段8写入报告——每次写入覆盖同一文件。交互式/对话场景可跳过这些写入操作。
CREATED | ALREADY-CREATED | ACTIVATED | PENDING CONFIRMATION | DECLINED | FAILED${outputDir}Reference File Index
参考文件索引
| File | When to read |
|---|---|
| Full per-phase verdict-branch narrative that the SKILL body summarizes (Phase-1 ERROR/NOT-READY/CANNOT-CONFIRM, Phase-2 classifier output, Phase-4 create response, error branches) |
| Every |
| Every phase — exact |
| Phase 2c (action-availability preflight, create path) + Phase 2b/6 (activate-result classifier) — silent-failure body catches, permset hand-off wording |
| Reactivation path ( |
| Any non-2xx response, unexpected empty body, or script non-zero exit — response-body error codes and recurring foot-guns |
| Every checkpoint that writes |
| 文件 | 阅读时机 |
|---|---|
| 所有阶段——完整的各阶段判定分支说明,为本技能正文的摘要(阶段1 ERROR/NOT-READY/CANNOT-CONFIRM、阶段2分类器输出、阶段4创建响应、错误分支) |
| 每次调用 |
| 所有阶段——精确的 |
| 阶段2c(操作可用性预检,创建流程)+ 阶段2b/6(激活结果分类器)——静默失败响应体捕获、权限集移交措辞 |
| 重新激活流程( |
| 任何非2xx响应、意外空响应体或脚本非零退出时——响应体错误码及常见陷阱 |
| 每次写入 |