Reference

Protocol notation

Grammar for messages, alts, recursion, and parallel.

render prints a compact multiparty session-protocol notation.

Grammar

FormMeaning
A -> B : Label(type)message with payload
alt block A -> B with labelled casesalt by A toward B
alt[A, B]shorthand for alt[A, B] ( case, …)
! / ? on endpointssend / receive after projection
rec X. ... / Xrecursion binder / variable
parallel blocksindependent tracks

What render prints

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()
    )
)

Where the notation comes from

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.

Stable