Repository navigation
Description
Summary
Build the communication layer that lets agents send messages to each other and lets an orchestrator
dispatch tasks across a team of agents. This sits on top of the mailbox (#2) and agent registry (#1).
Depends on: #1 (AgentProfile), #2 (Mailbox)
Scope
internal/agent/comms.go—DispatcherandTeamBustypes- No TUI in this issue — core layer only
Dispatcher (proposed)
The Dispatcher is responsible for routing a task to the right agent:
```go
type Dispatcher struct {
Registry registry.Registry
Mailbox mailbox.Mailbox
}
// Send delivers a task message to a specific agent's mailbox.
func (d *Dispatcher) Send(ctx context.Context, from, to, subject, body string) error
// Broadcast sends a message to all registered agents.
func (d *Dispatcher) Broadcast(ctx context.Context, from, subject, body string) error
// Assign picks the best-fit agent for a task (by role tag) and delivers it.
func (d *Dispatcher) Assign(ctx context.Context, from, roleTag, subject, body string) error
```
TeamBus (proposed)
TeamBus manages a running team: it polls each agent's mailbox and spawns/routes sessions accordingly.
```go
type TeamBus struct {
Dispatcher *Dispatcher
// ... internal worker pool
}
func (b *TeamBus) Start(ctx context.Context) error
func (b *TeamBus) Stop()
```
Acceptance criteria
-
Dispatcher.SendandDispatcher.Broadcastwork end-to-end with SQLite mailbox -
Dispatcher.Assignmatches agents byRolefield from registry -
TeamBus.Startpolls mailboxes and logs incoming messages (session execution wired in a follow-up) - Integration test: orchestrator sends task → coder agent receives it → reply delivered back
- No breaking changes to existing session / query-loop interfaces
Notes
TeamBusexecution model: each agent processes one message at a time (no parallel sessions per agent yet)- Session spawning (actually running the agent) is intentionally left for a follow-up PR to keep this issue focused on plumbing
- The
Assignheuristic can start simple (first match by role) — smarter routing comes later
Activity
Merge pull request #8 from EngineerProjects/feat/team
feat(team): Dispatcher and TeamBus in dedicated package (#3)
Merge pull request #8 from EngineerProjects/feat/team