sf-ai-agentforce
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese<!-- TIER: 1 | ENTRY POINT -->
<!-- This is the starting document — read this FIRST -->
<!-- Progressive disclosure: SKILL.md → Detailed Docs (Tier 2–3) -->
<!-- TIER: 1 | ENTRY POINT -->
<!-- This is the starting document — read this FIRST -->
<!-- Progressive disclosure: SKILL.md → Detailed Docs (Tier 2–3) -->
sf-ai-agentforce: Standard Agentforce Platform Development
sf-ai-agentforce:标准Agentforce平台开发
Expert Agentforce developer specializing in the Setup UI / Agentforce Builder approach to agent development. Covers topic and action configuration, GenAiFunction/GenAiPlugin metadata, PromptTemplate authoring, Einstein Models API, and custom Lightning types.
Code-first alternative: For programmatic agent development using Agent Script DSL (files), use sf-ai-agentscript instead. This skill covers the declarative, UI-driven approach..agent
专业Agentforce开发者,专注于通过Setup UI / Agentforce Builder方法进行代理开发。涵盖主题与动作配置、GenAiFunction/GenAiPlugin元数据、PromptTemplate编写、Einstein Models API以及自定义Lightning类型。
代码优先替代方案:如果要使用Agent Script DSL(文件)进行程序化代理开发,请改用sf-ai-agentscript。本技能涵盖的是声明式、UI驱动的开发方法。.agent
Overview
概述
Salesforce Agentforce enables organizations to build autonomous AI agents that handle customer interactions, automate tasks, and surface insights. This skill focuses on the standard platform approach:
- Agentforce Builder (Setup UI) for visual agent configuration
- GenAiFunction and GenAiPlugin metadata for registering actions
- PromptTemplate metadata for reusable AI prompts
- Einstein Models API () for native LLM access in Apex
aiplatform.ModelsAPI - Custom Lightning Types () for rich agent action UIs
LightningTypeBundle
Salesforce Agentforce 允许企业构建自主AI代理,用于处理客户交互、自动化任务并呈现洞察。本技能聚焦于标准平台方法:
- Agentforce Builder(Setup UI):用于可视化代理配置
- GenAiFunction 和 GenAiPlugin 元数据:用于注册动作
- PromptTemplate 元数据:用于可复用AI提示词
- Einstein Models API():用于在Apex中原生访问大语言模型(LLM)
aiplatform.ModelsAPI - 自定义Lightning类型():用于丰富的代理动作UI
LightningTypeBundle
Two Approaches to Agentforce
Agentforce的两种开发方式
| Approach | Skill | When to Use |
|---|---|---|
| Setup UI / Agentforce Builder | | Declarative agent config, point-and-click topics/actions |
| Agent Script DSL | | Code-first |
Both approaches produce agents that run on the same Agentforce runtime. Choose based on team preference and complexity requirements.
| 方式 | 对应技能 | 使用场景 |
|---|---|---|
| Setup UI / Agentforce Builder | | 声明式代理配置,通过点击操作配置主题/动作 |
| Agent Script DSL | | 代码优先的 |
两种方式构建的代理都运行在同一个Agentforce运行时。可根据团队偏好和复杂度需求进行选择。
Core Concepts
核心概念
Topics
主题(Topics)
Topics are the primary organizational unit for an agent's capabilities. Each topic groups related actions and instructions around a specific domain.
- Description: Tells the LLM planner when to route to this topic (must be specific and unambiguous)
- Scope: Defines what the topic can and cannot do (helps the planner make routing decisions)
- Instructions: Step-by-step guidance the agent follows when a topic is active
- Actions: The operations (Flow, Apex, Prompt Template) the agent can invoke within this topic
In the Agentforce Builder, topics are configured via Setup → Agentforce → Agents → [Agent] → Topics.
主题是代理能力的主要组织单元。每个主题围绕特定领域将相关的动作和指令分组。
- 描述:告知LLM规划器何时路由到该主题(必须具体且明确)
- 范围:定义主题可处理和不可处理的内容(帮助规划器做出路由决策)
- 指令:主题激活时代理需遵循的分步指导
- 动作:代理在该主题内可调用的操作(Flow、Apex、Prompt Template)
在Agentforce Builder中,可通过Setup → Agentforce → Agents → [代理名称] → Topics配置主题。
Actions
动作(Actions)
Actions are the executable operations an agent can perform. Each action wraps an underlying invocation target:
| Target Type | Description | Registered Via |
|---|---|---|
| Flow | Invokes an Autolaunched Flow | GenAiFunction with |
| Apex | Invokes an | GenAiFunction with |
| Prompt Template | Invokes a PromptTemplate | GenAiFunction with |
| Standard Action | Built-in platform actions (send email, create record) | Pre-registered by Salesforce |
动作是代理可执行的操作。每个动作封装了底层的调用目标:
| 目标类型 | 描述 | 注册方式 |
|---|---|---|
| Flow | 调用自动启动流 | 通过 |
| Apex | 调用 | 通过 |
| Prompt Template | 调用PromptTemplate | 通过 |
| 标准动作 | 平台内置动作(发送邮件、创建记录) | 由Salesforce预先注册 |
Instructions
指令(Instructions)
Instructions guide the agent's behavior within a topic. They are natural language directives that tell the LLM:
- What steps to follow
- When to invoke specific actions
- How to handle edge cases and errors
- When to escalate to a human agent
指令指导代理在主题内的行为。它们是自然语言指令,告知LLM:
- 需要执行哪些步骤
- 何时调用特定动作
- 如何处理边缘情况和错误
- 何时将问题升级给人工代理
Agent Builder Workflow
Agent Builder工作流
Step-by-Step: Creating an Agent via Setup UI
分步指南:通过Setup UI创建代理
1. Navigate to Agentforce Builder
Setup → Agentforce → Agents → New Agent2. Choose Agent Type
- Service Agent — Customer-facing support and service
- Employee Agent — Internal productivity and automation
3. Add Topics
For each capability area:
- Provide a clear Name and Description
- Write Instructions that guide the agent's reasoning
- Add a Scope statement (what's in/out of bounds)
4. Configure Actions per Topic
Assign actions to each topic. Actions can target:
- Autolaunched Flows (most common)
- Apex InvocableMethods (via GenAiFunction)
- Prompt Templates (for LLM-generated content)
- Standard platform actions
5. Set Action Inputs & Outputs
For each action:
- Define inputs the agent collects from the user (slot filling)
- Define outputs the agent uses in its response
- Mark which outputs are displayable to the user
6. Configure Agent-Level Settings
- System Instructions: Global persona and behavior guidelines
- Default Agent User: The running user context for the agent
- Welcome Message: Initial greeting
- Error Message: Fallback when something goes wrong
7. Preview & Test
bash
undefined1. 导航至Agentforce Builder
Setup → Agentforce → Agents → New Agent2. 选择代理类型
- 服务代理 — 面向客户的支持与服务
- 员工代理 — 内部生产力与自动化
3. 添加主题
针对每个能力领域:
- 提供清晰的名称和描述
- 编写指导代理推理的指令
- 添加范围声明(明确可处理和不可处理的内容)
4. 为每个主题配置动作
为每个主题分配动作。动作可指向:
- 自动启动流(最常用)
- Apex InvocableMethods(通过GenAiFunction)
- Prompt Templates(用于LLM生成内容)
- 标准平台动作
5. 设置动作输入与输出
针对每个动作:
- 定义代理从用户处收集的输入(槽位填充)
- 定义代理在响应中使用的输出
- 标记哪些输出可展示给用户
6. 配置代理级设置
- 系统指令:全局角色与行为准则
- 默认代理用户:代理运行时的用户上下文
- 欢迎消息:初始问候语
- 错误消息:出现问题时的回退提示
7. 预览与测试
bash
undefinedPreview in Agentforce Builder (uses standard org auth)
在Agentforce Builder中预览(使用标准组织权限)
sf agent preview --api-name MyAgent --target-org MyOrg
**8. Publish**
```bash
sf agent publish authoring-bundle --api-name MyAgent --target-org MyOrgsf agent preview --api-name MyAgent --target-org MyOrg
**8. 发布**
```bash
sf agent publish authoring-bundle --api-name MyAgent --target-org MyOrgPublish (skip metadata retrieve for CI/CD pipelines, v2.122.6+)
发布(在CI/CD流水线中跳过元数据检索,版本v2.122.6+)
sf agent publish authoring-bundle --api-name MyAgent --skip-retrieve --target-org MyOrg
---sf agent publish authoring-bundle --api-name MyAgent --skip-retrieve --target-org MyOrg
---GenAiFunction & GenAiPlugin Metadata
GenAiFunction & GenAiPlugin元数据
GenAiFunction
GenAiFunction
A registers a single action that an Agentforce agent can invoke. It wraps an underlying Flow, Apex method, or Prompt Template.
GenAiFunctionMetadata XML Structure:
xml
<?xml version="1.0" encoding="UTF-8"?>
<GenAiFunction xmlns="http://soap.sforce.com/2006/04/metadata">
<masterLabel>Look Up Order Status</masterLabel>
<developerName>Lookup_Order_Status</developerName>
<description>Retrieves the current status of a customer order</description>
<!-- Target: the Flow, Apex, or Prompt to invoke -->
<invocationTarget>Get_Order_Status_Flow</invocationTarget>
<invocationTargetType>flow</invocationTargetType>
<!-- Capability: tells the LLM planner WHEN to use this action -->
<capability>
Look up the current status of a customer's order when they
ask about shipping, delivery, or order tracking.
</capability>
<!-- Inputs: what the agent collects from the user -->
<genAiFunctionInputs>
<developerName>orderNumber</developerName>
<description>The customer's order number</description>
<dataType>Text</dataType>
<isRequired>true</isRequired>
</genAiFunctionInputs>
<!-- Outputs: what the action returns -->
<genAiFunctionOutputs>
<developerName>orderStatus</developerName>
<description>Current status of the order</description>
<dataType>Text</dataType>
<isRequired>true</isRequired>
</genAiFunctionOutputs>
</GenAiFunction>File Location:
force-app/main/default/genAiFunctions/Lookup_Order_Status.genAiFunction-meta.xmlGenAiFunction元数据XML结构:
xml
<?xml version="1.0" encoding="UTF-8"?>
<GenAiFunction xmlns="http://soap.sforce.com/2006/04/metadata">
<masterLabel>Look Up Order Status</masterLabel>
<developerName>Lookup_Order_Status</developerName>
<description>Retrieves the current status of a customer order</description>
<!-- Target: the Flow, Apex, or Prompt to invoke -->
<invocationTarget>Get_Order_Status_Flow</invocationTarget>
<invocationTargetType>flow</invocationTargetType>
<!-- Capability: tells the LLM planner WHEN to use this action -->
<capability>
Look up the current status of a customer's order when they
ask about shipping, delivery, or order tracking.
</capability>
<!-- Inputs: what the agent collects from the user -->
<genAiFunctionInputs>
<developerName>orderNumber</developerName>
<description>The customer's order number</description>
<dataType>Text</dataType>
<isRequired>true</isRequired>
</genAiFunctionInputs>
<!-- Outputs: what the action returns -->
<genAiFunctionOutputs>
<developerName>orderStatus</developerName>
<description>Current status of the order</description>
<dataType>Text</dataType>
<isRequired>true</isRequired>
</genAiFunctionOutputs>
</GenAiFunction>文件位置:
force-app/main/default/genAiFunctions/Lookup_Order_Status.genAiFunction-meta.xmlInvocation Target Types
调用目标类型
| Target Value | Notes |
|---|---|---|
| Flow API name | Flow must be Active |
| Apex class name | Class must have |
| PromptTemplate API name | Template must be Active |
| 目标值 | 说明 |
|---|---|---|
| Flow API名称 | Flow必须处于激活状态 |
| Apex类名 | 类必须包含 |
| PromptTemplate API名称 | 模板必须处于激活状态 |
GenAiPlugin
GenAiPlugin
A groups multiple entries into a logical unit. This is useful for organizing related actions.
GenAiPluginGenAiFunctionxml
<?xml version="1.0" encoding="UTF-8"?>
<GenAiPlugin xmlns="http://soap.sforce.com/2006/04/metadata">
<masterLabel>Order Management Plugin</masterLabel>
<developerName>Order_Management_Plugin</developerName>
<description>Actions for managing customer orders</description>
<genAiFunctions>
<functionName>Lookup_Order_Status</functionName>
</genAiFunctions>
<genAiFunctions>
<functionName>Cancel_Order</functionName>
</genAiFunctions>
<genAiFunctions>
<functionName>Return_Order</functionName>
</genAiFunctions>
</GenAiPlugin>File Location:
force-app/main/default/genAiPlugins/Order_Management_Plugin.genAiPlugin-meta.xmlGenAiPluginGenAiFunctionxml
<?xml version="1.0" encoding="UTF-8"?>
<GenAiPlugin xmlns="http://soap.sforce.com/2006/04/metadata">
<masterLabel>Order Management Plugin</masterLabel>
<developerName>Order_Management_Plugin</developerName>
<description>Actions for managing customer orders</description>
<genAiFunctions>
<functionName>Lookup_Order_Status</functionName>
</genAiFunctions>
<genAiFunctions>
<functionName>Cancel_Order</functionName>
</genAiFunctions>
<genAiFunctions>
<functionName>Return_Order</functionName>
</genAiFunctions>
</GenAiPlugin>文件位置:
force-app/main/default/genAiPlugins/Order_Management_Plugin.genAiPlugin-meta.xmlDeployment Order
部署顺序
- Deploy the underlying Flow / Apex / PromptTemplate first
- Deploy GenAiFunction metadata (references the targets)
- Deploy GenAiPlugin metadata (references the functions)
- Publish the Agent (references the plugin/functions via topics)
bash
undefined- 先部署底层的Flow / Apex / PromptTemplate
- 部署GenAiFunction元数据(引用目标)
- 部署GenAiPlugin元数据(引用函数)
- 发布代理(通过主题引用插件/函数)
bash
undefinedStep 1: Deploy targets
步骤1:部署目标
sf project deploy start -m "Flow:Get_Order_Status_Flow" --target-org MyOrg
sf project deploy start -m "Flow:Get_Order_Status_Flow" --target-org MyOrg
Step 2: Deploy GenAiFunction
步骤2:部署GenAiFunction
sf project deploy start -m "GenAiFunction:Lookup_Order_Status" --target-org MyOrg
sf project deploy start -m "GenAiFunction:Lookup_Order_Status" --target-org MyOrg
Step 3: Deploy GenAiPlugin (optional grouping)
步骤3:部署GenAiPlugin(可选分组)
sf project deploy start -m "GenAiPlugin:Order_Management_Plugin" --target-org MyOrg
sf project deploy start -m "GenAiPlugin:Order_Management_Plugin" --target-org MyOrg
Step 4: Publish agent
步骤4:发布代理
sf agent publish authoring-bundle --api-name MyAgent --target-org MyOrg
---sf agent publish authoring-bundle --api-name MyAgent --target-org MyOrg
---PromptTemplate Configuration
PromptTemplate配置
PromptTemplateTemplate Types: | | |
flexPromptsalesGenerationfieldCompletionrecordSummaryVariable Types: (runtime input) | (SObject field binding) | (child records) | (Static Resource)
freeTextrecordFieldrelatedListresourceKey Integration Points:
- Agent Action: Register a GenAiFunction with
invocationTargetType: prompt - Apex:
ConnectApi.EinsteinLlm.generateMessagesForPromptTemplate() - Flow: Use the "Prompt Template" action element
Full reference: See docs/prompt-templates.md for complete metadata structure, variable types, examples, Data Cloud grounding, and best practices.
PromptTemplate模板类型: | | |
flexPromptsalesGenerationfieldCompletionrecordSummary变量类型: (运行时输入) | (SObject字段绑定) | (子记录) | (静态资源)
freeTextrecordFieldrelatedListresource关键集成点:
- 代理动作:注册的GenAiFunction
invocationTargetType: prompt - Apex:
ConnectApi.EinsteinLlm.generateMessagesForPromptTemplate() - Flow:使用“Prompt Template”动作元素
完整参考:请查看docs/prompt-templates.md获取完整元数据结构、变量类型、示例、Data Cloud grounding以及最佳实践。
Models API
Models API
The Einstein Models API () enables native LLM access from Apex without external HTTP callouts. Use it for custom AI logic beyond what Agentforce topics/actions provide.
aiplatform.ModelsAPIAvailable Models:
- — Cost-effective general tasks
sfdc_ai__DefaultOpenAIGPT4OmniMini - — Complex reasoning
sfdc_ai__DefaultOpenAIGPT4Omni - — Nuanced understanding
sfdc_ai__DefaultAnthropic - — Multimodal tasks
sfdc_ai__DefaultGoogleGemini
Key Patterns:
- Queueable for single-record async AI processing
- Batch for bulk processing (scope size 10–20)
- Platform Events for notifying completion to LWC/Flow
Prerequisites: Einstein Generative AI enabled, API v61.0+, Einstein Generative AI User permission set assigned.
Full reference: See docs/models-api.md for complete Apex examples, Queueable/Batch patterns, Chatter integration, and governor limit guidance.
Einstein Models API()允许从Apex原生访问LLM,无需外部HTTP调用。可用于Agentforce主题/动作之外的自定义AI逻辑。
aiplatform.ModelsAPI可用模型:
- — 高性价比的通用任务
sfdc_ai__DefaultOpenAIGPT4OmniMini - — 复杂推理
sfdc_ai__DefaultOpenAIGPT4Omni - — 细致理解
sfdc_ai__DefaultAnthropic - — 多模态任务
sfdc_ai__DefaultGoogleGemini
关键模式:
- Queueable:用于单记录异步AI处理
- Batch:用于批量处理(范围大小10–20)
- 平台事件:用于向LWC/Flow通知完成状态
前提条件: 已启用Einstein生成式AI,API版本v61.0+,已分配Einstein Generative AI用户权限集。
完整参考:请查看docs/models-api.md获取完整Apex示例、Queueable/Batch模式、Chatter集成以及 governor limit 指南。
Custom Lightning Types
自定义Lightning类型
Custom Lightning Types () define structured data types with custom UI components for agent action inputs and outputs. When an agent action needs a rich input form or a formatted output display, create a custom type with:
LightningTypeBundle- schema.json — JSON Schema data structure definition
- editor.json — Custom input collection UI (lightning components)
- renderer.json — Custom output display UI (lightning components)
Requirements: API v64.0+ (Fall '25), Enhanced Chat V2 enabled in Service Cloud.
File Structure:
force-app/main/default/lightningTypeBundles/OrderDetails/
├── schema.json
├── editor.json
├── renderer.json
└── OrderDetails.lightningTypeBundle-meta.xmlFull reference: See docs/custom-lightning-types.md for complete schema examples, editor/renderer configuration, and integration with GenAiFunction.
自定义Lightning类型()定义了结构化数据类型以及用于代理动作输入和输出的自定义UI组件。当代理动作需要丰富的输入表单或格式化的输出展示时,可创建自定义类型,包含:
LightningTypeBundle- schema.json — JSON Schema数据结构定义
- editor.json — 自定义输入收集UI(lightning组件)
- renderer.json — 自定义输出展示UI(lightning组件)
要求: API版本v64.0+(2025年秋季),已在Service Cloud中启用Enhanced Chat V2。
文件结构:
force-app/main/default/lightningTypeBundles/OrderDetails/
├── schema.json
├── editor.json
├── renderer.json
└── OrderDetails.lightningTypeBundle-meta.xml完整参考:请查看docs/custom-lightning-types.md获取完整schema示例、editor/renderer配置以及与GenAiFunction的集成方法。
Orchestration Order
编排顺序
Prerequisite skills must run in this order:
sf-metadata → sf-apex → sf-flow → sf-ai-agentforce → sf-deployWhy this order:
- sf-metadata — Custom objects/fields must exist before Apex/Flows reference them
- sf-apex — InvocableMethod classes must be deployed before Flows or GenAiFunctions reference them
- sf-flow — Flows must be active before GenAiFunctions can target them
- sf-ai-agentforce (this skill) — GenAiFunction/GenAiPlugin metadata and agent configuration
- sf-deploy — Final deployment and agent publishing
MANDATORY Delegations:
| Requirement | Delegate To | Why |
|---|---|---|
| Flow creation | | 110-point validation, proper XML |
| Apex creation | | InvocableMethod generation, 150-point scoring |
| Deployment | | Centralized deployment orchestration |
必须按以下顺序运行前置技能:
sf-metadata → sf-apex → sf-flow → sf-ai-agentforce → sf-deploy顺序原因:
- sf-metadata — 自定义对象/字段必须先存在,才能被Apex/Flow引用
- sf-apex — InvocableMethod类必须先部署,才能被Flow或GenAiFunction引用
- sf-flow — Flow必须先激活,GenAiFunction才能将其作为目标
- sf-ai-agentforce(本技能) — GenAiFunction/GenAiPlugin元数据及代理配置
- sf-deploy — 最终部署和代理发布
强制委托:
| 需求 | 委托给 | 原因 |
|---|---|---|
| Flow创建 | | 110点验证,正确的XML格式 |
| Apex创建 | | InvocableMethod生成,150点评分 |
| 部署 | | 集中式部署编排 |
Cross-Skill Integration
跨技能集成
| Skill | Purpose | When to Use |
|---|---|---|
| sf-ai-agentscript | Agent Script DSL (code-first) | Writing |
| sf-ai-agentforce-testing | Agent testing | Test execution, coverage analysis, agentic fix loops |
| sf-flow | Flow actions | Creating Autolaunched Flows for agent actions |
| sf-apex | Apex actions | Writing InvocableMethod classes for agent actions |
| sf-deploy | Deployment | Publishing agents, deploying metadata |
| sf-metadata | Object/field setup | Creating SObjects and fields that actions reference |
| sf-integration | External APIs | Named Credentials, External Services for agent callouts |
| 技能 | 用途 | 使用场景 |
|---|---|---|
| sf-ai-agentscript | Agent Script DSL(代码优先) | 编写带有限状态机(FSM)架构的 |
| sf-ai-agentforce-testing | 代理测试 | 测试执行、覆盖率分析、代理修复循环 |
| sf-flow | Flow动作 | 为代理动作创建自动启动流 |
| sf-apex | Apex动作 | 为代理动作编写InvocableMethod类 |
| sf-deploy | 部署 | 发布代理、部署元数据 |
| sf-metadata | 对象/字段设置 | 创建动作引用的SObject和字段 |
| sf-integration | 外部API | 代理调用的命名凭据、外部服务 |
Integration Patterns
集成模式
| Direction | Pattern | Notes |
|---|---|---|
| Agent → Flow | GenAiFunction targets Flow | Most common action pattern |
| Agent → Apex | GenAiFunction targets InvocableMethod | For complex business logic |
| Agent → Prompt | GenAiFunction targets PromptTemplate | For AI-generated content |
| Agent → Custom Type | GenAiFunction uses LightningTypeBundle | Rich input/output UIs |
| Agent → External API | Flow/Apex wraps Named Credential callout | Via sf-integration skill |
| 方向 | 模式 | 说明 |
|---|---|---|
| 代理 → Flow | GenAiFunction以Flow为目标 | 最常见的动作模式 |
| 代理 → Apex | GenAiFunction以InvocableMethod为目标 | 用于复杂业务逻辑 |
| 代理 → Prompt | GenAiFunction以PromptTemplate为目标 | 用于AI生成内容 |
| 代理 → 自定义类型 | GenAiFunction使用LightningTypeBundle | 丰富的输入/输出UI |
| 代理 → 外部API | Flow/Apex封装命名凭据调用 | 通过sf-integration技能 |
Key Insights
关键洞察
| Insight | Issue | Fix |
|---|---|---|
| GenAiFunction requires active target | Deploying GenAiFunction before its Flow/Apex target | Deploy targets first, then GenAiFunction |
| PromptTemplate field bindings | | Check spelling and case sensitivity |
| Custom Lightning Types require v64.0+ | Bundle won't deploy on older API versions | Set |
| GenAiPlugin groups functions | Individual GenAiFunctions must exist before the plugin | Deploy GenAiFunctions before GenAiPlugin |
| Capability text is critical | Vague capability descriptions cause poor routing | Write specific, scenario-based capability text |
| Enhanced Chat V2 for custom types | Custom type UI won't render without it | Enable Enhanced Chat V2 in Setup → Chat Settings |
| Models API needs async context | Synchronous calls in triggers will timeout | Use Queueable with |
| Input/output names must match | GenAiFunction input names must match Flow variable API names | Verify exact name match (case-sensitive) |
| Validation before publish | Skipping validation causes late-stage failures | Always run |
| Data type mapping | GenAiFunction | Use |
| 洞察 | 问题 | 解决方案 |
|---|---|---|
| GenAiFunction需要激活的目标 | 在Flow/Apex目标之前部署GenAiFunction | 先部署目标,再部署GenAiFunction |
| PromptTemplate字段绑定 | | 检查拼写和大小写敏感性 |
| 自定义Lightning类型需要v64.0+ | 旧API版本下Bundle无法部署 | 在package.xml中设置 |
| GenAiPlugin分组函数 | 必须先存在单个GenAiFunction,才能创建插件 | 先部署GenAiFunction,再部署GenAiPlugin |
| 能力文本至关重要 | 模糊的能力描述会导致路由不佳 | 编写具体的、基于场景的能力文本 |
| 自定义类型需要Enhanced Chat V2 | 未启用时自定义类型UI无法渲染 | 在Setup → Chat Settings中启用Enhanced Chat V2 |
| Models API需要异步上下文 | 触发器中的同步调用会超时 | 使用带有 |
| 输入/输出名称必须匹配 | GenAiFunction输入名称必须与Flow变量API名称匹配 | 验证名称完全匹配(区分大小写) |
| 发布前验证 | 跳过验证会导致后期失败 | 始终先运行 |
| 数据类型映射 | GenAiFunction的 | 适当使用 |
Scoring System (100 Points)
评分系统(100分)
Categories
分类
| Category | Points | Key Criteria |
|---|---|---|
| Agent Configuration | 20 | System instructions, welcome/error messages, agent user set |
| Topic & Action Design | 25 | Clear descriptions, proper scope, logical routing, capability text |
| Metadata Quality | 20 | Valid GenAiFunction/GenAiPlugin XML, correct target types, input/output definitions |
| Integration Patterns | 15 | Proper orchestration order, dependency management, cross-skill delegation |
| PromptTemplate Usage | 10 | Variable bindings correct, template types appropriate, prompts well-structured |
| Deployment Readiness | 10 | Validation passes, dependencies deployed first, package.xml correct |
| 分类 | 分值 | 关键标准 |
|---|---|---|
| 代理配置 | 20 | 系统指令、欢迎/错误消息、代理用户设置 |
| 主题与动作设计 | 25 | 清晰的描述、合适的范围、合理的路由、能力文本 |
| 元数据质量 | 20 | 有效的GenAiFunction/GenAiPlugin XML、正确的目标类型、输入/输出定义 |
| 集成模式 | 15 | 正确的编排顺序、依赖管理、跨技能委托 |
| PromptTemplate使用 | 10 | 变量绑定正确、模板类型合适、提示词结构良好 |
| 部署就绪度 | 10 | 验证通过、依赖已先部署、package.xml正确 |
Thresholds
阈值
| Score | Rating | Action |
|---|---|---|
| 90–100 | Excellent | Deploy with confidence |
| 80–89 | Very Good | Minor improvements suggested |
| 70–79 | Good | Review before deploy |
| 60–69 | Needs Work | Address issues before deploy |
| < 60 | Critical | Block deployment |
| 分数 | 评级 | 操作 |
|---|---|---|
| 90–100 | 优秀 | 放心部署 |
| 80–89 | 非常好 | 建议进行小幅度改进 |
| 70–79 | 良好 | 部署前复查 |
| 60–69 | 需要改进 | 部署前解决问题 |
| < 60 | 严重问题 | 阻止部署 |
Validation Report Format
验证报告格式
Score: 87/100 ⭐⭐⭐⭐ Very Good
├─ Agent Configuration: 18/20 (90%)
├─ Topic & Action Design: 22/25 (88%)
├─ Metadata Quality: 17/20 (85%)
├─ Integration Patterns: 13/15 (87%)
├─ PromptTemplate Usage: 9/10 (90%)
└─ Deployment Readiness: 8/10 (80%)
Issues:
⚠️ [Metadata] GenAiFunction "Cancel_Order" missing output definition
⚠️ [Integration] Flow "Get_Order_Status" not yet deployed to org
✓ All PromptTemplate variable bindings valid
✓ GenAiPlugin references resolve correctlyScore: 87/100 ⭐⭐⭐⭐ Very Good
├─ Agent Configuration: 18/20 (90%)
├─ Topic & Action Design: 22/25 (88%)
├─ Metadata Quality: 17/20 (85%)
├─ Integration Patterns: 13/15 (87%)
├─ PromptTemplate Usage: 9/10 (90%)
└─ Deployment Readiness: 8/10 (80%)
Issues:
⚠️ [Metadata] GenAiFunction "Cancel_Order" missing output definition
⚠️ [Integration] Flow "Get_Order_Status" not yet deployed to org
✓ All PromptTemplate variable bindings valid
✓ GenAiPlugin references resolve correctlyDocument Map
文档地图
Tier 2: Detailed References
| Document | Description | Read When |
|---|---|---|
| docs/prompt-templates.md | Complete PromptTemplate metadata, variable types, Data Cloud grounding | Authoring reusable AI prompts |
| docs/models-api.md | | Building custom AI logic in Apex |
| docs/custom-lightning-types.md | LightningTypeBundle schema/editor/renderer configuration | Creating rich action input/output UIs |
Cross-Skill References
| Need | Skill |
|---|---|
| Agent Script DSL development | |
| Agent testing & coverage | |
| Flow creation for actions | |
| Apex InvocableMethod classes | |
| Metadata deployment | |
Tier 2:详细参考
| 文档 | 描述 | 阅读场景 |
|---|---|---|
| docs/prompt-templates.md | 完整的PromptTemplate元数据、变量类型、Data Cloud grounding | 编写可复用AI提示词时 |
| docs/models-api.md | | 在Apex中构建自定义AI逻辑时 |
| docs/custom-lightning-types.md | LightningTypeBundle schema/editor/renderer配置 | 创建丰富的动作输入/输出UI时 |
跨技能参考
| 需求 | 技能 |
|---|---|
| Agent Script DSL开发 | |
| 代理测试与覆盖率 | |
| 为动作创建Flow | |
| Apex InvocableMethod类 | |
| 元数据部署 | |
Version History
版本历史
| Version | Date | Changes |
|---|---|---|
| 2.0.0 | 2026-02-07 | Complete rewrite. Skill refocused on standard Agentforce platform (Setup UI, GenAiFunction/GenAiPlugin, PromptTemplate, Models API, Custom Lightning Types). Agent Script DSL content moved to |
| 版本 | 日期 | 变更 |
|---|---|---|
| 2.0.0 | 2026-02-07 | 完全重写。技能聚焦于标准Agentforce平台(Setup UI、GenAiFunction/GenAiPlugin、PromptTemplate、Models API、自定义Lightning类型)。Agent Script DSL内容移至 |
Sources & Acknowledgments
来源与致谢
| Source | Contribution |
|---|---|
| Salesforce Agentforce Documentation | Official platform reference |
| Salesforce Diaries | Models API patterns, Custom Lightning Types guide |
| trailheadapps/agent-script-recipes | Official Salesforce examples |
| Jag Valaiyapathy | Skill authoring, scoring system, orchestration design |
| 来源 | 贡献 |
|---|---|
| Salesforce Agentforce Documentation | 官方平台参考 |
| Salesforce Diaries | Models API模式、自定义Lightning类型指南 |
| trailheadapps/agent-script-recipes | Salesforce官方示例 |
| Jag Valaiyapathy | 技能编写、评分系统、编排设计 |
License
许可证
MIT License. See LICENSE file in sf-ai-agentforce folder.
Copyright (c) 2024–2026 Jag Valaiyapathy
MIT许可证。请查看sf-ai-agentforce文件夹中的LICENSE文件。
版权所有 (c) 2024–2026 Jag Valaiyapathy