Spaces:
Running
Running
File size: 543 Bytes
11ac7be | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 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)
|