A hybrid design pairs an Agentforce agent with Flow and Apex. The agent takes the step that needs reasoning over unstructured input or an open goal, while Flow and Apex handle the record writes, ordering and rule checks that must stay predictable.
Why a hybrid design can beat either tool alone
Traditional automation follows a fixed path, so the same record state produces the same result, and each step can be checked line by line. An agent suits work where the path cannot be written in advance, such as reading a customer’s free-text description and deciding which of several outcomes fits. Many business processes contain both kinds of work. An onboarding request may need a judgment about what the customer is actually asking for, followed by a strict sequence of required record updates. A hybrid design keeps each kind of work in the tool that handles it well.
The combination earns its added design effort when the agent step changes an outcome that rules alone would get wrong or slow. If a plain flow produces the right result with fewer moving parts, the flow is the better design.
Map the execution path before choosing an agent
Start by writing the process as a sequence of steps and marking each one as fixed or open. A fixed step has a known outcome for each input the process can receive. An open step needs the system to decide something at runtime, using the record, the conversation or the surrounding context. The open steps are the candidates for an agent. The fixed steps stay in Flow or Apex, where they are cheaper to test and easier to explain to an auditor.
Next, count the distinct outcomes the process has to resolve. A contained task with one expected result, such as setting a task owner from a field value, does not need reasoning. A process with several competing goals, such as weighing a claim amount against fraud signals, policy terms and the customer’s history, does. The more outcomes an open step must resolve, the stronger the case for an agent.
Last, look at the input. Structured fields are straightforward to pass along. Email bodies and call transcripts add a layer of interpretation, and live audio or streaming telemetry usually needs integration work first. Input type shapes the infrastructure, so settle it early.
Choose the architecture by orchestration density
This guide uses orchestration density as a working rating rather than a formal Salesforce term. It combines the execution path, the goal complexity and the input mix into one score, and the score points to an architecture. The four levels below run from a fully fixed process to one that needs runtime context and real-time input.
- Low density: a fully specified path with one contained task and structured records. Use record-triggered automation, and add an agentic action where a single step needs reasoning.
- Low to medium density: a series of steps with predefined outcomes, where many existing records need the same AI task. Use Agentforce Grid to run that task across the record set.
- Medium density: a path set in advance, with intermediate steps that need reasoning. Use a hybrid of Agentforce with Apex and Flow, where Flow or Apex sequence the process and the agent handles the reasoning steps.
- High density: a goal that is fixed but whose steps depend on runtime context, often with real-time input. Use an agent design that pairs guided control steps with reasoning, and add a multi-agent or cross-system layer when the process needs one.
Put the agent where the reasoning actually sits
Reasoning steps between fixed stages
A common fit is a fixed process with one stage that needs judgment. A service case might move through intake, triage, resolution and closure in a set order, while triage depends on reading the customer’s own words. Keep the stage order in Flow, call the agent for the triage judgment, and have it return a structured result that the next stage can test. For a closer look at how intake and routing are usually laid out, see service workflow design.
Bulk work across existing records
When one AI task has to run across many existing records, such as summarizing the recent cases for each account in a list, a record-triggered flow is the wrong tool for the job. Agentforce Grid is a spreadsheet-style option for that work, where AI or agent columns run across the rows. Keep the generation step separate from the write step, so a reviewer can check the output before it lands in a field.
Conversational entry points
When the starting point is chat, email or voice and the resolution needs back-and-forth, the agent has to lead the conversation. The agent’s conversation needs a defined structure for its workflow and business rules. Keep each step that changes a record as a Flow or Apex step that the agent calls. The conversation can then stay flexible while each record change stays deterministic.
Design the handoff between the agent and automation
The handoff is where hybrid designs often fail. Define the contract on both sides before building either one. It covers what goes in, what comes back and what happens when the output does not fit.
- List the record fields the agent needs. Check on your instance and release that the agent can read each one in the context where it runs.
- Define the output as a fixed set of values, such as a category, a priority and a reason code, so the automation can test it without interpreting free text.
- Add a validation step that rejects any output outside the allowed values and sends the record to a defined fallback path.
- Order the record writes in Flow or Apex so that each write runs after its input has passed validation.
- Store the agent’s output and the automation’s decision together, so one record shows both what was proposed and what was done.
Keep one entry point per object for record-triggered work
Record-triggered automation is where hybrid designs often get tangled. Once an agent is involved, it is tempting to add a second trigger path on the same object for the agent’s part. Where possible, choose one primary entry point for each Salesforce object, either a record-triggered flow or Apex triggers, and place the agent call inside that path. Mixing the two as entry points on the same object makes maintenance harder and spreads governance across two mechanisms.
A simple way to choose between them is to score each object on three things: how many automations run on a single data change, how many records a typical transaction touches, and how far one update cascades into related objects. A low score suits a record-triggered flow. A medium score suits a record-triggered flow that calls invocable Apex for the heavier logic. A high score points toward Apex triggers, which give more control over bulk processing and object-oriented structure.
Be careful about moving work into asynchronous jobs from a trigger. Pushing a task to a background queue can look like a way to keep the record save quick, but it adds error-handling paths and makes the transaction limits harder to predict. Review the governor limits for admins guidance before you commit to that pattern on a busy object.
Check the design before building or releasing it
- Mark each step as fixed or open, and write down the reason each open step needs reasoning.
- Count the automations that run on each object the process touches, and the records a typical run will change.
- Confirm which agent actions and limits your instance and release support, because these details can vary between releases.
- Check that the order of stage changes matches the process map. For stage changes in a sales cycle, compare the design with sales workflow design.
- Walk the whole automation chain for the process, from the first trigger to the last write, using the approach described in Salesforce automation workflows.
For help planning this work, see Salesforce implementation.
Questions about failures, multi-agent designs and cross-system processes
What should happen to a record if an agent step fails partway through?
Apex gives savepoints and rollback, so a sequence that fails midway can undo its own writes. In Flow, put the hardest-to-reverse update last. If a partial result is acceptable, record which fields were set so a person can finish the rest.
When does a hybrid process need more than one agent?
Multi-agent collaboration fits high density work, where separate skill sets have to coordinate toward one goal. For a process that stays inside one object, one agent with a defined set of actions is usually easier to test and explain. Add a second agent when two sets of skills change on different schedules or belong to different owners. Overlapping skills across two agents can produce conflicting answers.
How does a process that crosses systems change the design?
When the process spans Salesforce and third-party systems, the integration layer becomes part of the design. An integration layer such as MuleSoft is one common way to connect agentic workflows to other systems. Treat each external call the same way as the record handoff: define its inputs, its outputs and its failure route. For the wider picture, see Salesforce integration architecture.
Can a hybrid design be tested without changing live records?
Yes, and the test is worth building into the design from the start. Run the agent step against a copy of the records and capture its proposed values, then let the validation step and the writes run against a sandbox. Compare what the agent proposed with what a person would have chosen for the same records. Adjust the allowed values and the fallback path first, and change the agent’s instructions after the automation side behaves as expected.