ailets pylib-v1 for actor workflows in Python

Pylib-v1 ailets are a combination of the actor model and the “everything is a file” paradigm.

In response to a message it receives, an actor can: make local decisions, create more actors, send more messages, and determine how to respond to the next message received. Actors may modify their own private state, but can only affect each other indirectly through messaging.

For most steps in ailets pipelines, communication can be simplified by using standard input (stdin) for incoming messages and standard output (stdout) for outgoing messages. Instead of multiple discrete messages, a single message with a streaming body is sufficient.

The Python package ailets contains:

  • Dependency tree for actors
  • An orchestrator to run actors
  • Sample actors to run gpt4o and dall-e LLM workflows

Orchestration is Hard, Use the Library

The plan was to write a Python proof-of-concept, then rewrite it in Rust and throw away the Python version. The plan is still the same, but considering that the orchestrator is a non-trivial piece of code, I now prefer to retain it.

If you need “actors” plus “everything is a file”, I highly recommend using ailets. Despite the code not being published on PyPI, and despite needing to clean up unneeded LLM specifics, the time for integration into your code is much less than developing an alternative solution from scratch.

I have an advanced intuition about what can go wrong in concurrent code, but I still encountered race conditions and deadlocks in early versions. Fixing concurrency issues is a pain, and I’ve experienced this for you.

The rest (dependencies, plugins, and sample actors) are easy. There is no need to make a library out of them because the implementation details are project-specific, and I can’t guess a good generalization.

Read more

README on github:

  • Complete example
  • Very technical details