Chapter 4: Workflow Thinking


In the previous chapter, we explored the internal architecture of AI agents, understanding how perception, reasoning, action, memory, and learning modules work together to create intelligent behaviour.

However, most enterprise tasks are not single-step operations. They are complex, multi-step processes that require coordination, sequencing, and error handling. This is where workflow thinking becomes essential.

Workflow thinking is the practice of designing, orchestrating, and managing sequences of tasks that agents perform to achieve business goals. Instead of treating each agent action in isolation, workflow thinking focuses on the end-to-end process—from initial trigger to final outcome.

In this chapter, we will explore how to design agentic workflows, distinguish between traditional workflows and agentic workflows, and learn patterns for building robust, scalable workflows in banking applications.

Throughout this chapter, we continue to use the banking domain to ground our examples, ensuring that the concepts are practical and applicable to real‑world financial institutions.


🎯 Learning Objectives

By the end of this chapter, you will be able to:

  • Distinguish between traditional workflows and agentic workflows
  • Design sequential, conditional, and parallel workflows for agents
  • Apply human-in-the-loop patterns appropriately
  • Understand workflow orchestration and choreography
  • Implement error handling and fallback strategies
  • Optimize workflows for performance and reliability
  • Recognize common workflow patterns in banking

What is Workflow Thinking?

Workflow thinking is the discipline of designing business processes as structured sequences of tasks, decisions, and interactions, where each step is clearly defined and orchestrated to achieve a specific outcome.

In the context of Agentic AI, workflow thinking means:

  • Breaking down complex business processes into manageable steps
  • Assigning each step to the appropriate agent or human
  • Defining the flow of data and control between steps
  • Handling errors, exceptions, and edge cases
  • Measuring and optimizing the end-to-end process

"A workflow is not just a sequence of actions—it is a deliberate design of how work gets done."


Traditional Workflows vs. Agentic Workflows

Understanding the difference between traditional and agentic workflows is essential for designing effective AI systems.


Traditional Workflows

Traditional workflows are static, deterministic, and rule-based.

Characteristics:

  • Fixed sequence of steps
  • Predefined rules and conditions
  • Limited adaptability
  • Human-driven decision points

Banking Example: A loan application process where forms are submitted, checked by an underwriter, and approved or rejected based on fixed criteria.

Limitations:

  • Cannot handle novel situations
  • Require manual intervention for exceptions
  • Slow to adapt to changing conditions

Agentic Workflows

Agentic workflows are dynamic, adaptive, and intelligent.

Characteristics:

  • Flexible sequencing based on context
  • AI-driven decision points
  • Continuous learning and improvement
  • Autonomous execution with human oversight

Banking Example: A loan processing workflow where an agent gathers documents, assesses risk using ML, decides whether to approve or request more information, and learns from past decisions.

Benefits:

  • Handles novel and complex situations
  • Adapts to changing conditions
  • Improves over time through feedback

Traditional Workflow          Agentic Workflow
-------------------          -----------------
Fixed sequence               Dynamic sequencing
Rule-based decisions         AI-driven decisions
Manual exceptions            Autonomous handling
Static knowledge             Continuous learning

Types of Workflows

Agentic workflows can be categorized based on how tasks are organized and executed.


Sequential Workflows

Tasks are executed one after another, in a linear sequence.

Task A → Task B → Task C → Task D

Banking Example: A customer onboarding workflow:

  1. Collect customer information
  2. Perform KYC verification
  3. Create customer account
  4. Send welcome notification

When to use: When each step depends on the successful completion of the previous step.


Conditional Workflows

Tasks are executed based on conditions or decisions.

Task A → Decision → Task B (if condition X)
                  → Task C (if condition Y)
                  → Task D (if condition Z)

Banking Example: A fraud detection workflow:

  1. Transaction arrives
  2. Check fraud score
  3. If score < threshold → Approve
  4. If score between thresholds → Review manually
  5. If score > threshold → Block and alert

When to use: When different paths are needed based on data or context.


Parallel Workflows

Multiple tasks are executed simultaneously.

           → Task B
Task A →   → Task C   → Task F
           → Task D
           → Task E

Banking Example: A loan origination workflow that simultaneously:

  • Verifies identity (KYC)
  • Checks credit score
  • Validates income documents
  • Assesses property value

When to use: When tasks are independent and can be executed in parallel to save time.


Iterative Workflows

Tasks are repeated until a condition is met.

Loop: Task A → Decision → Exit (if condition met)
                        → Repeat (if condition not met)

Banking Example: A document collection workflow that:

  1. Requests missing document
  2. Checks if all documents received
  3. If missing, send reminder and wait
  4. If all received, proceed to processing

When to use: When processes require repetition or iterative refinement.


Workflow Orchestration vs. Choreography

When multiple agents or systems are involved, there are two main approaches to coordination.


Orchestration

A central orchestrator controls the workflow, invoking services and managing the sequence.

Orchestrator → Agent A → Response
            → Agent B → Response
            → Agent C → Response

Banking Example: A central orchestrator coordinates the loan approval workflow, calling the KYC agent, credit check agent, and underwriting agent in sequence.

Advantages:

  • Centralized control and visibility
  • Easier error handling and monitoring
  • Clear workflow definition

Disadvantages:

  • Single point of failure
  • Orchestrator becomes a bottleneck
  • Less flexible for dynamic workflows

Choreography

Agents communicate directly with each other through events, without a central controller.

Agent A → Event → Agent B
Agent B → Event → Agent C
Agent C → Event → Agent A

Banking Example: A compliance monitoring system where agents publish events (e.g., "suspicious transaction detected") that other agents subscribe to and act upon.

Advantages:

  • Decentralized and scalable
  • More flexible and adaptable
  • No single point of failure

Disadvantages:

  • Harder to monitor and debug
  • Complex coordination logic
  • Risk of event storms

Choosing the Right Approach

Aspect Orchestration Choreography
Complexity Centralized Distributed
Monitoring Easier Harder
Scalability Limited High
Flexibility Low High
Control High Low

Guideline: Use orchestration for well-defined business processes, and choreography for loosely coupled, event-driven systems.


Human-in-the-Loop (HITL) Patterns

Not all decisions should be fully automated. Human-in-the-loop patterns provide a balance between autonomy and oversight.


Pattern 1: Approval Required

The agent makes a recommendation, but a human must approve before action.

Agent → Recommendation → Human Review → Approved → Action
                                       → Rejected → Notification

Banking Example: A loan agent recommends approval, but a human underwriter must sign off on loans above a certain amount.


Pattern 2: Escalation on Exception

The agent operates normally, but escalates to a human when it encounters uncertainty or high risk.

Agent → Normal Operation
Agent → Uncertainty/High Risk → Escalate to Human

Banking Example: A fraud detection agent flags a suspicious transaction and escalates to a human investigator for confirmation.


Pattern 3: Human Oversight (Supervisory)

A human monitors the agent's actions and can intervene if needed.

Agent → Action → Human Monitor → Continue/Override

Banking Example: A portfolio management agent makes trades, but a human portfolio manager reviews all major decisions.


Pattern 4: Feedback Loop

Humans provide feedback that the agent learns from.

Agent → Action → Outcome → Human Feedback → Agent Learning → Improved Agent

Banking Example: A customer service agent receives ratings and feedback that is used to improve its responses.


Workflow Error Handling

Error handling is critical for robust agentic workflows.


Retry with Backoff

If a task fails, retry with increasing delays.

Attempt 1 → Fail → Wait 1s
Attempt 2 → Fail → Wait 2s
Attempt 3 → Fail → Wait 4s
Attempt 4 → Fail → Escalate

Banking Example: An agent retries a failed API call to the credit bureau with exponential backoff.


Fallback Actions

If a task fails, execute an alternative action.

Task → Fail → Fallback Task

Banking Example: If the primary fraud scoring service is unavailable, use a simpler rule-based system as a fallback.


Compensation

If a task fails after other tasks succeeded, undo the completed tasks.

Task A → Success
Task B → Success
Task C → Fail → Compensate Task A & B

Banking Example: If a loan approval fails, reverse any temporary holds placed on customer accounts.


Timeouts

If a task exceeds its time limit, handle the timeout gracefully.

Task → Timeout → Error Handling

Banking Example: A document verification task times out after 30 seconds, triggering a manual review.


Workflow Optimization

Optimizing workflows is essential for performance and cost.


Parallelization

Execute independent tasks in parallel to reduce total time.

Sequential: 5s + 5s + 5s = 15s
Parallel:   max(5s, 5s, 5s) = 5s

Caching

Store results of expensive operations for reuse.

Banking Example: Cache customer credit scores for 24 hours to avoid repeated API calls.


Batching

Group similar tasks together for efficiency.

Banking Example: Process all pending loan applications in a nightly batch rather than individually throughout the day.


Streaming

Process data incrementally as it arrives.

Banking Example: Stream transaction data through fraud detection models rather than waiting for batch processing.


Workflow Patterns in Banking

Let's examine common workflow patterns used in banking.


Pattern 1: Customer Onboarding Workflow

Customer Request
    ↓
Collect Information
    ↓
KYC Verification
    ↓
AML Screening
    ↓
Account Creation
    ↓
Welcome Communication

Key Characteristics:

  • Sequential with conditional checks
  • Human review for KYC exceptions
  • Compliance-focused

Pattern 2: Fraud Detection Workflow

Transaction Arrives
    ↓
Feature Extraction
    ↓
Fraud Scoring (ML)
    ↓
Threshold Check
    ├─ Low → Approve
    ├─ Medium → Human Review
    └─ High → Block + Alert

Key Characteristics:

  • Real-time streaming
  • Conditional branching
  • Human-in-the-loop for medium risk

Pattern 3: Loan Origination Workflow

Loan Application
    ↓
Document Collection (Parallel)
    ├─ Identity Verification
    ├─ Income Validation
    ├─ Credit Check
    └─ Property Valuation
    ↓
Risk Assessment
    ↓
Decision
    ├─ Approve → Disburse
    ├─ Reject → Notification
    └─ Review → Human Underwriter

Key Characteristics:

  • Parallel independent tasks
  • Complex conditional logic
  • Multiple human touchpoints

Pattern 4: Regulatory Reporting Workflow

Data Collection
    ↓
Data Validation
    ↓
Report Generation
    ↓
Compliance Review
    ↓
Regulatory Submission
    ↓
Audit Trail

Key Characteristics:

  • Batch processing
  • Strong compliance requirements
  • Audit and traceability

Best Practices for Workflow Design

✅ Start with business process mapping before designing workflows

✅ Design for failure—assume things will go wrong

✅ Use idempotent operations for critical tasks

✅ Implement observability for all workflow steps

✅ Define clear escalation paths for exceptions

✅ Use versioning to manage workflow changes

✅ Test workflows with realistic data and edge cases

✅ Incorporate feedback loops for continuous improvement


Common Mistakes

❌ Overcomplicating simple workflows

❌ Building rigid workflows that can't adapt

❌ Ignoring error handling and recovery

❌ Underestimating the importance of monitoring

❌ Forgetting human-in-the-loop requirements

❌ Hardcoding sensitive information in workflows

❌ Not testing with production-like data


Interview Questions

  1. What is workflow thinking and why is it important for AI agents?

  2. How do agentic workflows differ from traditional workflows?

  3. Explain the difference between orchestration and choreography.

  4. Describe three types of workflows with examples from banking.

  5. What are human-in-the-loop patterns and when should you use them?

  6. How do you handle errors in agentic workflows?

  7. What strategies can you use to optimize workflow performance?

  8. How would you design a fraud detection workflow for a bank?

  9. What is the difference between sequential and parallel workflows?

  10. How do you decide between orchestration and choreography?


Practice Exercises

  1. Design a sequential workflow for a customer support agent that handles card replacement requests.

  2. Create a conditional workflow for a risk assessment agent that evaluates loan applications.

  3. Design a parallel workflow for a loan origination process.

  4. Implement a human-in-the-loop pattern for a high-value transaction approval process.

  5. Map a workflow for regulatory compliance reporting, identifying error handling points.


Key Takeaways

  • Workflow thinking is essential for designing effective agentic systems
  • Agentic workflows are dynamic, adaptive, and intelligent
  • Different workflow types serve different purposes
  • Orchestration and choreography are complementary approaches
  • Human-in-the-loop patterns balance automation and oversight
  • Error handling is critical for robust workflows
  • Optimization improves performance and reduces costs

Chapter Summary

In this chapter, you learned:

  • The difference between traditional and agentic workflows
  • Sequential, conditional, parallel, and iterative workflow types
  • Orchestration vs. choreography for coordination
  • Human-in-the-loop patterns for balancing automation and oversight
  • Error handling strategies for robust workflows
  • Optimization techniques for better performance
  • Common workflow patterns in banking

You now understand how to design and orchestrate workflows for AI agents. In the next chapter, we will explore multi-agent systems and how multiple agents can collaborate to achieve complex goals.


Diagram Placeholder Descriptions and Prompts

Placeholder 1: Workflow Orchestration vs Choreography

Filename: ch04-orchestration-vs-choreography.png

Description: A side-by-side comparison diagram showing the difference between orchestration and choreography approaches to workflow coordination.

Prompt:

"Create a comparison diagram showing Orchestration vs Choreography for workflow coordination. Use a side-by-side layout with purple gradient theme. Left Column: Orchestration with Title 'Orchestration', Icon 🎯, Description 'Central controller coordinates workflow', Flow: 'Orchestrator → Agent A → Agent B → Agent C', Advantages: 'Centralized control', 'Easy monitoring', 'Clear workflow', Disadvantages: 'Single point of failure', 'Scalability limit'. Right Column: Choreography with Title 'Choreography', Icon 🔄, Description 'Agents coordinate through events', Flow: 'Agent A → Event → Agent B → Event → Agent C', Advantages: 'Decentralized', 'Scalable', 'Flexible', Disadvantages: 'Complex monitoring', 'Event management'. Include key takeaway at bottom: 'Choose orchestration for defined processes, choreography for flexible systems.' Footer tags: Orchestration, Choreography, Workflow, Banking. Enterprise-style clean layout with rounded corners."


Placeholder 2: Loan Origination Workflow

Filename: ch04-loan-origination-workflow.png

Description: A detailed workflow diagram showing the loan origination process with parallel tasks, conditional branching, and human touchpoints.

Prompt:

"Create a loan origination workflow diagram for a banking AI system. Use a flowchart structure with purple gradient theme. Start: 'Loan Application' (Purple #E1BEE7). Parallel Document Collection: (Purple #CE93D8) 'Identity Verification', 'Income Validation', 'Credit Check', 'Property Valuation'. After parallel tasks: 'Risk Assessment' (Purple #AB47BC). Decision Point: (Purple #7B1FA2) 'Decision' with three branches: 'Approve → Disburse', 'Reject → Notification', 'Review → Human Underwriter' (Purple #4A148C). Include icons for each step. Add key takeaway at bottom: 'Loan origination workflows use parallel processing, conditional branching, and human oversight.' Footer tags: Loan, Workflow, Banking, Automation. Enterprise-style clean layout with rounded corners."


Placeholder 3: Human-in-the-Loop Patterns

Filename: ch04-human-in-the-loop-patterns.png

Description: A diagram showing four common human-in-the-loop patterns: Approval Required, Escalation on Exception, Human Oversight, and Feedback Loop.

Prompt:

"Create a human-in-the-loop patterns diagram showing four common patterns in banking AI. Use a 2x2 grid layout with purple gradient theme. Pattern 1: Approval Required (Top Left) - Purple #E1BEE7 with Title 'Approval Required', Icon ✅, Flow 'Agent → Recommendation → Human Review → Approved → Action', Banking Use Case 'Loan approval sign-off'. Pattern 2: Escalation on Exception (Top Right) - Purple #CE93D8 with Title 'Escalation on Exception', Icon ⚠️, Flow 'Agent → Normal Operation → Uncertainty → Escalate to Human', Banking Use Case 'Fraud investigation escalation'. Pattern 3: Human Oversight (Bottom Left) - Purple #AB47BC with Title 'Human Oversight', Icon 👁️, Flow 'Agent → Action → Human Monitor → Continue/Override', Banking Use Case 'Trading oversight'. Pattern 4: Feedback Loop (Bottom Right) - Purple #7B1FA2 with Title 'Feedback Loop', Icon 📈, Flow 'Agent → Action → Outcome → Human Feedback → Learning', Banking Use Case 'Customer service improvement'. Include key takeaway at bottom: 'Human-in-the-loop patterns balance automation with human judgment.' Footer tags: HITL, Patterns, Banking, Automation. Enterprise-style clean layout with rounded corners."


Need help with your project?
I can help you explore our services or start an inquiry.