Skip to main content

Orchestration

CodeWire provides structured coordination primitives for LLM-driven multi-agent workflows — no polling, no output parsing.

Tags

Label sessions at launch for filtering and coordination.
cw run --tag worker --tag build -- claude -p "fix tests"
cw run --tag worker --tag lint -- claude -p "fix lint issues"
cw kill --tag worker          # kill all workers
Tags are used by list, kill, wait, and subscribe for filtering.

subscribe

Subscribe to real-time session events. Events stream until disconnect.
cw subscribe [node] [--tag <tag>] [--event <type>] [--session <id>]
cw subscribe --tag worker --event session.status
cw subscribe --session 3

Event Types

EventDescription
session.createdNew session launched
session.statusSession status changed (running, completed, failed)
session.output_summaryOutput summary update
session.inputInput sent to session
session.attachedClient attached to session
session.detachedClient detached from session
direct.messageDirect message sent between sessions
message.requestRequest sent (awaiting reply)
message.replyReply to a pending request

wait

Block until sessions complete. Replaces polling.
cw wait [node:]<id> [--tag <tag>] [--condition all|any] [--timeout <s>]
FlagDescription
--tagWait for sessions matching this tag
--conditionall (default) waits for all sessions, any returns when first completes
--timeoutMaximum wait time in seconds
cw wait 3                                         # wait for session 3
cw wait --tag worker --condition all              # ALL workers
cw wait --tag worker --condition any --timeout 60 # ANY, 60s timeout

Supervisor Pattern

One orchestrator launches and waits on tagged worker sessions.
# Run tagged workers
cw run --tag worker -- claude -p "implement feature X"
cw run --tag worker -- claude -p "write tests for X"

# Wait for all to complete
cw wait --tag worker --condition all --timeout 300

# Check results
cw list --json

Multi-Agent Patterns

PatternDescription
Agent MessagingNamed agents exchange messages with cw msg, coordinate with cw request/cw reply
Multiple AttachmentsMultiple clients can attach to the same session simultaneously
SupervisorOne orchestrator launches and waits on tagged worker sessions
Agent SwarmsParallel agents with event subscriptions for coordination
Cross-SessionUse cw send and cw watch to pipe data between sessions
Shared StateUse cw kv for cross-node key-value coordination (relay mode)