sf-ai-agentscript

Agent Script DSL for deterministic Agentforce agents. TRIGGER when: user writes or edits .agent files, builds FSM-based agents, uses Agent Script CLI (sf agent generate/publish), or asks about deterministic agent patterns, slot filling, or instruction resolution. DO NOT TRIGGER when: Setup UI agent building (use sf-ai-agentforce), agent testing (use sf-ai-agentforce-testing), or persona design (use sf-ai-agentforce-persona).

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "sf-ai-agentscript" with this command: npx skills add jaganpro/sf-skills/jaganpro-sf-skills-sf-ai-agentscript

SF-AI-AgentScript Skill

Agent Script is the code-first path for deterministic Agentforce agents. Use this skill when the user is authoring .agent files, building finite-state topic flows, or needs repeatable control over routing, variables, actions, and publish behavior.

Start with the shortest guide first: references/activation-checklist.md

When This Skill Owns the Task

Use sf-ai-agentscript when the work involves:

  • creating or editing .agent files
  • deterministic topic routing, guards, and transitions
  • Agent Script CLI workflows (sf agent generate, sf agent validate, sf agent publish)
  • slot filling, instruction resolution, post-action loops, or FSM design

Delegate elsewhere when the user is:


Required Context to Gather First

Ask for or infer:

  • agent purpose and whether Agent Script is truly the right fit
  • Service Agent vs Employee Agent
  • target org and publish intent
  • expected actions / targets (Flow, Apex, PromptTemplate, etc.)
  • whether the request is authoring, validation, preview, or publish troubleshooting

Activation Checklist

Before you author or fix any .agent file, verify these first:

  1. Exactly one start_agent block
  2. No mixed tabs and spaces
  3. Booleans are True / False
  4. No else if and no nested if
  5. No top-level actions: block
  6. No @inputs in set expressions
  7. linked variables have no defaults
  8. linked variables do not use object / list types
  9. Use explicit agent_type
  10. Use @actions. prefixes consistently

For the expanded version, use references/activation-checklist.md.


Non-Negotiable Rules

1) Service Agent vs Employee Agent

Agent typeRequiredForbidden / caution
AgentforceServiceAgentValid default_agent_user, correct permissions, target-org checksPublishing without a real Einstein Agent User
AgentforceEmployeeAgentExplicit agent_typeSupplying default_agent_user

Full details: references/agent-user-setup.md

2) Required block order

config:
variables:
system:
connection:
knowledge:
language:
start_agent:
topic:

3) Critical config fields

FieldRule
developer_nameMust match folder / bundle name
agent_descriptionUse instead of legacy description
agent_typeSet explicitly every time
default_agent_userService Agents only

4) Syntax blockers you should treat as immediate failures

  • else if
  • nested if
  • comment-only if bodies
  • top-level actions:
  • invocation-level inputs: / outputs: blocks
  • reserved variable / field names like description and label

Canonical rule set: references/syntax-reference.md and references/validator-rule-catalog.md


Recommended Workflow

Recommended Authoring Workflow

Phase 1 — design the agent

  • decide whether the problem is actually deterministic enough for Agent Script
  • model topics as states and transitions as edges
  • define only the variables you truly need

Phase 2 — author the .agent

  • create config, system, start_agent, and topics first
  • add target-backed actions with full inputs: and outputs:
  • use available when for deterministic tool visibility
  • keep post-action checks at the top of instructions: ->

Phase 3 — validate continuously

Validation already runs automatically on write/edit. Use the CLI before publish:

sf agent validate authoring-bundle --api-name MyAgent -o TARGET_ORG --json

The validator covers structure, runtime gotchas, target readiness, and org-aware Service Agent checks. Rule IDs live in references/validator-rule-catalog.md.

Phase 4 — preview smoke test

Use the preview loop before publish:

  • derive 3–5 smoke utterances
  • start preview
  • inspect topic routing / action invocation / safety / grounding
  • fix and rerun up to 3 times

Full loop: references/preview-test-loop.md

Phase 5 — publish and activate

sf agent publish authoring-bundle --api-name MyAgent -o TARGET_ORG --json
sf agent activate --api-name MyAgent -o TARGET_ORG

Publishing does not activate the agent.


Deterministic Building Blocks

These execute as code, not suggestions:

  • conditionals
  • available when guards
  • variable checks
  • inline action execution
  • utility actions such as transitions / escalation
  • variable injection into LLM-facing text

See references/instruction-resolution.md and references/architecture-patterns.md.


Cross-Skill Integration

Cross-Skill Orchestration

TaskDelegate toWhy
Build flow:// targetssf-flowFlow creation / validation
Build Apex action targetssf-apex@InvocableMethod and business logic
Test topic routing / actionssf-ai-agentforce-testingFormal test specs and fix loops
Deploy / publishsf-deployDeployment orchestration

High-Signal Failure Patterns

SymptomLikely causeRead next
Internal Error during publishinvalid Service Agent user or missing action I/Oreferences/agent-user-setup.md, references/actions-reference.md
Parser rejects conditionalselse if, nested if, empty if bodyreferences/syntax-reference.md
Action target issuesmissing Flow / Apex target, inactive Flow, bad schemasreferences/actions-reference.md
Preview and runtime disagreelinked vars / context / known platform issuesreferences/known-issues.md
Validate passes but publish failsorg-specific user / permission / retrieve-back issuereferences/production-gotchas.md, references/cli-guide.md

Reference Map

Start here

Publish / runtime safety

Architecture / reasoning

Validation / testing / debugging

Examples / templates

Project documentation


Score Guide

ScoreMeaning
90+Deploy with confidence
75–89Good, review warnings
60–74Needs focused revision
< 60Block publish

Full rubric: references/scoring-rubric.md


Official Resources

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

sf-apex

No summary provided by upstream source.

Repository SourceNeeds Review
General

sf-lwc

No summary provided by upstream source.

Repository SourceNeeds Review
General

sf-metadata

No summary provided by upstream source.

Repository SourceNeeds Review
General

sf-flow

No summary provided by upstream source.

Repository SourceNeeds Review