
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@sf-explorer/agentscript-migration-tool
Advanced tools
Generate Salesforce Agent Script YAML from Agentforce planner configurations
Generate Salesforce Agent Script YAML from Agentforce planner configurations. This tool helps accelerate migration from UI-based Agentforce configurations to code-based AgentScript format.
js-yaml for YAML generationnpm install @sf-explorer/agentscript-migration-tool
import { generateAgentScript } from '@sf-explorer/agentscript-migration-tool'
import type { PlannerDefinition } from '@sf-explorer/agentscript-migration-tool'
const planner: PlannerDefinition = {
DeveloperName: "my_agent",
MasterLabel: "My Agent",
topics: [/* ... */]
}
const yaml = generateAgentScript(planner)
console.log(yaml)
import { generateAgentScript } from '@sf-explorer/agentscript-migration-tool'
import type { PlannerDefinition } from '@sf-explorer/agentscript-migration-tool'
// Define your planner data
const planner: PlannerDefinition = {
DeveloperName: "customer_service_agent",
MasterLabel: "Customer Service Agent",
Metadata: {
description: "Assists customers with their service requests"
},
topics: [
{
DeveloperName: "Orders",
MasterLabel: "Orders",
Description: "Handle order-related inquiries",
actions: [
{
DeveloperName: "LookupOrder",
MasterLabel: "Lookup Order",
Description: "Look up order by ID",
InvocationTarget: "GetOrderDetails",
InvocationTargetType: "Flow",
Metadata: {
inputs: {
order_id: "string"
},
outputs: {
order_summary: "string"
}
}
}
]
}
],
variables: [
{
DeveloperName: "customer_verified",
parameterName: "customer_verified",
mappingType: "Boolean",
description: "Whether customer is verified"
}
]
}
// Generate Agent Script YAML
const yaml = generateAgentScript(planner, {
includeComments: true,
includeLanguageConfig: true
})
console.log(yaml)
generateAgentScript(planner, options?)Convenience function to generate Agent Script YAML.
Parameters:
planner: PlannerDefinition - The planner definition objectoptions?: AgentScriptGenerationOptions - Optional generation optionsReturns: string - Generated YAML content
AgentScriptGeneratorClass-based generator for more control.
import { AgentScriptGenerator } from '@sf-explorer/agentscript-migration-tool'
const generator = new AgentScriptGenerator(planner, {
includeComments: true,
yamlIndent: 4,
includeLanguageConfig: true
})
const yaml = generator.generate()
interface AgentScriptGenerationOptions {
includeComments?: boolean // Add header comments (default: true)
includeExamples?: boolean // Include example code (default: false)
yamlIndent?: number // YAML indentation (default: 4)
generateVariables?: boolean // Generate variables section (default: false)
includeLanguageConfig?: boolean // Include language block (default: true)
}
The tool generates complete Agent Script YAML following Salesforce patterns:
# Agent Script
# Generated from GenAI Planner: Customer Service Agent
# Developer Name: customer_service_agent
config:
developer_name: "customer_service_agent"
default_agent_user: "agentforce@salesforce.com"
description: "Assists customers with their service requests"
system:
instructions: "You are a helpful assistant..."
messages:
welcome: "Hi, I'm your Customer Service Agent assistant..."
error: "Sorry, something went wrong..."
variables:
customer_verified: mutable boolean
description: "Whether customer is verified"
start_agent topic_selector:
description: "Welcome the user and determine the appropriate topic"
reasoning:
instructions: ->
| You are a topic selector assistant...
actions:
go_to_orders: @utils.transition to @topic.Orders
description: "Handle order-related inquiries"
topic Orders:
description: "Handle order-related inquiries"
reasoning:
instructions: ->
| Handle order-related inquiries.
Available actions:
- Use @actions.LookupOrder to Look up order by ID
actions:
LookupOrder: @actions.LookupOrder
description: "Look up order by ID"
actions:
LookupOrder:
description: "Look up order by ID"
inputs:
order_id: string
outputs:
order_summary: string
target: "flow://GetOrderDetails"
The package exports comprehensive TypeScript types:
PlannerDefinition - Main input interfacePlannerTopic - Topic definitionPlannerAction - Action definitionPlannerVariable - Variable definitionAgentScriptStructure - Generated YAML structureAgentScriptGenerationOptions - Generation optionsSee the types.ts file for complete definitions.
The tool automatically formats action targets based on type:
flow://FlowNameapex://ClassNamestandardInvocableAction://ActionNamegeneratePromptResponse://TemplateNameexternalService://ServiceNamePlannerDefinition interfacegenerateAgentScript() to create YAMLBegin with 1-2 non-critical agents to learn the patterns.
The generated script is 85% complete. Review and add:
Always test in sandbox before production:
Treat AgentScript like any code:
This implementation follows the official Salesforce Agent Script Recipes including:
Contributions are welcome! Please:
MIT
The package includes comprehensive error handling:
import { generateAgentScript, ValidationError } from '@sf-explorer/agentscript-migration-tool'
try {
const yaml = generateAgentScript(planner)
} catch (error) {
if (error instanceof ValidationError) {
console.error('Validation error:', error.message)
console.error('Field:', error.field)
} else {
console.error('Generation error:', error)
}
}
Run the test suite:
npm test
Run tests with coverage:
npm run test:coverage
For issues or questions:
types.tsgenerator.tsContributions are welcome! Please see our contributing guidelines:
git checkout -b feature/amazing-feature)npm test)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)FAQs
Generate Salesforce Agent Script YAML from Agentforce planner configurations
We found that @sf-explorer/agentscript-migration-tool demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.