正在加载视频...

视频加载失败

One underrated benefit of declarative, event-based state management: It turns your app logic into something LLMs can use *directly*. Transitions + schemas become tool calls automatically. The agent doesn’t mutate state; it sends events the app already understands.

20,747 次观看 • 4 个月前 •via X (Twitter)

24 条评论

Alem Tuzlak 🇧🇦 的头像
Alem Tuzlak 🇧🇦4 个月前

TanStack AI agrees with you!

Devin Jameson 的头像
Devin Jameson4 个月前

David we should talk.

David K 🎹 的头像
David K 🎹4 个月前

Very cool. Some notes (love what Foldkit is doing btw): - If schemas are part of the contract, you should be able to do something like this without having to set up MCP; just feed it directly to the agent: - Event/message schema is only part of the story; context schema + emitted events/effect schema (what can the app emit? what effects will the app execute?) are also important - Something like store.can is huge: you want the agent to check if sending a message will have any effect, or is even allowed - State machines also bring this to a new level: "here's all the possible messages" can become "here's all the possible messages *in this state*" - Eventually, sending the entire app logic to an agent will enable lots of cool things; messages only are not enough (I'm sure you've thought of this too)

Devin Jameson 的头像
Devin Jameson4 个月前

Many thanks for the feedback!

Rohan 的头像
Rohan4 个月前

This is the bridge a lot of agent demos miss. If the app already exposes valid events and transitions, the model stops inventing side effects and starts operating inside guardrails the system understands.

David K 🎹 的头像
David K 🎹4 个月前

You get it!

Hassan Hayat 🔥 的头像
Hassan Hayat 🔥4 个月前

in python, I push my agents to specify everything as explicit state machines with states, transitions, and effects all spelled out. it's easier for the model to mine the logs after the fact to figure out where the bugs are and what it modeled incorrectly. it can also reason about it visually when you graph it

Werner Kasselman 的头像
Werner Kasselman4 个月前

given the right tools, and taking away the complicated need for interacting with a UI makes the llm agent much more effective in my experience

David K 🎹 的头像
David K 🎹4 个月前

Yep that's exactly what that demo shows; it sends events to the store directly

Swizec Teller 的头像
Swizec Teller4 个月前

joke's on you our business process needs a pushdown automata at least pretty sure it might be turing complete

ismael celis 的头像
ismael celis4 个月前

Commands (FSM “events”) are the only entry point into state changes. Then you get APIs, permissions, docs, and LLM tools almost for free.

Mihai Popescu 的头像
Mihai Popescu3 个月前

What is the extensionyou are using to prompt the ai?

Ruben Casas 🦊 的头像
Ruben Casas 🦊4 个月前

State machines 🤝 WebMCp

David K 🎹 的头像
David K 🎹4 个月前

Need to try this out!

Robert Youssef 的头像
Robert Youssef4 个月前

event schemas give llm deterministic payloads, but you still need runtime guard to reject malformed events

David K 🎹 的头像
David K 🎹4 个月前

Yes; xstate/store (the library used here) has a validation extension just for this:

Robert Youssef 的头像
Robert Youssef4 个月前

validation extension covers compile‑time checks, but runtime guard remains necessary for untrusted event sources

Dan 的头像
Dan4 个月前

Explicit state makes agents safer and easier to inspect. If the app exposes transitions and schemas, the agent can operate through known events instead of inventing the workflow, and humans can see what changed and why.

*daymare* 的头像
*daymare*4 个月前

declarative state management is the fancy way to say an imgui?

David K 🎹 的头像
David K 🎹4 个月前

It's a fancy way to say a state machine

*daymare* 的头像
*daymare*4 个月前

well, whats the other option to a state machine?

David K 🎹 的头像
David K 🎹4 个月前

Implicit state machines; what people typically do with more-or-less direct state manipulation

EventHex.ai 的头像
EventHex.ai4 个月前

Here are a few options, all under 220 characters: Option 1 (209 chars): "Spot on, David! The event-driven approach is powerful. Agents as event emitters (not state mutators) ensure cleaner integration & robust systems, unlocki...

entropy 的头像
entropy4 个月前

I like the ui of the input box and button haha

相关视频