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 authoring-bundle, sf agent validate authoring-bundle, sf agent preview, sf agent publish authoring-bundle, sf agent activate), or asks about deterministic agent patterns, slot filling, or instruction resolution. DO NOT TRIGGER when: Builder metadata work (use sf-ai-agentforce), agent testing (use sf-ai-agentforce-testing), or persona design (use sf-ai-agentforce-persona).
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 authoring-bundle, sf agent validate authoring-bundle, sf agent preview, sf agent publish authoring-bundle, sf agent activate), or asks about deterministic agent patterns, slot filling, or instruction resolution. DO NOT TRIGGER when: Builder metadata work (use sf-ai-agentforce), agent testing (use sf-ai-agentforce-testing), or persona design (use sf-ai-agentforce-persona).
license
MIT
compatibility
Requires Agentforce license and API v66.0+; Einstein Agent User is required for Service Agents only
metadata
{"version":"2.9.0","author":"Jag Valaiyapathy","scoring":"100 points across 6 categories","validated":"0-shot generation tested against multiple representative sample agents. Agent user setup validated against representative Service Agent and Employee Agent scenarios.","last_validated":"2026-03-20","validation_status":"PASS","validation_agents":"24","validate_by":"2026-04-10"}
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.
More determinism is not automatically better. Start minimal, then harden only the parts that show routing drift, sequencing failures, or compliance risk.
Required Context to Gather First
Ask for or infer:
agent purpose and whether Agent Script is truly the right fit
Official Salesforce materials present top-level blocks in differing sequences, and local validation evidence indicates multiple orderings compile. Treat this as a style convention, not a standalone correctness or publish blocker.
3) Critical config fields
Field
Rule
developer_name
Must match folder / bundle name
description
Public docs/examples should use this config field
agent_type
Set explicitly every time
default_agent_user
Service Agents only
Local tooling also accepts agent_description: for compatibility, but this skill's public docs and examples should prefer description:.
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
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
normalize raw intent/validation signals into booleans or enums before branching; avoid direct substring checks on raw user utterances for critical control flow
keep post-action checks at the top of instructions: ->
Default authoring stance
Default to direct .agent authoring and edits in source control.
Use sf agent generate authoring-bundle --no-spec only when the user wants local bundle scaffolding.
Treat sf agent generate agent-spec as optional ideation / topic bootstrap, not the default workflow.
Do not route Agent Script users toward sf agent create or sf agent generate template.
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 with the start / send / end subcommands, not bare sf agent preview
if you use --authoring-bundle, always choose a mode explicitly: --simulate-actions or --use-live-actions