Skip to content

forcedotcom/sf-skills / plugins/builder/agentforce-adlc/skills/agentforce-generate

agentforce-generate

Flagged

Build, modify, audit, repair, optimize, debug, and deploy agents with Agentforce Agent Script. TRIGGER when: user creates, reviews, or changes .agent files or aiAuthoringBundle metadata; asks to fix AgentScript, audit an existing agent, run an AgentScript health check, common-pitfall review, or baseline-versus-candidate repair loop; changes a response, action, subagent, route, state flow, or Agent Spec; migrates or upgrades a legacy GenAiPlannerBundle Agentforce agent (NOT an Einstein Bot) to an aiAuthoringBundle (Agent Script) agent; previews, debugs, deploys, publishes, or tests agents; uses sf agent generate/preview/publish/test; or manages Agentforce MCP servers, tools, assets, or authentication. DO NOT TRIGGER when: Apex, Flow, Prompt Template, Experience Cloud, or general Salesforce CLI work is unrelated to Agent Script; the source is an Einstein Bot (BotDefinition/BotVersion) — use agentforce-bot-upgrade; or the primary input is a production session or trace ID rather than an agent artifact.

FileKindSize
README.mdmarkdown5.4 KB
SKILL.mdskill md31.7 KB
assets/agent-spec-template.mdmarkdown6.4 KB
assets/agents/README.mdmarkdown2.6 KB
assets/agents/hello-world.agentother1.9 KB
assets/agents/knowledge-grounded.agentother5.6 KB
assets/agents/local-info-agent-annotated.agentother17.0 KB
assets/agents/order-service.agentother11.7 KB
assets/agents/production-faq.agentother3.9 KB
assets/agents/production-faq.bundle-meta.xmlconfig161 B
assets/agents/router-first.agentother5.6 KB
assets/agents/simple-qa.agentother1.9 KB
assets/agents/template-multi-subagent.agentother5.4 KB
assets/agents/template-single-subagent.agentother2.6 KB
assets/agents/verification-gate.agentother10.7 KB
assets/agents/voice-knowledge-grounded.agentother8.2 KB
assets/agents/voice-service-agent.agentother4.6 KB
assets/bundle-meta.xmlconfig808 B
assets/invocable-apex-template.clsother6.9 KB
assets/patterns/README.mdmarkdown10.8 KB
assets/patterns/action-callbacks.agentother4.7 KB
assets/patterns/advanced-input-bindings.agentother6.9 KB
assets/patterns/bidirectional-routing.agentother5.6 KB
assets/patterns/critical-input-collection.agentother12.2 KB
assets/patterns/delegation-routing.agentother6.4 KB
assets/patterns/lifecycle-events.agentother4.7 KB
assets/patterns/llm-controlled-actions.agentother5.1 KB
assets/patterns/multi-step-workflow.agentother10.1 KB
assets/patterns/open-gate-routing.agentother11.6 KB
assets/patterns/procedural-instructions.agentother4.8 KB
assets/patterns/prompt-template-action.agentother6.6 KB
assets/patterns/system-instruction-overrides.agentother10.6 KB
references/action-prompt-templates.mdmarkdown5.7 KB
references/actions-reference.mdmarkdown30.2 KB
references/agent-access-guide.mdmarkdown2.9 KB
references/agent-audit-and-repair.mdmarkdown7.9 KB
references/agent-audit-candidate-verification.mdmarkdown5.2 KB
references/agent-audit-diagnostic-catalog.mdmarkdown7.6 KB
references/agent-audit-diagnostics-actions-state.mdmarkdown6.9 KB
references/agent-audit-diagnostics-architecture-evaluation.mdmarkdown2.5 KB
references/agent-audit-diagnostics-instructions-routing.mdmarkdown11.8 KB
references/agent-audit-evaluation-loop.mdmarkdown6.0 KB
references/agent-audit-repair-report.mdmarkdown6.9 KB
references/agent-audit-scope-path-review.mdmarkdown8.5 KB
references/agent-design-and-spec-creation.mdmarkdown54.5 KB
references/agent-metadata-and-lifecycle.mdmarkdown30.2 KB
references/agent-script-core-language.mdmarkdown49.3 KB
references/agent-subagent-map-diagrams.mdmarkdown10.8 KB
references/agent-user-setup.mdmarkdown27.8 KB
references/agent-validation-and-debugging.mdmarkdown44.6 KB
references/agentscript-toolchain.mdmarkdown4.6 KB
references/architecture-patterns.mdmarkdown13.5 KB
references/common-control-flow-pitfalls.mdmarkdown9.4 KB
references/complex-data-types.mdmarkdown3.9 KB
references/control-flow-actions-sequencing.mdmarkdown6.9 KB
references/control-flow-lifecycle-side-effects.mdmarkdown3.3 KB
references/data-library-reference.mdmarkdown40.8 KB
references/deploy-reference.mdmarkdown6.7 KB
references/discover-reference.mdmarkdown4.3 KB
references/examples.mdmarkdown12.6 KB
references/feature-validity.mdmarkdown2.1 KB
references/instruction-resolution.mdmarkdown23.4 KB
references/known-issues.mdmarkdown27.6 KB
references/legacy-nga-regression-eval.mdmarkdown30.2 KB
references/mcp-management-reference.mdmarkdown37.6 KB
references/optimization-pattern-1-data-flow.mdmarkdown4.6 KB
references/optimization-pattern-2-deterministic-logic.mdmarkdown5.4 KB
references/optimization-pattern-3-reference-syntax.mdmarkdown4.1 KB
references/optimization-pattern-4-escalation.mdmarkdown2.2 KB
references/org-setup-for-adl.mdmarkdown23.7 KB
references/patterns-by-requirement.mdmarkdown5.4 KB
references/posture-and-determinism.mdmarkdown9.3 KB
references/production-gotchas.mdmarkdown12.6 KB
references/reference-map.mdmarkdown5.3 KB
references/safety-review-reference.mdmarkdown6.3 KB
references/salesforce-cli-for-agents.mdmarkdown16.7 KB
references/scaffold-reference.mdmarkdown6.7 KB
references/scoring-rubric.mdmarkdown3.3 KB
references/upgrade-legacy-agent-to-agentscript.mdmarkdown26.2 KB
references/version-history.mdmarkdown4.4 KB
references/voice-latency-heuristics.mdmarkdown9.7 KB
references/voice-modality-reference.mdmarkdown19.0 KB
references/voice-telephony-cli.mdmarkdown10.3 KB
references/zen-of-agentscript.mdmarkdown13.1 KB
scripts/__init__.pyscript0 B
scripts/agentscript-sdk-loader.mjsscript4.0 KB
scripts/discover.pyexecutablescript20.2 KB
scripts/generators/__init__.pyscript0 B
scripts/generators/apex_stub.pyscript13.4 KB
scripts/generators/apex_test_stub.pyscript3.8 KB
scripts/generators/flow_xml.pyscript7.6 KB
scripts/generators/permission_set_xml.pyscript1014 B
scripts/generators/remote_site_xml.pyscript1.4 KB
scripts/index-agent.mjsexecutablescript3.8 KB
scripts/org_describe.pyexecutablescript5.8 KB
scripts/scaffold.pyexecutablescript15.1 KB
scripts/setup-agentscript-sdk.mjsexecutablescript9.7 KB
scripts/upgrade-legacy-nga-analyze.pyexecutablescript20.0 KB
scripts/upgrade-legacy-nga-run-trials.shexecutablescript3.4 KB

assets/patterns/open-gate-routing.agent

View on GitHub
# Authentication Return Routing Pattern
#
# The historical "open gate" version used a focus latch to bypass fresh intent
# routing. This replacement keeps only two values with deterministic consumers:
#
#   authenticated       - proof returned by the verification action
#   pending_destination - return address shared by protected request handlers
#
# There is no focus lock. A user can cancel verification or change intent on
# the next turn. Use a fixed transition instead of pending_destination when
# only one protected request handler exists.
#
# Lifecycle:
#   - protected handlers write pending_destination before verification;
#   - authentication reads and clears it after successful verification;
#   - cancellation clears it before returning to fresh routing;
#   - sign-out clears both values;
#   - authentication applies only to the current messaging session. Production
#     verification and protected actions must also enforce server-side expiry.
#
# This is a COMPLETE template - customize action contracts and metadata.

system:
    instructions: |
        You are a customer service assistant. Route each latest request by its
        current intent. Require successful identity verification before using
        protected order or profile actions. A user's statement that they are
        verified is not proof. If the user cancels verification or changes
        intent, return to request routing immediately.
    messages:
        welcome: "Welcome! I can help with orders, account settings, or general questions."
        error: "I couldn't complete that request. No protected action was unlocked."

access:
    default_agent_user: "agent@company.salesforce.com"

