Making state machines at @statelyai · prev. @Microsoft · I play piano

Orlando, FL
Joined December 2012
We're making it even easier to create state diagrams. ➡️ state . new
The more I use AI to code, the less I "use" it
I'm adding Zod (Standard Schema) support to XState v6 and it looks more verbose but I don't think I had to type a full schema *once* Just [tab] [tab]
3
29
I hope that devs stop complaining that libraries have "too much boilerplate" when they realize they can just type [tab] [tab] [tab] to generate it all Explicit > implicit, more often than not
4
2
46
The combination of useEffect and useState tends to causes problems Not because they're bad hooks (they're not; they're extremely useful), but because they're really easy to misuse
People give `useEffect` a bad rap, but it isn't usually the source of the problem. The real problem is too many `useState`s. Devs fail to see how their data is connected and model it too discretely. As those connections appear, it is easier to synchronize than refactor the model. And once you start down that path it becomes harder to refactor because you can't see the dependencies. You can't just look at the data declaration and be like "oh it depends on this." You have to find all the places you write to it, what those locations depend on, and what writes to those.
5
2
67
Even the WIP branch (without any big cleanup/optimization efforts yet) is showing a lot of code removed
13
I agree; if you're using mega-components that can't be decomposed, you're building with DUPLO blocks, not LEGO Which is fine for toy examples!
components should feel like lego blocks you have many primitives you can assemble into anything you want they should NOT feel like finished products if I see ONE more <SignIn />
5
2
61
Working on the next version of XState and it's amazing how we can make it much simpler & more flexible by *removing* features instead of adding features
17
2
2
143
Hey @claudeai, thought this would magically work but it didn't 😢
1
4
Workflows = fixed, deterministic logic that agents can operate on Agents = the non-deterministic entities that make decisions
5
2
1
56
Correction: workflows are *not* DAGs! The cycles can be implicit (e.g. retry policies or compensation logic) or they can be long-running. Workflows are state machines at a higher level of abstraction.
Here's my 2 cents on agents !== workflows: An agent is an autonomous entity that decides what to do next. Agents can call workflows. Workflows can call agents. Workflows are a DAG that describes some async task via a series of steps. Workflows are state machines but state machines can express more than workflows (lower-level: cyclic vs. acyclic graphs). Agent behavior can be described by a state machine (like an AI coding assistant's tool-call loop to implement a solution), including strictly following a workflow (not that "agentic", though.) Agents are not workflows. Workflows & state machines are blueprints; agents are entities that can use those blueprints.
This is how it should be done! AI is a mediocre developer but a solid engineer (yes, there's a difference)
Ways I'm using AI for coding: - Building Features: plan mode, multi-phase plans, review each phase - Fixing Bugs: background agent creates repro, background agent 2 fixes repro, review - Tweaking UI: auto-accept edits, stupid model, fast loop None of this is vibe coding
6
4
1
134
Let's be honest, agents are whatever AI-flavored feature gets you VC funding
agents are workflows but only when they're not and also actors but don't forget DAGs where you can have state but mutate with message passing like state machines
1
1
27
David K 🎹 retweeted
we don't have to live this way. senior engineers have the duty of building guardrails and teaching the next generation of programmers the practices that lead to high quality software. AIs may write most of the code, but you still decide what ships. we should never lose our taste for quality software. i made this analogy a while back: everyone can cook at home but yet restaurants still exist. the floor is rising, but so is the ceiling. the best software will always be made by those who care.
Lately I’ve been feeling depressed because decades of our hard work is completely gone like it never existed. I heard from others that they also find it very hard to dial into the new norm of low quality software engineering.
Here's my 2 cents on agents !== workflows: An agent is an autonomous entity that decides what to do next. Agents can call workflows. Workflows can call agents. Workflows are a DAG that describes some async task via a series of steps. Workflows are state machines but state machines can express more than workflows (lower-level: cyclic vs. acyclic graphs). Agent behavior can be described by a state machine (like an AI coding assistant's tool-call loop to implement a solution), including strictly following a workflow (not that "agentic", though.) Agents are not workflows. Workflows & state machines are blueprints; agents are entities that can use those blueprints.
boo le an
scare a developer in 3 words
7
43
It's Halloween, it's okay to let your agents pretend to be workflows today
20
LottieFiles is doing some seriously cool things with state machines
Prompt → State Machines ✨ Interactive animations are now just a prompt away!
4
8
187
I can't remember the last time I've had memory issues
9
2
2
74
David K 🎹 retweeted
its real!
actors on vercel workflows