Grammar for messages, alts, recursion, and parallel.
render prints a compact multiparty session-protocol notation.
| Form | Meaning |
|---|---|
A -> B : Label(type) | message with payload |
alt block A -> B with labelled cases | alt by A toward B |
alt[A, B] | shorthand for alt[A, B] ( case, …) |
! / ? on endpoints | send / receive after projection |
rec X. ... / X | recursion binder / variable |
| parallel blocks | independent tracks |
from agentsparty.protocol import Nothing, Text, case, alt, msg, render
from agentsparty.kernel.role import roles
A, B = roles('A', 'B')
print(
render(
(
msg[A, B]('Ping', Text) >> alt[B, A](Nothing('Ok'), Nothing('No'))
).close()
)
)The project takes its inspiration from Multiparty Session Types (MPST), though the product docs say global choreography and endpoint protocol in ordinary prose first. For related work on agent interaction protocols, see Global Types for Agent Interaction Protocols.
Two DSLs build these protocols: the
choreography spelling and the
combinator facade. In the combinator facade,
alt[A, B] is shorthand for alt[A, B] ( …), the same alt with its roles
moved into a subscript. The rendering API itself is
agentsparty.protocol.render.