3v324v23's picture
feat: 实现多智能体协作的机器学习训练与调试闭环
11ac7be
from __future__ import annotations
from dataclasses import dataclass
from ..artifacts import ArtifactStore
from ..bus import MessageBus
@dataclass
class AgentContext:
bus: MessageBus
store: ArtifactStore
class BaseAgent:
name: str
def __init__(self, *, bus: MessageBus, store: ArtifactStore) -> None:
self.ctx = AgentContext(bus=bus, store=store)
def emit(self, *, receiver: str, kind: str, payload: dict) -> None:
self.ctx.bus.send(sender=self.name, receiver=receiver, kind=kind, payload=payload)