ishan's notes

state machines -> async/await -> durable workflows -> 'agents'


Log of personal notes about async/await and durable workflows and state machines, and how they are all ways to model asynchronous execution. Not very readable, I need to make it more coherent.

Async await is a rotation of the state machine idea

Durable workflows are persistent async/await

Event loops and durable execution

Regular apps decouple the event loop for user events and state management

Durable workflows combine them

But this makes state migration difficult

Virtual objects (or State machines) as a middle ground

Virtual objects are a good way to model AI agents

You should follow Sunil Pai who’s all about modeling AI agents using Cloudflare’s Durable objects.

Durable objects are the same abstraction as Virtual objects in workflow engines (or Actors in other frameworks), but with serverless compute baked in. With a typical workflow engine, you deploy the handler functions separately, and make them accessible for the engine to call. With Durable objects, Cloudflare manages it for you leveraging their Workers platform.

It is pretty nice, but my brain works in python. While Cloudflare Workers does support running python (Durable objects will probably soon), they use a modded runtime (compiling python to webassembly using Pyodide). This means third party dependencies might not work out of the box. I don’t know, I am not fond of it, thats the entire USP of python.

To be continued

Sources