Nous.Teams.Comms (nous v0.16.2)
View SourcePubSub topic helpers and communication utilities for multi-agent teams.
Provides consistent topic naming conventions and convenience wrappers
around Nous.PubSub for team-scoped messaging.
Topic Structure
nous:team:<team_id> — team-wide broadcasts
nous:team:<team_id>:context — shared context updates
nous:team:<team_id>:agent:<name> — direct agent messagesQuick Start
# Subscribe an agent to team + direct topics
Comms.subscribe_team(pubsub, "team_1")
Comms.subscribe_agent(pubsub, "team_1", "alice")
# Broadcast to all agents on a team
Comms.broadcast_team(pubsub, "team_1", {:discovery, %{topic: "bug found"}})
# Send a direct message to one agent
Comms.send_to_agent(pubsub, "team_1", "bob", {:peer_message, "alice", "check this"})
Summary
Functions
Build the direct message topic for a specific agent in a team.
Broadcast a message to all agents on the team.
Build the shared context update topic for a team.
Send a direct message to a specific agent on the team.
Subscribe the calling process to a specific agent's direct message topic.
Subscribe the calling process to the team-wide broadcast topic.
Build the team-wide broadcast topic.
Functions
Build the direct message topic for a specific agent in a team.
Examples
iex> Nous.Teams.Comms.agent_topic("team_1", "alice")
"nous:team:team_1:agent:alice"
Broadcast a message to all agents on the team.
Options
Uses Nous.PubSub.broadcast/3 — no-op if PubSub is nil or unavailable.
Build the shared context update topic for a team.
Examples
iex> Nous.Teams.Comms.context_topic("team_1")
"nous:team:team_1:context"
Send a direct message to a specific agent on the team.
Options
Uses Nous.PubSub.broadcast/3 on the agent's direct topic — no-op if PubSub
is nil or unavailable.
Subscribe the calling process to a specific agent's direct message topic.
Options
Uses Nous.PubSub.subscribe/2 — no-op if PubSub is nil or unavailable.
Subscribe the calling process to the team-wide broadcast topic.
Options
Uses Nous.PubSub.subscribe/2 — no-op if PubSub is nil or unavailable.
Build the team-wide broadcast topic.
Examples
iex> Nous.Teams.Comms.team_topic("team_1")
"nous:team:team_1"