Skip to content

feat: Agent communication — orchestrator dispatch and inter-agent messaging #3

Closed

Description

@EngineerProjects

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 — Dispatcher and TeamBus types
  • 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.Send and Dispatcher.Broadcast work end-to-end with SQLite mailbox
  • Dispatcher.Assign matches agents by Role field from registry
  • TeamBus.Start polls 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

  • TeamBus execution 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 Assign heuristic can start simple (first match by role) — smarter routing comes later

Activity

  1. added
    enhancement
    core
    multi-agent
    architecture
    on Jun 4, 2026
  2. added a commit that references this issue on Jun 4, 2026
    c6054f8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    architecturecoreenhancementmulti-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions