Now inviting automation leaders: publish your playbook as a skill, under your own name. Publish yours →
Automation Skills
All skills/Sf ai agentforce testing/Agentscript-agents
Reference · Sf ai agentforce testing

Agentscript-agents

Part of Sf ai agentforce testing. Install the skill and your agent reads this page when it needs the depth.

<!-- Parent: sf-ai-agentforce-testing/SKILL.md -->

Agent Script Agents (AiAuthoringBundle) — Testing Guide

Agent Script agents (.agent files in aiAuthoringBundles/) deploy as BotDefinition and use the same sf agent test CLI commands. However, they have unique testing challenges:

Two-Level Action System

Single-Utterance Limitation

Multi-topic Agent Script agents with start_agent routing have a "1 action per reasoning cycle" budget in CLI tests. The first cycle is consumed by the transition action (go_<topic>). The actual business action (e.g., get_order_status) fires in a second cycle that single-utterance tests don't reach.

Solution — Use conversationHistory:

testCases:
  # ROUTING TEST — captures transition action only
  - utterance: "I want to check my order status"
    expectedTopic: order_status
    expectedActions:
      - go_order_status          # Transition action from start_agent

  # ACTION TEST — use conversationHistory to skip routing
  - utterance: "The order ID is 801ak00001g59JlAAI"
    conversationHistory:
      - role: "user"
        message: "I want to check my order status"
      - role: "agent"
        topic: "order_status"    # Pre-positions agent in target topic
        message: "I'd be happy to help! Could you provide the Order ID?"
    expectedTopic: order_status
    expectedActions:
      - get_order_status         # Level 1 DEFINITION name (NOT invocation name)
    expectedOutcome: "Agent retrieves and displays order details"

Key Rules for Agent Script CLI Tests

Agent Script API Testing Caveat

Agent Script agents embed action results differently via the Agent Runtime API:

This means:

Templates & Docs

Automated Test Spec Generation

python3 {SKILL_PATH}/hooks/scripts/generate-test-spec.py \
  --agent-file /path/to/Agent.agent \
  --output tests/agent-spec.yaml --verbose

# Generates both routing tests (with transition actions) and
# action tests (with conversationHistory for apex:// targets)

Agent Discovery

# Discover Agent Script agents alongside XML-based agents
python3 {SKILL_PATH}/hooks/scripts/agent_discovery.py local \
  --project-dir /path/to/project --agent-name MyAgent
# Returns type: "AiAuthoringBundle" for .agent files
<!-- Modified by Automation Skills on 2026-11-24: relative links to files that were not copied now point to the original repository. -->

Publish your skill

Copy this prompt into Claude Code, Codex or any agent. It walks you through your first skill in about 20 minutes, with you as the author.

Click to copy.