Loading video...
Video Failed to Load
don't use loops, design state machines
221,789 views • 3 months ago •via X (Twitter)
60 Comments

do this today at

What does the state machine for this example look like?

My version actually don't use a full deterministic state machine, I want to keep the flexibility of AI with minimal guardrails:

Hot take: it's not loops vs state machines, it's both. The state machine defines what "done" looks like; the loop is the engine that grinds until it gets there. No loop = agent stalls mid-task. No state machine = it loops forever toward nothing. Winners design both.

Agreed, but that's not catchy and doesn't go viral 😂

We’re inventing computer science from first principles

😂 just slowly moving up the ladder of abstraction

A loop is just a state machine with 2 states 😅

😂

sir this is a kanban board /s

🪩🪩🪩

🤯🤯🤯this looks insanely powerful! 2026 -- what a year 🚀🚀 reworking stack for 3rd time in 10 days 😵💫

Give it a try at and tell me how it goes! Happy to give you some free credits :)

Sweet @duetchat

@duetchat Niceeeee

It's n8n all over again 🤔

Na, it's not a workflow engine actually, it's just the bare minimum guardrails. All workflow logic is done by agent / codegen

this is what he meant. same same

yup agreed. just adding a tangible example

State machines can be designed to run in a loop, they can also act like a DAG with an outcome certain. For example, you can have four state machines in a loop, made of four DAGs, each run updates an S3 bucket, which has a trigger to run the next state machine, etc... Cheers.

Each state should be a loop until successfully state changed

@relexyou Yup, our custom harness has this guarantee

State machines and workflows are amazing, but do you think humans should spend time focusing on those, or do you see a trajectory where the models are advance enough to manage both of those internally? Older solutions like zapier/make.com/n8n were heavy on workflows/states, but many realized how adept the models are becoming at managing those things internally. If you look at the design of claude's /workflow, you'll see it is actually far from what most people consider "workflow" -- they leap frogged quite a few steps ahead.

Claude Fable 5? Please add it to the platform as soon as possible.

On it 🫡

FYI: you may need to wait a bit for everyone's sandbox to get upgraded. If you're impatient, feel free to go into the files tab and click on "Reboot gateway". Just note that it'll terminate all currently running sessions if you do that.

Would love to give it a try

Nice, sign up at and shoot me a DM if you want more free credits

Very cool

Thanks! Give it a try at :)

👀 I’ve already ascended to recursive state-loop machines by design.

Don't design state machines, build hyper structures

Yea, this been there for sometimes and not working plus too slow

What do you mean?

Have you used it for any actual/real complex workflow?

how's duet make money? bulk token arb?

we run our own inference stack for certain models

Ah yes, got it. Thx!

Aight we are back to langgraph great 😭

Very different, it's not a workflow engine

We have the same but we used coder and n8n to integrate with linear is Duet a platform by itself? Like, could linear, clickup or others platforms have the same features as u guys?

Yup @duetchat is its own platform And it's fundamentally different than linear/clickup. In duet the kanban view is just treated as a way to visualize all your agents, as a user you don't actually interact with the cards, and that's by design The problem we are solving isn't better project management, but how can we deploy 00s of agents and actually track & steer them. Right now it's kanban, in 6 months maybe something else

@duetchat I see that, I mean we have the same, but "in-house implementation", linear is just because it's what we used before You can see we have the plan, plan approval, review approval etc... that u also have related states, on your kanban on the video Here it's using n8n for the flow

@duetchat U guys don't see your product "benefiting" from being something that can integrate with a existing linear/clickup/jira etc...? Like, stack can integrate with your codebase, but also be seen from clickup if you do something with n8n as well; Like "integrate Duet" on your workflow

state machines ARE loops with transition contracts. paperclip handoff: each agent's exit state is typed, next agent's entry matched. break-on-mismatch instead of run-on-pattern. the loop still runs — the contract just keeps it honest about what it's passing forward.

tomorrow .. "we learn about arrays"

😂😂

Excellent callout :)

This is the way

i like your thinking young man

🫡

Don’t use state machines. Design coinductive coalgebras over Cartesian closed categories.

What does this entail?

just sign up for @duetchat -

What the fuck does that mean Kobe Bryant

are you the same animal but a different beast?

this looks amazing!

Making probabilistic machines deterministic. We've come a full circle here

Deterministic orchestration probabilistic execution Also - my state machine implementation isn't fully deterministic. Guardrail only enforces correct states, orchestrator agent can transition to any state it wants

don’t use loops. design a fault-tolerant replicated giant atomic state machine. @toly
