Spaces:
Running
Running
| from __future__ import annotations | |
| from dataclasses import dataclass | |
| from ..artifacts import ArtifactStore | |
| from ..bus import MessageBus | |
| 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) | |