Skip to content

collaboration ¤

Collaboration protocol models for CrewMaster v2.0.0.

MODULE DESCRIPTION
protocol

Collaboration protocol implementations for CrewMaster v2.0.0.

protocol_test

Tests for CollaborationProtocol implementations.

CLASS DESCRIPTION
BlackboardConfig

Configuration for the blackboard collaboration protocol.

BlackboardProtocol

Blackboard protocol: all participants see all messages.

CollaborationProtocol

Base protocol for multi-agent collaboration strategies.

CollaborationResult

The result of executing a collaboration protocol.

ConsensusConfig

Configuration for the consensus collaboration protocol.

ConsensusItem

A single proposal or vote item in the consensus protocol.

ConsensusProtocol

Consensus protocol: participants propose and vote until consensus.

DebateConfig

Configuration for the debate collaboration protocol.

DebateProtocol

Debate protocol: two debaters argue, optional judge decides winner.

GrillMeConfig

Configuration for the grill_me collaboration protocol.

GrillMeProtocol

Grill-me protocol: critic and respondent alternate turns.

SupervisorConfig

Configuration for the supervisor collaboration protocol.

SupervisorProtocol

Supervisor protocol: supervisor assigns, workers execute, supervisor reviews.

__all__ module-attribute ¤

__all__ = ['BlackboardConfig', 'BlackboardProtocol', 'CollaborationProtocol', 'CollaborationResult', 'ConsensusConfig', 'ConsensusItem', 'ConsensusProtocol', 'DebateConfig', 'DebateProtocol', 'GrillMeConfig', 'GrillMeProtocol', 'SupervisorConfig', 'SupervisorProtocol']

BlackboardConfig ¤

Configuration for the blackboard collaboration protocol.

ATTRIBUTE DESCRIPTION
participants

List of agents that contribute to the blackboard.

TYPE: list[Any]

max_rounds

Maximum number of rounds of contributions.

TYPE: int

participants class-attribute instance-attribute ¤

participants: list[Any] = Field(description='List of AgentConfig instances')

max_rounds class-attribute instance-attribute ¤

max_rounds: int = Field(default=3, ge=1)

model_config class-attribute instance-attribute ¤

model_config = {'arbitrary_types_allowed': True}

BlackboardProtocol ¤

BlackboardProtocol(config: BlackboardConfig)

Blackboard protocol: all participants see all messages.

Flow::

round 1: agent_1 -> agent_2 -> ... -> agent_N
round 2: agent_1 -> agent_2 -> ... -> agent_N
...

History is indexed by round and contributor. All participants see all messages from all prior contributions.

METHOD DESCRIPTION
execute

Public entry point — delegates to _execute_impl.

ATTRIBUTE DESCRIPTION
config

config instance-attribute ¤

config = config

execute async ¤

execute(operation: Any, runtime: Any, context_store: Any) -> CollaborationResult

Public entry point — delegates to _execute_impl.

CollaborationProtocol ¤

Base protocol for multi-agent collaboration strategies.

Collaboration protocols orchestrate multiple agents through structured interaction patterns. Each protocol implementation manages turn state internally and produces a single typed output artifact.

Usage::

class GrillMeProtocol:
    async def execute(self, operation, runtime, context_store):
        # Run N rounds of critique -> revision
        ...
        return CollaborationResult(output=final_artifact)
METHOD DESCRIPTION
execute

Execute the collaboration protocol.

execute async ¤

Execute the collaboration protocol.

PARAMETER DESCRIPTION

operation ¤

The Operation that triggered this collaboration.

TYPE: Any

runtime ¤

The RuntimeDriver to use for agent invocations.

TYPE: Any

context_store ¤

The ContextStore for resolving context projectors.

TYPE: Any

RETURNS DESCRIPTION
CollaborationResult

A CollaborationResult with the final typed artifact.

CollaborationResult ¤

The result of executing a collaboration protocol.

ATTRIBUTE DESCRIPTION
output

The final typed artifact produced by the collaboration.

TYPE: Any

protocol_type

The name of the protocol that produced this result.

TYPE: str

turn_count

Total number of turns taken during execution.

TYPE: int

participant_outputs

Individual outputs from each participant indexed by agent name.

TYPE: dict[str, list[Any]]

output class-attribute instance-attribute ¤

output: Any = None

protocol_type class-attribute instance-attribute ¤

protocol_type: str = ''

turn_count class-attribute instance-attribute ¤

turn_count: int = 0

participant_outputs class-attribute instance-attribute ¤

participant_outputs: dict[str, list[Any]] = Field(default_factory=dict)

model_config class-attribute instance-attribute ¤

model_config = {'arbitrary_types_allowed': True}

ConsensusConfig ¤

Configuration for the consensus collaboration protocol.

ATTRIBUTE DESCRIPTION
participants

List of agents that vote/propose.

TYPE: list[Any]

max_rounds

Maximum number of voting rounds before forced decision.

TYPE: int

consensus_threshold

Fraction (0-1) of participants that must agree.

TYPE: float

participants class-attribute instance-attribute ¤

participants: list[Any] = Field(description='List of AgentConfig instances')

max_rounds class-attribute instance-attribute ¤

max_rounds: int = Field(default=3, ge=1)

consensus_threshold class-attribute instance-attribute ¤

consensus_threshold: float = Field(default=1.0, ge=0.0, le=1.0)

model_config class-attribute instance-attribute ¤

model_config = {'arbitrary_types_allowed': True}

ConsensusItem ¤

A single proposal or vote item in the consensus protocol.

ATTRIBUTE DESCRIPTION
agent

TYPE: str

