Agent Script actions and targets — declaring an action, the target schemes (flow, apex, prompt and 20 more), input and output types, complex_data_type_name, matching Apex invocable variables and prompt template inputs, and the metadata a published agent becomes
How an Agent Script subagent declares an action — description, inputs, outputs and a target URI — with the full list of target schemes the linter accepts, how input and output names must match an Apex @InvocableVariable, a flow variable or a prompt template's "Input:<apiName>", when complex_data_type_name is needed, the confirmation and progress flags, and which metadata (GenAiPlugin, GenAiFunction or AiAgentDefinition) publishing creates.
markdownreferencev2GCGG-05VTstage: buildtrust: officialservice: agentforceinterface: agent-scriptinterface: apexAgent Script actionsubagent actions blocktarget URIflow://apex://prompt://generatePromptResponse://standardInvocableAction://externalService://quickAction://api://apexRest://auraEnabled://mcpTool://platformMcpTool://retriever://cdpMlPrediction://namedQuery://expressionSet://integrationProcedureAction://slack://placeholder://invalid-action-targetinputs outputsis_requiredis_displayablefilter_from_agentrequire_user_confirmationinclude_in_progress_indicatorprogress_indicator_messagecomplex_data_type_namelightning__dateTypelightning__integerTypelightning__objectType@apexClassTypeInvocableMethodInvocableVariableprompt template input Input:promptResponsecomplex-data-type-on-primitiveGenAiPluginGenAiFunctionAiAgentDefinitionAiAgentDefinitionVersionpublish creates metadata
Actions and targets
An action is declared once in a subagent's actions: block and offered to the LLM as a tool in reasoning.actions (reference/agentforce/agent-script.md). Agent Script only describes the call. The flow, Apex class or prompt template must already be deployed to the org, because publishing doesn't deploy them (reference/dx/deploy-errors.md).
Declaring an action
actions:
check_weather:
description: "Fetch the weather forecast for the resort."
label: "Check Weather"
target: "apex://CheckWeather"
require_user_confirmation: False
include_in_progress_indicator: True
progress_indicator_message: "Checking local weather..."
inputs:
dateToCheck: object
complex_data_type_name: "lightning__dateType"
description: "Date to check, yyyy-MM-dd"
is_required: True
outputs:
maxTemperature: number
description: "Maximum temperature in Celsius"
is_displayable: True
filter_from_agent: False
descriptions are prompts. The LLM picks tools and fills inputs from them, so say what the action does and when to use it.is_displayablelets the output be shown to the user.filter_from_agent: Truehides an output from the LLM.require_user_confirmation: Truemakes the agent ask before running a write action.
Target schemes
target: "<scheme>://<API name>". The linter accepts:
| Scheme | Calls |
|---|---|
flow:// | An autolaunched flow, by API name |
apex:// | An Apex class with an @InvocableMethod |
prompt:// (or generatePromptResponse://) | A Prompt Builder template (family 6) |
standardInvocableAction://, quickAction:// | Built-in invocable actions; quick actions |
apexRest://, auraEnabled://, api://, externalService://, externalConnector:// | Apex REST methods, @AuraEnabled methods, APIs, External Services |
mcpTool://, platformMcpTool:// | MCP tools (sf agent mcp manages the API Catalog) |
retriever:// | A Data 360 retriever. Its inputs aren't documented; use a Data Library instead (reference/data360/search-indexes-and-retrievers.md) |
cdpMlPrediction:// | A Data 360 / Model Builder prediction |
namedQuery://, expressionSet://, runExpressionSet://, decisionTableAction://, integrationProcedureAction://, executeIntegrationProcedure://, serviceCatalog://, createCatalogItemRequest://, slack:// | Industry and platform actions |
placeholder:// | A stub for design; the linter warns |
Any other scheme fails, for example: "Action 'verify' uses unsupported target scheme "lambda://". Supported schemes: api, apex, …". The linter doesn't check that the target exists. A wrong API name only fails on sf agent validate, publish or a live preview.
Matching names to the implementation
| Target | Input names must match | Outputs |
|---|---|---|
apex://Class | The @InvocableVariable fields of the request class | The fields of the response class |
flow://Flow | The flow's input variables (available for input) | Its output variables |
prompt://Template | "Input:<apiName>", quoted, one per template input | promptResponse: string |
The CLI's agent template pairs this Apex class with the check_weather action above:
public with sharing class CheckWeather {
@InvocableMethod(label='Check Weather' description='Check weather at the resort for a specific date')
public static List<WeatherResponse> getWeather(List<WeatherRequest> requests) {
WeatherResponse response = new WeatherResponse();
response.maxTemperature = 21.5;
return new List<WeatherResponse>{ response };
}
public class WeatherRequest {
@InvocableVariable(required=true description='Date to check, yyyy-MM-dd')
public Date dateToCheck;
}
public class WeatherResponse {
@InvocableVariable(description='Maximum temperature in Celsius')
public Decimal maxTemperature;
}
}
The same template calls a prompt template with:
check_events: @actions.check_events
available when @variables.guest_interests != ""
with "Input:Event_Type" = @variables.guest_interests
Types and complex_data_type_name
- Plain types:
string,number,boolean,date,datetime,time,currency,id,integer,long,list[...]. objectandlist[object]needcomplex_data_type_name:- Lightning types:
lightning__dateType,lightning__dateTimeType,lightning__integerType,lightning__doubleType,lightning__booleanType,lightning__objectType,lightning__listType. - An Apex class:
"@apexClassType/c__Outer$Inner". - Without one, the linter warns: "has type 'object' but lacks 'complex_data_type_name'".
- On a primitive it's redundant, and the linter warns: "has primitive type 'string' and does not require 'complex_data_type_name'". Salesforce's own agent template triggers this warning on its prompt template action.
- An Apex
Integeroutput generally needsobjectwithlightning__integerType, per the recipes' rules.
What publishing creates
sf agent publish authoring-bundle compiles the script, creates the agent through the authoring API, then retrieves the generated metadata into your project:
| Org API version | Retrieved |
|---|---|
| 68.0 (Winter '27) and later | AiAgentDefinition + AiAgentDefinitionVersion, with the action dependencies (flows, Apex, prompt templates) |
| Earlier | Bot (+ BotVersion), one GenAiPlugin per subagent, one GenAiFunction per action, and the Agent record |
Commit the generated metadata with the bundle, so a deploy to another org includes the agent's Bot/BotVersion (reference/dx/agentforce-metadata-types.md). The full lifecycle: guides/agentforce/build-agent-with-agentforce-dx.md.