Salesforce Decode
Salesforcedecode
Back to questions
AgentforceAdvancedaction-chainsorchestrationflowdesign-patterns

Chain dependent agent actions without fragile multi-step prompts

Real World Scenario

An insurance agent must verify policy, check coverage, and create a claim draft. When step two fails, partial claim records confuse adjusters and customers.

Expected Answer

• Model multi-step workflows as explicit state machine in Flow or Apex orchestrator, not LLM improvisation • Each agent action returns structured status codes the agent interprets for next user message • Use saga pattern with compensating actions rolling back prior steps on failure • Persist workflow state in custom object linked to session ID surviving agent handoffs • Limit LLM to conversational layer; business sequencing lives in deterministic code • Define timeout and retry policies per action with customer-facing progress messages • Integration test full chains including mid-chain failure and recovery paths

Follow-Up Questions & Answers

Click to expand — each follow-up includes a direct, interview-ready answer

Direct answer: Model multi-step workflows as explicit state machine in Flow or Apex orchestrator, not LLM improvisation Also consider: Each agent action returns structured status codes the agent interprets for next user message In practice: Use saga pattern with compensating actions rolling back prior steps on failure Optimize for scale and operational observability.

Architect Perspective

LLMs are poor workflow engines. Chain actions in code; let agents explain and confirm steps conversationally.