Skip to contents

Registers btw_tool_agent_subagent (or fallback), plus any custom agents discovered from .btw/agent-*.md, .claude/agents/, etc.

Usage

register_agent_tool(
  chat,
  model = "claude-sonnet-4-6",
  mode = "default",
  rules = list(),
  max_turns = 30L,
  worktree_isolation = FALSE,
  ask_fn = NULL,
  async = FALSE,
  data_shield = NULL,
  cwd = getwd(),
  parent_chat = NULL,
  hooks = NULL,
  security_context = NULL
)

Arguments

chat

An ellmer::Chat object.

model

Character. Model for sub-agents (fallback).

mode

Character. Permission mode.

rules

List. Permission rules.

max_turns

Integer. Max turns per sub-agent.

worktree_isolation

Logical. Run sub-agents in isolated git worktrees.

ask_fn

Function or NULL. Parent permission callback forwarded to the sub-agent (which runs in "bubble" mode).

async

Logical. Passed to agent_tool(); enables concurrent sub-agents on async parent turns. Default FALSE.

data_shield

Optional DataShield inherited by codeagent sub-agents; disables uninstrumented btw/custom-agent delegation.

cwd

Character. Working directory used for upstream agent discovery.

parent_chat

Optional parent ellmer::Chat; reserved for owned sub-agent lifecycle integration.

hooks

Optional HookRegistry used for SubagentStart/Stop lifecycle events on the owned codeagent Agent path.

security_context

Internal immutable parent security snapshot.

Value

Invisibly returns chat.