Skip to contents

When btw is available, delegates to btw_tool_agent_subagent() which provides isolated chat sessions with resumable state. Falls back to codeagent's own sub-agent loop otherwise.

Usage

agent_tool(
  model = "claude-sonnet-4-6",
  mode = "default",
  rules = list(),
  max_turns = 30L,
  worktree_isolation = FALSE,
  hooks = NULL,
  ask_fn = NULL,
  async = FALSE
)

Arguments

model

Character. Model for sub-agents (fallback only).

mode

Character. Permission mode (inherited from parent).

rules

List. Permission rules (inherited).

max_turns

Integer. Max turns for sub-agent fallback (default 30).

worktree_isolation

Logical. Run sub-agent in an isolated git worktree.

hooks

A HookRegistry or NULL. Fires SubagentStart/Stop on the codeagent fallback sub-agent. Only applies to the fallback implementation; btw subagent handles its own isolation.

ask_fn

Function or NULL. Parent permission callback. Sub-agents run in "bubble" mode, so any "ask" decision is forwarded to this function.

Value

An ellmer::tool() object.