Multiparty session protocols · Python 3.10+

The protocol owns control. The model owns content.

agentsparty is a Python library for multi-agent systems whose permitted conversation is known before execution. Declare the roles, messages, choices, and loops once; the library projects that protocol onto every role and runs the session in-process.

review_loop.py
import agentsparty as ap

Requester, Writer, Reviewer = ap.roles(
    'Requester', 'Writer', 'Reviewer'
)
shape = ap.patterns.review_loop(
    Requester, Writer, Reviewer
)

print(ap.render(shape))
the conversation it permits
Requester -> Writer : Task(str)
rec loop.0
  Writer -> Reviewer : Draft(str)
  Reviewer -> Writer {
    Approve():
      Writer -> Requester : Final(str)
      end
    Reject(str):
      Writer -> Requester : Revising()
      loop.0
  }