Agentforce bot upgrade

From forcedotcom/sf-skills · View interactive version

Agentforce bot upgrade is an AI agent skill from the GitHub repository forcedotcom/sf-skills. Use this skill to upgrade Einstein Bots into Agentforce agents end-to-end in a single pass, orchestrating per-bot Agent Spec generation, agentforce-generate authoring, and post-conversion .agent enhancements. TRIGGER when: user asks to migrate, upgrade, or convert one or more Einstein Bots (BotDefin

How to use this skill

Skill file

Einstein Bot Upgrade Orchestrator

Purpose

Run a multi-bot upgrade-and-handoff cycle. Each bot is converted into its own Agentforce agent; bots are processed independently and never combined or restructured across one another:

  1. Parse and validate bot/version pairs from --bots
  2. Follow Generate Agent Spec Reference per bot-version pair (parallelizable)
  3. /agentforce-generate per Agent Spec (parallelizable)
  4. Post-conversion enhancement pass per generated Agent Script (parallelizable)
  5. Consolidated run report

Run Completion Contract

The skill run is complete only after Step 4 and Step 5 have both been executed for every bot that reached Step 3. Generating the Agent Spec (Step 2) or the .agent file (Step 3) is NOT a completed run.

Record each outcome and continue to the next step.

Scope — this skill only converts Einstein Bots (BotDefinition/BotVersion chatbots) into new Agentforce agents. It does NOT migrate an existing Agentforce agent from a legacy GenAiPlannerBundle to an NGA aiAuthoringBundle — for that, use the agentforce-generate skill's "Migrate a Legacy Agent to Agent Script" flow.

Start-of-Run Disclaimer

Display this disclaimer to the user as the very first output of every invocation, in both online and offline mode, before Missing Input Handling, Step 1, or any tool call, file read, or org query. Rules:

  1. Output the block between BEGIN DISCLAIMER and END DISCLAIMER verbatim as rendered Markdown — not inside a code block, not summarized, reworded, or reordered. Keep every emoji marker; they are the color coding that draws the user's attention.
  2. Display it exactly once per invocation (not once per bot).
  3. Do not wait for an acknowledgement or end your turn after displaying it; continue the run in the same response with Missing Input Handling and Step 1. When --interactive=false, still display it.

BEGIN DISCLAIMER

## ⚠️ IMPORTANT — Read Before You Upgrade

This upgrade uses generative AI to turn your Einstein Bot's dialogs, intents, and variables into an Agentforce agent with subagents and actions. The result is a committed agent version that has not been activated. Review and test it before you activate it.

### 🔵 How your bot's design is translated

- Menus become intent-based routing. The agent doesn't reproduce menus and option-driven navigation. It identifies what the customer wants and routes to the right subagent. Each menu option's outcome is kept, but the step-by-step menu flow is not.

### 🔴 Not converted

- Bot goals. Agents don't need them.

- Some action steps: steps that produce no output, exist only to move between dialogs, or write feedback logs.

- Actions other than Apex classes and flows, such as object search. You can add these to the agent as custom actions.

- Menus in welcome messages. Use pre-chat configuration to collect routing information up front.

- Option buttons for questions with more than 11 options. The options aren't shown as buttons.

- Rich content and messaging components. Use adaptive response formats to format the agent's responses.

- File attachments, sent or received.

- Steps that change the conversation language partway through a conversation.

### 🟡 Configure after the upgrade

- Agent user. Assign a user to the agent.

- Channels and Omni-Flows. Connect the agent to your customer channels.

### 🟢 Recommendations

- Configure intents along with their descriptions in your bot, to match the corresponding dialog functionality before upgrading. Results depend on how good the source bot is.

- Review and test the agent before you activate it.

- If your bot uses context variables, deploy the agent to an embedded messaging channel and test the main use cases there.

- 💲 Agentforce Service Agent is billed on consumption, by usage type.

END DISCLAIMER

Inputs

Inputs:

If required inputs are missing, handle per the Missing Input Handling and Interactive Mode rules below.

Interactive Mode

--interactive controls whether the skill pauses for user input during execution:

Propagate the effective --interactive value to the per-bot Generate Agent Spec workflow (Step 2) and the post-conversion enhancement pass (Step 4).

Missing Input Handling

After displaying the Start-of-Run Disclaimer, resolve missing required launch inputs before Step 1:

  1. Online mode — --org-alias not provided. Resolve this before attempting to list bots (listing requires a target org).
  1. Online mode — bot name and version (--bots) not available.
  1. Offline mode — --offline-dir not available.

References

Use these reference files during execution:

  1. SF CLI Bot Reference
  2. Generate Agent Spec Reference
  3. Post-Conversion Enhancements Reference
  4. Extraction Blueprint
  5. Input Contract
  6. Mapping Rules
  7. Handoff Output Format
  8. Quality Checklist

Execution Contract

Step 1: Parse and Validate `--bots`

Execute Step 1 in this order:

  1. Resolve mode:
  1. Start fresh for this invocation:
  1. Build initial workload list:
  1. Validate input shape:
  1. Normalize workload entries:
  1. Enforce one-version-per-bot rule (online mode):
  1. Apply offline bot filter:
  1. Persist Step 1 output:

Step 2: Run Einstein Bot Upgrade (Per Bot-Version)

Execute the agent spec generation workflow from Generate Agent Spec Reference per bot-version combination:

Parallelization rule:

Ensure each invocation (online/offline) uses isolated working directories to avoid cross-run file collisions.

Hard rules:

Collect results:

  1. Build a ready-for-authoring list containing one entry per bot whose Agent Spec was generated successfully.
  1. Build a list of failed/incomplete upgrade runs (if any). Failed runs are excluded from Step 3 and reported in Step 5; they do not block other bots.

Step 3: Invoke Agentforce-Generate (Per Agent Spec)

For each entry in the ready-for-authoring list from Step 2:

  1. Add this recommendation to the generated invocation context before calling /agentforce-generate:
  1. Resolve run_project_dir from the ready-for-authoring entry.
  2. Read <run_project_dir>/agentforce-generate-invocation-prompt.md fully.
  3. Keep all instructions unchanged from the generated prompt.
  4. Invoke /agentforce-generate with this invocation context.
  5. Read <run_project_dir>/agentforce-generate-output-contract.md and capture outputs exactly as specified.

Parallelization rule:

Output-contract capture rules:

  1. Treat the output contract as authoritative for required fields/artifacts.
  2. If any contract field is missing, mark status as partial and list missing fields explicitly.
  3. Return captured outputs with deterministic keys matching the contract names.
  4. Preserve output file paths and status of each required artifact.
  5. If expected prompt/contract files are missing for an entry, mark that entry partial, record missing paths, and continue processing other entries.

Return-to-orchestrator rule:

Step 4: Post-Conversion Agent Script Enhancements (Per Generated Agent Script)

After Step 3 completes, for each generated .agent artifact:

  1. Resolve the generated .agent file path from captured /agentforce-generate outputs.
  2. Execute post-conversion enhancement workflow from Post-Conversion Enhancements Reference with:
  1. Require in-place enhancement:
  1. Online mode: the workflow compiles the enhanced Agent Script and, only when compilation succeeds, commits it as a new inactive agent version (sf agent publish authoring-bundle). Offline mode skips compile and commit.
  2. Online mode: for every publish attempt, including each retry, success, denial, or failure, append a structured audit record (actor, action, target, timestamp, outcome) to publish-audit.jsonl in the orchestrator working directory, as specified in the Post-Conversion Enhancements Reference.
  3. Capture per-file enhancement status, compile status, commit status, agent_id, agent_version, the publish audit records, and any partial failures.
  4. The enhancement workflow ends with a color-coded summary. That summary is an input to Step 5, not the run's final message. Do not end the turn after it; continue directly to Step 5.

Parallelization rule:

Step 5: Consolidate Run Report and Conclude

After Step 4 completes for every bot in the workload:

  1. Write a single consolidated, human-readable run report as a non-empty Markdown file named report.md (unless the caller names a different path) in the orchestrator working directory. Per bot, the report must state: the effective run mode, the bot id, the bot version, the generated Agent Spec path and generated .agent path, the commit status, agent ID, and agent version (online mode; state that the version is committed but not activated), the publish audit outcome with its timestamp and the path to publish-audit.jsonl (online mode), and — when --interactive=false — the auto-applied decisions.
  2. Treat the run report as the FINAL artifact: write it only after all other artifacts (Agent Spec(s), handoff JSON, open questions, and generated .agent file(s)) are already written.
  3. The run concludes only after report.md is written. Emit the final summary message then, and not before.
  4. Before emitting the final message, confirm for each bot:

If any of these is missing, go back and complete it first.

Deliverable

Return:

  1. parsed bot/version list
  2. per-bot upgrade execution status
  3. ready-for-authoring Agent Spec list and failed/incomplete runs from Step 2
  4. per-spec /agentforce-generate execution status
  5. generated handoff artifact paths per bot/spec
  6. captured /agentforce-generate outputs per output contract
  7. per-agent post-conversion enhancement status (including enhanced .agent file paths, compile status, commit status, agent ID, and agent version)
  8. path to the consolidated run report written in Step 5
  9. path to publish-audit.jsonl (online mode)
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.