proposal

TYPE: str

agent class-attribute instance-attribute ¤

agent: str = ''

proposal class-attribute instance-attribute ¤

proposal: str = ''

ConsensusProtocol ¤

ConsensusProtocol(config: ConsensusConfig)

Consensus protocol: participants propose and vote until consensus.

Flow::

round 1: each participant proposes -> vote on proposals -> check consensus
round 2: participants revise proposals -> vote -> check consensus
...

Consensus is reached when consensus_threshold fraction of participants agree on the same proposal. If max_rounds is reached without consensus, the majority position is returned.

METHOD DESCRIPTION
execute

Public entry point — delegates to _execute_impl.

ATTRIBUTE DESCRIPTION
config

config instance-attribute ¤

config = config

execute async ¤

execute(operation: Any, runtime: Any, context_store: Any) -> CollaborationResult

Public entry point — delegates to _execute_impl.

DebateConfig ¤

Configuration for the debate collaboration protocol.

ATTRIBUTE DESCRIPTION
debater_a

First debater agent.

TYPE: Any

debater_b

Second debater agent.

TYPE: Any

judge

Optional judge agent who determines the winner.

TYPE: Any | None

max_turns

Maximum number of debate rounds.

TYPE: int

debater_a class-attribute instance-attribute ¤

debater_a: Any = Field(description='AgentConfig for debater A')

debater_b class-attribute instance-attribute ¤

debater_b: Any = Field(description='AgentConfig for debater B')

judge class-attribute instance-attribute ¤

judge: Any | None = Field(default=None, description='Optional judge AgentConfig')

max_turns class-attribute instance-attribute ¤

max_turns: int = Field(default=3, ge=1)

model_config class-attribute instance-attribute ¤

model_config = {'arbitrary_types_allowed': True}

DebateProtocol ¤

DebateProtocol(config: DebateConfig)

Debate protocol: two debaters argue, optional judge decides winner.

Flow::

debater_a -> debater_b -> debater_a -> ... -> judge -> winner

If no judge is provided, the last debater's position is returned.

METHOD DESCRIPTION
execute

Public entry point — delegates to _execute_impl.

ATTRIBUTE DESCRIPTION
config

config instance-attribute ¤

config = config

execute async ¤

execute(operation: Any, runtime: Any, context_store: Any) -> CollaborationResult

Public entry point — delegates to _execute_impl.

GrillMeConfig ¤

Configuration for the grill_me collaboration protocol.

ATTRIBUTE DESCRIPTION
critic

The agent who critiques.

TYPE: Any

respondent

The agent who produces and revises.

TYPE: Any

max_turns

Maximum number of critique->revision cycles.

TYPE: int

stalemate_threshold

Stop if respondent output doesn't change for this many consecutive turns.

TYPE: int

finalize_step

Optional agent that does a final polish pass.

TYPE: Any | None

critic class-attribute instance-attribute ¤

critic: Any = Field(description='AgentConfig for the critic')

respondent class-attribute instance-attribute ¤

respondent: Any = Field(description='AgentConfig for the respondent')

max_turns class-attribute instance-attribute ¤

max_turns: int = Field(default=3, ge=1)

stalemate_threshold class-attribute instance-attribute ¤

stalemate_threshold: int = Field(default=2, ge=1)

finalize_step class-attribute instance-attribute ¤

finalize_step: Any | None = Field(default=None, description='Optional agent for final polish')

model_config class-attribute instance-attribute ¤

model_config = {'arbitrary_types_allowed': True}

GrillMeProtocol ¤

GrillMeProtocol(config: GrillMeConfig)

Grill-me protocol: critic and respondent alternate turns.

Flow::

respondent produces -> critic critiques -> respondent revises -> ...

Terminates when max_turns is reached, or when the respondent's output is unchanged for stalemate_threshold consecutive turns.

METHOD DESCRIPTION
execute

Public entry point — delegates to _execute_impl.

ATTRIBUTE DESCRIPTION
config

config instance-attribute ¤

config = config

execute async ¤

execute(operation: Any, runtime: Any, context_store: Any) -> CollaborationResult

Public entry point — delegates to _execute_impl.

SupervisorConfig ¤

Configuration for the supervisor collaboration protocol.

ATTRIBUTE DESCRIPTION
supervisor

The agent that assigns tasks and reviews results.

TYPE: Any

workers

List of worker agents that execute assigned tasks.

TYPE: list[Any]

max_iterations

Maximum number of assign->execute->review cycles.

TYPE: int

supervisor class-attribute instance-attribute ¤

supervisor: Any = Field(description='AgentConfig for the supervisor')

workers class-attribute instance-attribute ¤

workers: list[Any] = Field(description='List of worker AgentConfig instances')

max_iterations class-attribute instance-attribute ¤

max_iterations: int = Field(default=3, ge=1)

model_config class-attribute instance-attribute ¤

model_config = {'arbitrary_types_allowed': True}

SupervisorProtocol ¤

SupervisorProtocol(config: SupervisorConfig)

Supervisor protocol: supervisor assigns, workers execute, supervisor reviews.

Flow::

supervisor assigns task -> worker executes -> supervisor reviews -> iterate

The supervisor receives the worker's output and decides whether to accept it or request a revision. The final output is the consolidated result produced by the supervisor.

METHOD DESCRIPTION
execute

Public entry point — delegates to _execute_impl.

ATTRIBUTE DESCRIPTION
config

config instance-attribute ¤

config = config

execute async ¤

execute(operation: Any, runtime: Any, context_store: Any) -> CollaborationResult

Public entry point — delegates to _execute_impl.