How to implement this workflow?

Hi,

I want to create a workflow using Langgraph. This would be basically a subgraph With checks in different steps and then determining which step to go to based on the users response.

But I’m confused as to how to implement it the best possible way.

What I’m trying to do : Create a Collections Agent(not necessarily an agent. Mostly a workflow like a state machine i guess)

What does the workflow look like :

I just wanna see the entire langgraoh implementation so that i can see how the flow can be setup in langgraph.

The flow would be something like this for the Collections Agent :

Step 1 : Check if the customer is Struggling to pay by asking them why they can’t pay

  • YES : Passed to human agent if they are vulnerable customer (eg:- dog died, lost job, etc)
  • NO: Move to Next Step 2

Step 2 : Check if they Have Arrears > 0 ?

  • YES : Move to Next Step 3
  • NO: Refer to Human Agent (Reply to customer : You’re not currently in arrears. Do you estimate being unable to pay your upcoming statement?)

Step 3 : Has Customer Provided Reason ?

  • YES : Move to next step 4
  • NO : Ask the customer for reason like “I can see you’ve got X in arrears. What happened that makes you unable to pay?” and then move to next step once they give reason

Step 4 : If reason is less severe + its a one-off incident

  • YES : Move to next step 5
  • NO : Refer to human agent

Step 5 : Reply to customer like “I can see you’ve got X in arrears. Before paying this off, are you and will you stay up to date with your priority bills?”

  • YES : Move to next Step 6
  • NO : Move to Step 5.1

Step 5.1 : Reply to customer like : “We’re sorry to hear you’re facing difficulty. Bills take priority. Are you already in touch with a DMC for this?”

  • YES : Move to Step 5.1.1
  • NO : Move to Step 5.1.2

Step 5.1.1 : Reply to customer like “Please confirm your reference number.”
Check if it Is a valid number ?

  • YES : Check if there’s a previous BS in last 6 months ?
  • NO : Refer to human Agent
  • YES : We’ll give you a 30-day breathing space so you can catch up.
  • NO : Refer to human agent

Step 5.1.2 : Reply to customer like “You need to contact a DMC. We’ll give you a 30-day breathing space for this. Please contact them. Thanks!”

Step 6 : Ask customer like “Do you expect you’ll be able to pay by your next payment due and make your regular payment?”

  • YES : Move to Next Step 7
  • NO : Move to Next Step 6.1

Step 6.1 : Reply to customer like “We can help you set up a payment plan. Approximatively how many months would you say you’d need to pay these arrears?”

  • If greater than 6 months : Refer to human with a suggestion for Hardship
  • If less than 3 months : Refer to human with a suggestion for a 3-month PTP
  • If between 3 and 6 months :Ask customer like “At the end of this period, do you expect to be able to clear your arrears and return to the minimum payment on your plan?”
  • YES : Refer to human with a suggestion for Forbearance Non-Re-Age
  • NO : Refer to human with a suggestion for Forbearance Re-Age

Step 7 : Check if there’s been Previous PTP’s in last 6 months?

  • YES : Refer to human agent
  • NO : Move to next step 8

Step 8 : Do the Account Checks

  • FAIL : Refer to human agent
  • PASS : Move to next step 9

Step 9 : Reply to customer like “I’ll set up a PTP for you. Confirm terms?”

  • YES : 1 month PTP
  • NO : Refer to human agent

Please help me suggest the best possible solution for this.

1 Like

I’ve faced a similar challenge building agent workflows that resemble state machines or deterministic conversation flows. While it’s technically possible to model these flows as a LangGraph topology—with nodes and conditionals that reflect each decision point—it quickly becomes difficult to scale or maintain. Mapping every edge case is nearly impossible, especially when conversations deviate from the ideal path.

In my current setup, I structure the graph using subgraphs (which are reactive agents), each focused on a narrow conversational intent. I use conditional edges to navigate between them. When a decision point gets complex or self-contained, I extract it into its own subgraph to improve modularity and clarity.

I also track conversation “phases”, which correspond to subgraphs, and use that to route user input deterministically—ensuring continuity and predictability in the flow.

The architecture resembles a multi-agent supervisor model, where each message flows through the graph and is handled by the right node based on context, memory, and history.

This LangGraph customer support tutorial heavily inspired my implementation. It’s the closest pattern I’ve found that balances structure with flexibility.

That said, I do wish there were more official guidance from the LangChain team on how to best structure and scale these types of flows—especially for complex business logic. My current solution works, but it’s definitely hard to maintain and can feel overengineered.

1 Like

Thank you @arthurmarcal for your amazing reply.
It’s quite difficult indeed, especially without a proper documentation for such use cases as well.

Could you please show a simple implementation for your solution so that i can get an idea how i could implement this as well.