// Multi-agent federation reference architecture: a swarm of agents around MBEstudio. // Domain neutral: the subsystems stand for whatever the system under design // decomposes into. MBEstudio is one system: orchestrator, model and conflict engine. package MultiAgentFederation { private import ScalarValues::*; item def Contract; item def Fragment; item def Assignment; item def Proposal; item def Decision; item def Changeset; item def Exchange; port def AgentLink { in item contract : Contract; out item fragment : Fragment; } port def AssignLink { out item assignment : Assignment; } port def ReviewLink { in item proposal : Proposal; out item decision : Decision; } port def CommitLink { out item changeset : Changeset; } port def ToolLink { out item exchange : Exchange; } part def Model { port commit : ~CommitLink; port exchange : ToolLink; } part def ConflictEngine { port orchestrator : ~AgentLink; port agentA : ~AgentLink; port agentB : ~AgentLink; port agentN : ~AgentLink; port critic : ~AgentLink; port review : ~ReviewLink; port commit : CommitLink; } part def MBEstudio { port agentA : ~AgentLink; port agentB : ~AgentLink; port agentN : ~AgentLink; port critic : ~AgentLink; port review : ~ReviewLink; port exchange : ToolLink; port taskA : AssignLink; port taskB : AssignLink; port taskN : AssignLink; } part def Orchestrator { port context : AgentLink; port taskA : AssignLink; port taskB : AssignLink; port taskN : AssignLink; } part def SubsystemAgent { port studio : AgentLink; port tasks : ~AssignLink; } part def CriticAgent { port studio : AgentLink; } part def Engineer { port review : ReviewLink; } part def ExistingTool { port exchange : ~ToolLink; } attribute def ContractsIssued; attribute def FragmentSubmitted; attribute def Reconciled; attribute def ConflictsFound; attribute def ConflictsResolved; attribute def RepromptAgent; attribute def Approved; attribute def Rejected; attribute def ExportComplete; action def SwarmWorkflow { attribute isApproved : Boolean; action decompose; action readBaseline; action freezeContracts; action assignAgents; action buildA; action buildB; action buildN; action stageFragments; action reconcile; action resolve; action review; action commit; action exportArtifacts; action exportRecords; action exportReports; fork split; join merged; first start then decompose; first decompose then readBaseline; first readBaseline then freezeContracts; first freezeContracts then assignAgents; first assignAgents then split; first split then buildA; first split then buildB; first split then buildN; first buildA then merged; first buildB then merged; first buildN then merged; first merged then stageFragments; first stageFragments then reconcile; first reconcile then resolve; first resolve then review; first review; then decide signOff; if isApproved then commit; else resolve; first commit then exportArtifacts; first exportArtifacts then exportRecords; first exportRecords then exportReports; first exportReports then done; } part swarm { part mbestudio : MBEstudio { part orchestrator : Orchestrator { allocate SwarmWorkflow.decompose to orchestrator; allocate SwarmWorkflow.assignAgents to orchestrator; } part model : Model { allocate SwarmWorkflow.readBaseline to model; allocate SwarmWorkflow.stageFragments to model; allocate SwarmWorkflow.exportArtifacts to model; allocate SwarmWorkflow.exportRecords to model; allocate SwarmWorkflow.exportReports to model; } part engine : ConflictEngine { allocate SwarmWorkflow.freezeContracts to engine; allocate SwarmWorkflow.reconcile to engine; allocate SwarmWorkflow.resolve to engine; allocate SwarmWorkflow.commit to engine; } bind taskA = orchestrator.taskA; bind taskB = orchestrator.taskB; bind taskN = orchestrator.taskN; bind agentA = engine.agentA; bind agentB = engine.agentB; bind agentN = engine.agentN; bind critic = engine.critic; bind review = engine.review; bind exchange = model.exchange; connect orchestrator.context to engine.orchestrator; connect engine.commit to model.commit; } part agentA : SubsystemAgent { allocate SwarmWorkflow.buildA to agentA; } part agentB : SubsystemAgent { allocate SwarmWorkflow.buildB to agentB; } part agentN : SubsystemAgent { allocate SwarmWorkflow.buildN to agentN; } part critic : CriticAgent; part engineer : Engineer { allocate SwarmWorkflow.review to engineer; } part tools : ExistingTool; connect mbestudio.taskA to agentA.tasks; connect mbestudio.taskB to agentB.tasks; connect mbestudio.taskN to agentN.tasks; connect agentA.studio to mbestudio.agentA; connect agentB.studio to mbestudio.agentB; connect agentN.studio to mbestudio.agentN; connect critic.studio to mbestudio.critic; connect engineer.review to mbestudio.review; connect mbestudio.exchange to tools.exchange; exhibit state workflow { entry; then decompose; state decompose; state generate; state reconcile; state resolveConflicts; state humanReview; state committed; state exported; transition first decompose accept ContractsIssued then generate; transition first generate accept FragmentSubmitted then reconcile; transition first reconcile accept Reconciled then humanReview; transition first reconcile accept ConflictsFound then resolveConflicts; transition first resolveConflicts accept ConflictsResolved then humanReview; transition first resolveConflicts accept RepromptAgent then generate; transition first humanReview accept Approved then committed; transition first humanReview accept Rejected then resolveConflicts; transition first committed accept ExportComplete then exported; } } }