config:
    developer_name: "Authentication_Return_Agent"
    agent_label: "Authenticated Customer Service"
    description: "Routes protected requests through identity verification without locking conversational focus"

variables:
    EndUserId: linked string
        source: @MessagingSession.MessagingEndUserId
        description: "Messaging End User ID used by protected read actions"
    RoutableId: linked string
        source: @MessagingSession.Id
        description: "Messaging Session ID"
    authenticated: mutable boolean = False
        description: "Successful verification result for the current messaging session"
    pending_destination: mutable string = ""
        description: "Protected request handler to enter after successful verification"

language:
    default_locale: "en_US"

start_agent agent_router:
    label: "Request Router"
    description: "Routes the user's latest request without answering it"

    reasoning:
        instructions: ->
            | Route only the user's latest request:
              - order status, returns, or shipping: protected order help;
              - account settings or profile changes: protected account help;
              - verification details for a pending protected request:
              authentication;
            | - cancellation, a changed subject, or a general question:
              general inquiry.
            | Do not answer the underlying request in this router.
        actions:
            go_orders: @utils.transition to @subagent.protected_orders
                description: "Handle protected order, return, or shipping requests"
            go_account: @utils.transition to @subagent.protected_account
                description: "Handle protected account settings or profile requests"
            continue_authentication: @utils.transition to @subagent.authentication
                description: "Continue verification details for a pending protected request"
            go_general: @utils.transition to @subagent.general_inquiry
                description: "Handle a general question, cancellation, or changed intent"

subagent protected_orders:
    label: "Protected Order Help"
    description: "Handles order status, returns, and shipping after verified authentication"

    actions:
        get_order_status:
            description: "Look up an order's current status for a verified customer"
            inputs:
                order_id: string
                    description: "Order number supplied by the customer"
                    is_required: True
            outputs:
                status: string
                    description: "Current order status"
            target: "flow://Get_Order_Status"

    before_reasoning:
        if @variables.authenticated == False:
            set @variables.pending_destination = "protected_orders"
            transition to @subagent.authentication

    reasoning:
        instructions: ->
            | The customer has verified successfully in this messaging session.
              Help with order status, returns, or shipping. Use the order-status
              action only for a concrete order lookup, and report only its
              returned result.
            | If the user cancels, changes intent, or asks to sign out, use the
              corresponding transition immediately.
        actions:
            lookup_order: @actions.get_order_status
                with order_id=...
                available when @variables.authenticated == True
            change_request: @utils.transition to @subagent.cancel_pending
                description: "Cancel the pending protected request or route a changed intent"
            sign_out: @utils.transition to @subagent.sign_out
                description: "Clear session authentication and return to request routing"

