r/AI_Agents • u/alatmaca • Oct 17 '26
Discussion Is migrating my existing Python agent architecture to Pi-Durable a good idea?
I’m building a B2B SaaS with a Python-based architecture. The system uses separate LLM calls within Python components, with business logic, workflow orchestration, and application state managed by the existing application. I’m currently using SQLite.
As the system grows, I’m thinking about potential challenges around concurrent users, long-running workflows, retries, failure recovery, and agents handing tasks back and forth.
I’ve been advised to consider migrating the orchestration layer to Pi-Durable, but I’m not sure whether this is the right move for my current architecture.
Does migrating to Pi-Durable make sense in this situation, or would I be better off keeping my current architecture and improving it as needed? What trade-offs should I consider before making this decision?
2
u/axonpush Oct 17 '26
I'd separate what a durable runtime buys from what stays yours. It buys workflow state that survives process restarts, timers and waits that can sleep for days without holding a worker, and a replayable history when a run goes wrong. It does not buy exactly-once side effects: as Ctbhatia said, each step still needs its own idempotency key, or a retry after a crash mid-send can double-send.
Two questions decide it for me. First, do your workflows actually wait on things: human approvals, external callbacks, other agents, for minutes to days? That's the case a jobs table handles badly and durable execution handles well. If everything is request-scoped or short, Postgres plus a jobs table is simpler. Second, are you ready for the constraints: workflow bodies must be deterministic (no wall clock, random, or direct IO in them; those move into steps), and you need a versioning story for workflows already in flight when you deploy new code.
If yes to both, I'd still migrate only the long-running workflows and leave the request-scoped paths alone. A full rewrite is the expensive version; a hybrid is usually enough.
1
u/Significant_Tune9219 Oct 18 '26
Moving the loop into a durable runtime does not move the charge. In this setup the workflow log would live in one place and the business write would still live in the Python process and SQLite, and those are different lifecycles. A retry of the loop after a crash can run that Python step again even though the write already committed, and the durable history will say the step succeeded twice. I would leave the orchestration where it is until the side effect and the record of that side effect commit together. The kill-the-worker test only passes if the second run does not create a second write.
1
u/AutoModerator Oct 17 '26
Thank you for your submission, for any questions regarding AI, please check out our wiki at https://www.reddit.com/r/ai_agents/wiki (this is currently in test and we are actively adding to the wiki)
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/Ctbhatia Oct 17 '26
the cheap test before migrating is killing the worker mid workflow and seeing whether it resumes exactly once. if a retry can double send or double charge, that stays your problem after a durable runtime unless each step carries a key.
1
u/JayotiKellers-45 Oct 18 '26
how many concurrent users are you actually dealing with right now? imo the answer changes a lot depending on whether this is a "we have 5 beta customers" problem or a "we're scaling past 100 tenants" problem. migrating orchestration layers too early can create more complexity than it solves
1
u/MeasurementGreat5273 Oct 21 '26
haven't used Pi-Durable in prod so i can't judge it directly, but i've built multi-step workflows with retries and human checkpoints on custom workers, and the hard part was almost never the orchestrator. it was making every step idempotent and saving state per step, so a crashed run resumes from step 4 instead of starting over or sending the same email twice. a durable engine helps with that, but it won't fix steps that aren't safe to repeat.
so before migrating i'd check if your current setup has a run table with a status per step, a retry count and the saved output of each step. SQLite is fine while it's one process, but once several workers write at the same time i'd move to Postgres before adding a new framework, imo that's the cheaper change and covers most of the concurrency worry. if after that you're still hand rolling timers, waiting on humans and resuming long runs, that's when a durable execution tool starts paying for itself. what does a failure actually look like for you today, a lost run or a duplicated side effect?
0
u/QuanTradin Oct 17 '26
I'd fix SQLite before touching orchestration. concurrent writes are what bite first, and Postgres plus a plain jobs table with retries and a status column covers most of what a durable framework gives you at your size. move to something like Pi-Durable when you actually have workflows that run for hours and need to resume mid-step.