---
id: daily-sf-ai-agentforce
name: "sf-ai-agentforce"
url: https://skills.yangsir.net/skill/daily-sf-ai-agentforce
author: jaganpro
domain: ai-app-building-integration
tags: ["salesforce", "ai-agents", "crm", "sales-automation", "platform-development"]
install_count: 1100
rating: 4.30 (20 reviews)
github: https://github.com/jaganpro/sf-skills
---

# sf-ai-agentforce

> Salesforce Agentforce平台标准开发路径，支持声明式主题、Builder管理操作、Prompt Builder模板和Models API集成

**Stats**: 1,100 installs · 4.3/5 (20 reviews)

## Before / After 对比

### Salesforce AI代理开发

**Before**:

手动配置Salesforce Agent、编写复杂触发器、设计对话流程和维护自定义代码，开发周期长且需要深厚技术积累

**After**:

使用声明式主题和Builder工具快速开发AI代理，自动生成Prompt模板和API集成，大幅降低开发门槛，快速上线智能客服

| Metric | Before | After | Change |
|---|---|---|---|
| 代理开发时间 | 160小时 | 20小时 | -87% |

## Readme

# sf-ai-agentforce

# sf-ai-agentforce: Standard Agentforce Platform Development

Use this skill for the **Setup UI / Agent Builder** path: declarative topics, Builder-managed actions, `GenAiFunction` / `GenAiPlugin` metadata, **Prompt Builder templates stored as `GenAiPromptTemplate` metadata**, Models API usage from Apex, and custom Lightning types.

For new code-first agent development, prefer [sf-ai-agentscript](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/../sf-ai-agentscript/SKILL.md).

If the work produces or edits a `.agent` file — including Builder Script / Canvas work that results in an authoring bundle — use [sf-ai-agentscript](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/../sf-ai-agentscript/SKILL.md).

## When This Skill Owns the Task

Use `sf-ai-agentforce` when the user is:

- maintaining existing Builder-based agents

- working in Setup → Agentforce → Agents

- creating or fixing `GenAiFunction`, `GenAiPlugin`, or `GenAiPromptTemplate` metadata

- wiring Builder topics to Flow / Apex / Prompt Builder actions

- using Models API or LightningTypeBundle in the context of Builder-based agents

Do **not** use it for:

- `.agent` files or deterministic FSM design → [sf-ai-agentscript](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/../sf-ai-agentscript/SKILL.md)

- agent test suites and coverage loops → [sf-ai-agentforce-testing](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/../sf-ai-agentforce-testing/SKILL.md)

- persona / voice design → [sf-ai-agentforce-persona](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/../sf-ai-agentforce-persona/SKILL.md)

## Required Context to Gather First

Ask for or infer:

- whether this is a Builder / Setup UI project or a code-first Agent Script project

- whether the user is editing Builder metadata or a `.agent` authoring bundle

- agent type: Service Agent or Employee Agent

- whether the work targets topics, actions, Prompt Builder templates, Models API, or custom Lightning types

- what supporting Flow / Apex / metadata dependencies already exist

- whether the user needs authoring help, publish help, or troubleshooting

## Two Agentforce Paths

Path
Skill
Best fit

Builder metadata path
`sf-ai-agentforce`
Declarative maintenance, existing Builder agents, metadata-driven action registration

Agent Script authoring bundle path
`sf-ai-agentscript`
Code-first `.agent` authoring, deterministic routing, version-controlled agent logic

If the user is starting from scratch and wants strong control over flow/state, route to Agent Script.

## Builder Workflow Summary

- Confirm this is a **Builder / Setup UI** project

- Pick Service Agent vs Employee Agent

- For Service Agents, provision the running user (prefer `sf org create agent-user`)

- For Employee Agents, plan visibility with a Permission Set containing `<agentAccesses>`

- Define topics with strong descriptions, scope, and instructions

- Prepare supporting actions (Flow, Apex, Prompt Builder template)

- Configure inputs / outputs carefully

- Validate dependencies and template status

- Publish, then activate

Expanded workflow: [references/builder-workflow.md](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/references/builder-workflow.md)

## Key Platform Rules

### Topic quality matters

Topic descriptions are routing instructions for the planner. They must be:

- specific

- scenario-based

- non-overlapping with sibling topics

### Actions are wrappers around real targets

Target type
Typical use
Registered via

Flow
safest default for Builder actions
`GenAiFunction`

Apex
complex business logic via `@InvocableMethod`
`GenAiFunction`

Prompt Builder template
generated summaries / drafts / recommendations
`GenAiFunction`

### Prompt Template vs GenAiPromptTemplate

- **Prompt Template** is the plain-English / UI term used in Prompt Builder.

- **`GenAiPromptTemplate`** is the current Metadata API type for source-driven template work.

- Prefer current source format: `genAiPromptTemplates/*.genAiPromptTemplate-meta.xml`.

- For flexible Prompt Builder templates, plan around the **5-input maximum** and consolidate inputs when needed.

- Prompt content should reference inputs with the current merge-field shape, e.g. `{!$Input:TargetRecord}` or `{!$Input:AdditionalContext}`.

### Supporting metadata deploys first

Before publishing the agent itself, deploy the supporting stack:

- metadata / fields if needed

- Apex if needed

- Flows if needed

- `GenAiPromptTemplate` / `GenAiFunction` / `GenAiPlugin`

- then publish the agent

### Service Agent running user

For Service Agents, prefer the native GA command:
`sf org create agent-user --target-org <alias> --json`
Use the returned username in the running-user configuration.

### Employee Agent visibility

