Create an Apex class with a public static method annotated with @InvocableMethod(label='My Action' description='...' category='My Category') so it appears as an action in Flow Builder
Define input and output using inner classes annotated with @InvocableVariable on each field — primitive types and SObject references are supported; wrap parameters in a List<InputClass> to support bulk invocation from Flow
Implement the method to process the full list of inputs at once (bulkified) — Flow may call the method with multiple records when used in a record-triggered flow that processes many records
Return a List<OutputClass> of the same length as the input list; each output element maps back to the corresponding input record in Flow
In Flow Builder, add an Action element and search for the method by its label; map Flow variables to the input fields and capture output fields into Flow variables for downstream use
Test by running the Flow in debug mode and inspecting the Apex debug log to verify the invocable method received the expected inputs and returned correct outputs
Known gotchas
Invocable methods called from record-triggered flows run in the same transaction as the triggering record operation; if the method performs DML, it must not conflict with the record being processed (no re-querying and re-inserting the triggering record)
Flows that call invocable methods in loops (via subflows) can exhaust governor limits because each loop iteration may invoke the method separately rather than batching — restructure to collect all inputs before a single invocable call where possible
The @InvocableMethod annotation only permits one annotated method per class; placing two @InvocableMethod methods in the same class causes a compile error — use separate classes for each distinct action
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp