Actions: Flow, Apex, prompt templates, APIs and MCP tools
Standard and custom actions, building actions with Flow and invocable Apex, prompt template actions, external API and MuleSoft actions, MCP tools, writing good input and output descriptions, confirmation and idempotency, and running-user context.
Simple explanation
| Action type | Use it for |
|---|---|
| Standard actions | Common operations (query records, summarise, answer with knowledge) |
| Flow (autolaunched) | Most business logic; admin-maintainable |
Apex (@InvocableMethod) | Complex logic, performance, callouts |
| Prompt template | Generating text with grounding (summaries, drafts) |
| API / MuleSoft | External systems via Named Credentials or MuleSoft APIs |
| MCP tools | Tools from registered MCP servers |
Design rules
- Descriptions matter: the action name, description and input/output descriptions are how the reasoning engine decides to use it.
- Small, single-purpose actions with typed inputs.
- Return useful outputs (status, message, IDs), not just "success".
- Confirm before irreversible changes (cancel, refund).
- Idempotent: safe to retry.
- Bulk- and limit-aware Apex; handle errors and return friendly messages.
- Actions run with the agent's user context; permissions apply.
Real-world analogy
Actions are the tools on a tradesperson's belt. A clearly labelled tool gets picked for the right job; an unlabelled one stays in the bag or gets used wrongly.
Worked example
"Change delivery date" is a Flow action with inputs orderNumber and newDate, a description stating it only works before dispatch, and outputs status and customerMessage. It checks eligibility, calls the carrier API through a Named Credential, and returns a clear message. The agent confirms the new date with the customer before calling it.
Diagram
Key points
- Most actions: Flow; complex ones: invocable Apex.
- Names and descriptions drive action selection.
- Small, typed, idempotent actions with useful outputs.
- Confirm before irreversible changes.
- Actions respect the running user's permissions.
Limits and gotchas
- Actions consume Flex Credits per execution; chatty designs cost more.
- Long-running callouts hurt conversation latency; design asynchronous patterns for slow systems.
- Exposing generic "update any record" actions is risky; keep actions specific.
π€ How to say this in an interview
Describe one action end to end: inputs, description, logic, outputs, error handling, confirmation and permissions.
Common follow-ups
Flow or Apex for an action?
Flow for logic admins maintain and moderate complexity; Apex for complex logic, heavy processing or fine control over callouts and errors.
The agent keeps calling the wrong action. Why?
Overlapping or vague descriptions, too many actions in the subagent, or unclear input names; fix descriptions and scope.