Dive

Guides

Build a multi-agent network

Build a triage agent that hands release questions to release_notes, which asks a reviewer subagent about risky changes.

Agents connect in two ways:

  • A handoff moves the conversation to another agent.
  • A subagent does one job for its caller and returns the result.

Hand off to a specialist

List the agents triage can hand the conversation to under handoffs. Each one becomes a transfer_to_<name> tool:

.dive/agents/triage.yaml
version: 1
name: triage
description: Routes questions about this repository to the right specialist.
model: chat
tools: []
handoffs:
- release_notes
- reviewer
system_prompt: |
  You route questions about this repository. Hand release questions to
  release_notes and code review requests to reviewer.

The specialist takes over the conversation, and later messages go to it.

Call a subagent

List the agents release_notes can call under subagents. Each one becomes an agent__<name> tool that takes a prompt and returns the subagent's answer:

.dive/agents/release_notes.yaml
version: 1
name: release_notes
description: Writes release notes from the changes since the latest release.
model: chat
tools:
- github__tool__gh_release
- github__tool__git_log
subagents:
- reviewer
system_prompt: |
  You write release notes for this repository. Before you write them, ask
  reviewer whether any change since the release is risky to ship, and
  call out what it finds.
.dive/agents/reviewer.yaml
version: 1
name: reviewer
description: Reviews the code changed between two git refs and reports risky changes.
model: chat
tools:
- github__tool__git_diff
system_prompt: |
  You review code changes in this repository and report what is risky,
  briefly.

The subagent starts with a fresh context, so its tool calls stay out of the caller's conversation.

Run the network

dive ask --agent triage \
  "Draft release notes for what is unreleased."

triage hands off, and release_notes gathers the commits and calls reviewer:

→ transfer_to_release_notes {"message":"User wants draft release notes…"}
✓ transfer_to_release_notes 31.6µs
→ github__tool__gh_release {}
✓ github__tool__gh_release 1.4s
→ github__tool__git_log {"base":"v0.21.0","head":"HEAD"}
→ agent__reviewer {"prompt":"Please review the code changes…"}
✓ github__tool__git_log 60.6ms
→ github__tool__git_diff {"base":"v0.21.0","head":"HEAD",…}
✓ github__tool__git_diff 104.3ms
✓ agent__reviewer 76.6s

On this page