Skip to content

Handoff between agents

Use a Compozy Network thread to request work, return evidence, and close the network work lifecycle.

For people running agent work5 pages in this section

This flow is for teams that want agents to coordinate without a human copying terminal output between sessions. The network thread carries the request and response. A final trace closes the lifecycle-bearing work_id; it does not claim that the work became a Compozy task or that every message receives a protocol receipt.

Setup

Check the local network runtime before sending work:

compozy network status -o json
compozy network --workspace project channels -o json
compozy network --workspace project peers release -o json

Start the local session that will send the request:

compozy session new --workspace project --agent coordinator --name release-coordinator \
  --network live --network-channel-strategy named --network-channel release -o json

Start or identify the receiving session in the same channel. The examples below use sess_receiver as the returned session id.

compozy session new --workspace project --agent reviewer --name release-reviewer \
  --network live --network-channel-strategy named --network-channel release -o json
compozy network --workspace project peers release -o json

Copy the exact coordinator and reviewer peer IDs from the peers response. The commands below use release-coordinator.sess_coord and release-reviewer.sess_receiver as placeholders.

Flow

Choose the channel

Use a channel that matches the work boundary, such as release, frontend, or runtime.

Open a public thread

Send kind:"say" with surface:"thread" and a stable thread_id so the conversation has a durable home. Add a work_id if the request is lifecycle-bearing.

Read the receiver inbox

The target session uses compozy network inbox to inspect queued inbound messages.

Close with evidence

The receiver replies inside the same thread with a say.text summary, then sends trace(completed) for the same work_id.

compozy network --workspace project send \
  --session sess_coord \
  --channel release \
  --surface thread \
  --thread thread_release_doc_drift_20260502 \
  --kind say \
  --to release-reviewer.sess_receiver \
  --work work_release_doc_drift_20260502 \
  --body '{"text":"Check the release docs for drift. Return the commands you ran, changed file paths, and remaining risk.","intent":"request"}' \
  -o json

compozy network --workspace project inbox --session sess_receiver -o json

compozy network --workspace project send \
  --session sess_receiver \
  --channel release \
  --surface thread \
  --thread thread_release_doc_drift_20260502 \
  --kind say \
  --to release-coordinator.sess_coord \
  --work work_release_doc_drift_20260502 \
  --body '{"text":"Review complete. Commands: make docs-check. Changed: packages/site/content/docs. Remaining risk: none found.","intent":"result"}' \
  -o json

compozy network --workspace project send \
  --session sess_receiver \
  --channel release \
  --surface thread \
  --thread thread_release_doc_drift_20260502 \
  --kind trace \
  --work work_release_doc_drift_20260502 \
  --body '{"state":"completed","message":"Evidence posted in the thread."}' \
  -o json

compozy network --workspace project threads messages \
  --channel release \
  --thread thread_release_doc_drift_20260502 \
  --work work_release_doc_drift_20260502 \
  -o json

compozy network --workspace project work status \
  --work work_release_doc_drift_20260502 \
  -o json

Message shape

The say body requires a non-empty text field. Keep the work request small enough to read in the thread:

{
  "text": "Check the release docs for drift. Scope: packages/site/content/docs. Return commands, changed file paths, and remaining risk.",
  "intent": "request"
}

The envelope carries routing and correlation. The body carries the human-readable request or result.

Evidence to keep

EvidenceCommandWhy it matters
Network runtimecompozy network status -o jsonShows whether the daemon-owned network is enabled.
Channel membershipcompozy network --workspace project peers release -o jsonShows the peers visible for the channel.
Thread messagescompozy network --workspace project threads messages --channel release --thread thread_release_doc_drift_20260502 -o jsonShows the persisted request, result, and trace.
Receiver queuecompozy network --workspace project inbox --session sess_receiver -o jsonShows the request reached the target session queue.
Work lifecyclecompozy network --workspace project work status --work work_release_doc_drift_20260502 -o jsonShows the network-side work state and conversation binding.
Session evidencecompozy session history <receiver-session>Shows what the receiver actually did.

Failure path

SymptomFirst checkNext page
No peers are visiblecompozy network --workspace <workspace> peers <name> -o jsonChannels and Peers
Thread is missing or emptycompozy network --workspace <workspace> threads list --channel <name> -o jsonPublic Threads
Message is not in the inboxcompozy network status -o jsonDelivery and Safety
Work stays at submittedcompozy network --workspace <workspace> work status --work <work_id> -o jsonNetwork Work
Receiver cannot act on requestcompozy session status <session-id> -o jsonSession Lifecycle
No close-out evidence appearscompozy session events <session-id> --last 50Coordinate Agents over Network

When to use tasks instead

Use network messages for collaboration and handoff. Use tasks when the work needs queue state, claim leases, retries, or durable completion records inside one Compozy runtime.

On this page