Skip to main content
cadenza.connect(...) wires two or more robots into a single coordination terminal so they can talk to each other and share one human goal. It reuses each robot’s user-facing narration channel for robot↔robot messages, routed through a FastMCP server under the hood.
import cadenza_lab as cadenza

go1, g1 = cadenza.go1(), cadenza.g1()

with cadenza.connect(go1, g1) as term:
    go1.comm.tell("g1", "I'll scout left, you hold position")
    g1.comm.broadcast("copy that")
    print(g1.comm.messages())
FastMCP is an optional extra. Install it with pip install "cadenza-lab[mcp]".

connect()

connect(*robots, narrate=True, out=None) -> CoordinationTerminal
Pass the robot controllers you want to link. The returned CoordinationTerminal is a context manager (it owns the MCP server for the session); each robot passed in gains a .comm link.
ParamDescription
*robotsThe robot controllers to connect (go1, g1, arm, …).
narrateEcho coordination messages to the narration channel (default True).
outOptional stream to write narration to.
term.robots         # the connected robot identifiers
term.history()      # the full message log for the session
term.close()        # tear down (handled automatically by `with`)

Robot-to-robot messaging

Each connected robot exposes a .comm link:
MethodDescription
robot.comm.tell(recipient, message)Send a direct message to one robot by id.
robot.comm.broadcast(message)Send a message to every other connected robot.
robot.comm.messages()Return the messages this robot has received.
with cadenza.connect(go1, g1) as term:
    go1.comm.tell("g1", "obstacle ahead, going around right")
    g1.comm.broadcast("holding at the doorway")
    for msg in g1.comm.messages():
        print(msg["from"], "→", msg["text"])

Splitting one goal across robots

term.coordinate(goal) takes a single human goal and splits it into per-robot subgoals, then delegates each over the MCP. Routing is by explicit target (name a robot in the goal), then capability (match the subtask to what each robot can do), then round-robin.
with cadenza.connect(go1, g1) as term:
    term.coordinate("scout the room and then both meet at the door")
    # -> go1 gets the scouting subgoal, g1 gets the hold/meet subgoal
coordinate(goal: str, *, route_by_capability: bool = True)
Set route_by_capability=False to fall back to simple round-robin assignment.

Demo: two robots, one goal

"""demo_coordination.py: connect two robots and split a goal over MCP.
Requires the mcp extra:  pip install "cadenza-lab[mcp]"
"""
import cadenza_lab as cadenza

go1, g1 = cadenza.go1(), cadenza.g1()

with cadenza.connect(go1, g1) as term:
    term.coordinate("one of you scout left while the other holds the doorway")
    go1.comm.broadcast("left flank clear")
    print("log:", term.history())
python demo_coordination.py

Drive each robot

The go1 / g1 / arm controllers each robot in the terminal drives.