Design the Subagents and Actions
After identifying the right subagents and actions for your AI agent, start planning how to build them. Following best practices when designing the subagents and actions can help your agent perform reliably and effectively.
Required Editions
| Available in: Lightning Experience |
| Available in: Enterprise, Performance, Unlimited, and Developer Editions. Required add-on licenses vary by agent type. |
As you plan your subagents and actions, simultaneously build and test your AI agent in a sandbox environment. Try different approaches to figure out what works and what doesn’t. The key is to use prototyping and continuous refinement to guide your planning and development efforts.
Design the Subagents
Subagents are an important component of Agentforce because they define the AI agent’s goals and provide the context and direction it needs to achieve those goals. When building an agent, you can customize standard subagents to get up and running quickly, or you can create custom subagents that are tailored to your business. To learn how to design subagents, review the different parts of a subagent and follow the best practices for subagent instructions.
Design the Actions
If none of the standard agent actions suit your needs, you can build custom actions for your AI agent. When you create a custom action, you build it on top of existing platform functionality that you want to make available in Agentforce—invocable and REST Apex classes, autolaunched flows, prompt templates, external services, and MuleSoft APIs. In Agentforce, that underlying functionality is called a reference action.
Design Considerations for Reference Actions
Here are some factors to consider when approaching the design of the underlying reference actions for your agent actions.
Deterministc or Prompt-Based
When developing the underlying platform functionality for your agent actions, first review the business processes and tasks related to your use case. Then decide whether the process or task should be deterministic or prompt-based.
- Deterministic: Uses an invocable or REST Apex class or autolaunched flow to generate output. Actions based on flows or Apex are deterministic and use business logic and rules to produce a consistent outcome.
- Prompt-based: Uses one or more prompt templates to generate output. A prompt-based action lets you control how a response is written or use reasoning and generative capabilities of an LLM. For example, to generate a summary or perform sentiment analysis, you need to use a prompt template as a reference action. Prompt templates are also used to ground an agent in data, such as knowledge or external system data.
Keep in mind that an action can combine both deterministic and prompt-based approaches. For example, an Appointment Management subagent might include an action that cancels appointments. When a user asks to cancel their appointment, the flow-based action is triggered to complete the cancellation. At some point during that flow, the agent could also launch a prompt template that summarizes the user’s reason for cancelling.
Atomic or Composite
Another factor to consider is whether the reference action is atomic or composite.
- Atomic: A small, singular task. A modular approach gives the agent freedom to combine actions in different ways to accomplish a more sophisticated goal. It also tends to provide more opportunities for action reuse across different subagents.
- Composite: A complex task made up of multiple subtasks. The benefit of a composite action is that you control the exact sequence of steps the agent takes to complete a task.
Inputs and Outputs
In Agentforce, each agent action must have at least one input, which means the underlying flow, Apex, or prompt template must also have at least one input. For example, to look up a hotel reservation, the input might be the guest’s email or reservation number. During a conversation, the AI agent has the autonomy to gather information and decide if it has all the details required for it to trigger the action and pass in the input.
Each action must also have at least one output. The way you build the action determines what the output is, how it’s used, and whether and how it’s displayed to users in the conversation. Don’t be afraid to experiment with test actions that aren’t fully implemented—they can be a great way to see how your ideas work in execution.
After you decide how to build your actions, review the Best Practices for Agent Action Instructions.