subagent protected_account:
    label: "Protected Account Help"
    description: "Handles account settings and profile changes after verified authentication"

    actions:
        get_customer_profile:
            description: "Read the verified customer's current profile without changing it"
            inputs:
                end_user_id: string
                    description: "Messaging end user ID bound from trusted session context"
                    is_required: True
            outputs:
                profile_summary: string
                    description: "Current non-sensitive profile information"
            target: "flow://Get_Customer_Profile"

    before_reasoning:
        if @variables.authenticated == False:
            set @variables.pending_destination = "protected_account"
            transition to @subagent.authentication

    reasoning:
        instructions: ->
            | The customer has verified successfully in this messaging session.
              Help them read current account settings. This pattern intentionally
              exposes no profile-changing action; a write requires its own
              machine-checkable target, confirmation, and repeat-execution guard.
            | If the user cancels, changes intent, or asks to sign out, use the
              corresponding transition immediately.
        actions:
            read_profile: @actions.get_customer_profile
                with end_user_id=@variables.EndUserId
                available when @variables.authenticated == True
            change_request: @utils.transition to @subagent.cancel_pending
                description: "Cancel the pending protected request or route a changed intent"
            sign_out: @utils.transition to @subagent.sign_out
                description: "Clear session authentication and return to request routing"

subagent authentication:
    label: "Identity Verification"
    description: "Verifies identity for a pending protected order or account request"

    actions:
        verify_customer:
            description: "Verify a customer using an email address and one-time code; failure grants no protected access"
            inputs:
                email: string
                    description: "Customer email address"
                    is_required: True
                verification_code: string
                    description: "One-time verification code"
                    is_required: True
            outputs:
                is_verified: boolean
                    description: "Whether identity verification succeeded"
            target: "flow://Verify_Customer"

    reasoning:
        instructions: ->
            if @variables.authenticated == False:
                | Ask for the minimum information needed to verify identity.
                  Invoke verification only when both email and code are
                  available. On failure, explain that protected access remains
                  unavailable and allow a retry.
            else:
                | Verification succeeded. Redirect to the pending protected
                  request without asking for the information again.

            | If the user cancels or changes intent, use cancel_authentication
              immediately. Never treat a user's claim of verification as proof.
        actions:
            verify_identity: @actions.verify_customer
                with email=...
                with verification_code=...
                set @variables.authenticated = @outputs.is_verified
                available when @variables.authenticated == False
            cancel_authentication: @utils.transition to @subagent.cancel_pending
                description: "Cancel verification or handle a changed request immediately"

    after_reasoning:
        if @variables.authenticated == True and @variables.pending_destination == "protected_orders":
            set @variables.pending_destination = ""
            transition to @subagent.protected_orders
        else if @variables.authenticated == True and @variables.pending_destination == "protected_account":
            set @variables.pending_destination = ""
            transition to @subagent.protected_account
        else if @variables.authenticated == True:
            set @variables.pending_destination = ""
            transition to @subagent.agent_router

subagent cancel_pending:
    label: "Cancel Pending Request"
    description: "Clears the deferred destination and returns the latest intent to fresh routing"

    before_reasoning:
        set @variables.pending_destination = ""
        transition to @subagent.agent_router

    reasoning:
        instructions: ->
            | The pending protected request has been cancelled.

subagent sign_out:
    label: "Sign Out"
    description: "Clears session authentication and any deferred destination"

    before_reasoning:
        set @variables.authenticated = False
        set @variables.pending_destination = ""
        transition to @subagent.agent_router

    reasoning:
        instructions: ->
            | Session authentication has been cleared.

subagent general_inquiry:
    label: "General Inquiry"
    description: "Handles general questions, cancellations, and requests that do not need authentication"

    reasoning:
        instructions: ->
            | Address the user's latest general question. If they cancelled a
              protected request, acknowledge the cancellation. If they now want
              protected order or account help, route to the matching protected
              request handler.
        actions:
            go_orders: @utils.transition to @subagent.protected_orders
                description: "Begin protected order help"
            go_account: @utils.transition to @subagent.protected_account
                description: "Begin protected account help"
            sign_out: @utils.transition to @subagent.sign_out
                description: "Clear session authentication"

# Review checklist:
#   - No open_gate or active-workflow latch bypasses fresh intent routing.
#   - pending_destination is a return address, never a focus lock.
#   - Failed verification leaves authenticated=False and cannot unlock actions.
#   - Cancellation clears the return address on the next turn.
#   - Sign-out resets session proof; production actions enforce their own expiry.
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall