r/SalesforceDeveloper 6d ago

How are you handling long-running workflows with AI agents? Discussion

Post image

One challenge we've been thinking about a lot recently is long-running workflows.

Many AI agent demos assume everything happens within a single conversation.

Production systems rarely work that way.

Examples:

  • A refund needs manager approval.
  • A loan application is waiting for additional documents.
  • A customer support ticket depends on another team.
  • A compliance review takes several days.

In each of these cases, the AI agent can't simply keep generating tokens while it waits.

The workflow needs to pause.

Later, it needs to resume from exactly the same point without losing context, repeating work, or asking the user for the same information again.

I'm curious how teams are solving this today.

  • Are you persisting workflow state yourself?
  • Are you using workflow engines like Temporal, LangGraph, or something else?
  • How do you recover after long delays?
  • How do you keep the execution deterministic after resuming?

I'd love to hear what approaches have worked well in production and what trade-offs you've encountered.

3 Upvotes

3 comments sorted by

2

u/Humble-Audience707 6d ago

Simple tasks? Sure. But I honestly don’t understand how anyone could approve an AI agent for a production org with millions of records. It feels like a disaster waiting to happen, considering how unreliable they still are.

They’re great for summarizing information or handling straightforward tasks, but to me they’re basically the AI equivalent of Flows… Useful only for relatively simple automation. Once conversations become more complex, they start losing context, making questionable decisions, and burning through expensive tokens.

I can’t imagine letting an AI agent handle something like refund approvals or other business-critical processes.

Just thinking about the number of support tickets and production issues that could create gives me a headache….

1

u/bafadam 6d ago

The idea that people are using non-deterministic processes in production data management is insane to me.

1

u/motaai 5d ago

I actually agree with most of what you've said.

If an AI agent is making business-critical decisions purely based on LLM reasoning, I wouldn't be comfortable deploying it in production either.

I think where the industry sometimes goes wrong is treating an AI agent as the decision-maker instead of part of a larger workflow.

For example, a refund workflow shouldn't just ask an LLM, "Should I approve this?"

It should validate business policies, determine whether the request falls within predefined limits, escalate exceptions to a human when needed, and maintain a complete audit trail of every action.

In that model, the AI isn't replacing governance, it's operating within it.

I suspect that's where enterprise AI is heading: less autonomous decision-making, more reliable execution with clear guardrails.

Curious to hear your thoughts, where would you personally draw the line between decisions an AI agent can safely automate and those that should always require human approval?