For Employee Agents, ensure end users receive a Permission Set containing `<agentAccesses>`. Without this, the agent can be active but still invisible in Lightning Experience.
See [../sf-permissions/references/agent-access-guide.md](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/../sf-permissions/references/agent-access-guide.md).

### Publish does not activate

After publish, run `sf agent activate` separately.
For automation, prefer `sf agent activate --api-name <AgentName> --version <n> --target-org <alias> --json` so the rollout is deterministic and machine-readable.

## Metadata Guidance

### GenAiFunction

Use when registering a single callable action. Validate:

- target exists

- target is active / deployable

- input names match the target contract

- output names match the target contract

- capability text clearly says when the action should be used

### GenAiPlugin

Use when grouping related functions into one logical package.

### GenAiPromptTemplate

Use for generated content, not deterministic business rules.

Prefer the current metadata shape:

- metadata type: `GenAiPromptTemplate`

- folder: `genAiPromptTemplates/`

- file suffix: `.genAiPromptTemplate-meta.xml`

- content lives under `templateVersions`

- use published template versions before wiring actions that depend on them

### Models API

Use when the solution belongs in Apex-driven AI orchestration rather than Builder-only actions.

### Custom Lightning Types

Use when the action needs richer structured input or output presentation.

Expanded references:

- [references/metadata-reference.md](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/references/metadata-reference.md)

- [references/genaiprompttemplate.md](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/references/genaiprompttemplate.md)

## Cross-Skill Integration

### Recommended Orchestration Order

```
sf-metadata → sf-apex → sf-flow → sf-ai-agentforce → sf-deploy

```

### Required delegations

Requirement
Delegate to
Why

Create / fix Flows
[sf-flow](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/../sf-flow/SKILL.md)
Action target creation and Flow validation

Create / fix Apex actions
[sf-apex](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/../sf-apex/SKILL.md)
`@InvocableMethod` and Apex correctness

Deploy / publish
[sf-deploy](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/../sf-deploy/SKILL.md)
Deployment orchestration

Test the agent
[sf-ai-agentforce-testing](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/../sf-ai-agentforce-testing/SKILL.md)
Formal test execution and assertions

Employee Agent visibility / access
[sf-permissions](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/../sf-permissions/SKILL.md)
Permission Set `<agentAccesses>` setup

## High-Signal Failure Patterns

Symptom
Likely cause
Read next

Action not available in Builder
target metadata missing or not deployed
[references/metadata-reference.md](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/references/metadata-reference.md)

Prompt action fails during publish or activation
template is Draft, missing inputs, or old metadata shape is being used
[references/genaiprompttemplate.md](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/references/genaiprompttemplate.md)

Need more than 5 template inputs
flex template input limit hit
[references/genaiprompttemplate.md](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/references/genaiprompttemplate.md)

Apex AI logic times out
Models API work placed in the wrong context
[references/models-api.md](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/references/models-api.md)

Rich input/output UI not rendering
Lightning type config or prerequisites are incomplete
[references/custom-lightning-types.md](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/references/custom-lightning-types.md)

Agent publishes but is not usable
forgot explicit activation
[references/cli-commands.md](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/references/cli-commands.md)

Service Agent publish/runtime failure
missing or invalid running user
[../sf-ai-agentscript/references/agent-user-setup.md](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/../sf-ai-agentscript/references/agent-user-setup.md)

Employee Agent active but not visible to users
missing `<agentAccesses>` permission set
[../sf-permissions/references/agent-access-guide.md](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/../sf-permissions/references/agent-access-guide.md)

## Reference Map

### Start here

- [references/builder-workflow.md](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/references/builder-workflow.md)

- [references/metadata-reference.md](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/references/metadata-reference.md)

- [references/genaiprompttemplate.md](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/references/genaiprompttemplate.md)

- [references/cli-commands.md](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/references/cli-commands.md)

### Terminology and template planning

- [references/prompt-templates.md](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/references/prompt-templates.md)

- [references/models-api.md](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/references/models-api.md)

- [references/custom-lightning-types.md](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/references/custom-lightning-types.md)

### Rubric

- [references/scoring-rubric.md](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/references/scoring-rubric.md)

### Cross-skill reads

- [sf-ai-agentscript](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/../sf-ai-agentscript/SKILL.md)

- [sf-ai-agentforce-testing](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/../sf-ai-agentforce-testing/SKILL.md)

- [sf-flow](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/../sf-flow/SKILL.md)

- [sf-apex](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/../sf-apex/SKILL.md)

- [sf-permissions](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/../sf-permissions/SKILL.md)

- [sf-deploy](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/../sf-deploy/SKILL.md)

## Score Guide

Score
Meaning

90+
Ready to deploy

80–89
Strong, minor cleanup only

70–79
Review before deploy

60–69
Needs work

< 60
Block deployment

Full rubric: [references/scoring-rubric.md](https://github.com/jaganpro/sf-skills/blob/HEAD/skills/sf-ai-agentforce/references/scoring-rubric.md)
Weekly Installs447Repository[jaganpro/sf-skills](https://github.com/jaganpro/sf-skills)GitHub Stars298First SeenJan 22, 2026Security Audits[Gen Agent Trust HubPass](/jaganpro/sf-skills/sf-ai-agentforce/security/agent-trust-hub)[SocketPass](/jaganpro/sf-skills/sf-ai-agentforce/security/socket)[SnykPass](/jaganpro/sf-skills/sf-ai-agentforce/security/snyk)Installed oncodex435opencode433cursor432github-copilot431gemini-cli431amp430

---
*Source: https://skills.yangsir.net/skill/daily-sf-ai-agentforce*
*Markdown mirror: https://skills.yangsir.net/api/skill/daily-sf-ai-agentforce/markdown*