Injects codeagent tools (Bash, Read, Write, Edit, Glob, Grep, LS, btw tools,
skill tool) and rebuilds the system prompt. The returned CodeagentClient
is the single object passed to codeagent() and codeagent_app().
Arguments
- chat
An
ellmer::Chatobject – any backend supported by ellmer:chat_openai_compatible(),chat_anthropic(),chat_ollama(), etc. If NULL, a chat is auto-built fromCODEAGENT_BASE_URL/CODEAGENT_MODELenv vars (or Anthropic defaults).- permission_mode
Character. One of PermissionMode.
- rules
List of
PermissionRule()objects.- cwd
Character. Working directory (used for CLAUDE.md, skills, sessions).
- max_turns
Integer. Maximum agentic loop turns.
- btw_groups
Character vector or NULL. btw tool groups to register (e.g.
c("docs","git","pkg")). NULL = all available groups.- worktree_isolation
Logical. Run sub-agents in isolated git worktrees.
- verify_fn
Function or NULL. Optional output verifier; re-enters the loop when it reports failures (e.g.
verify_r_tests()).- mcp_config
MCP client config (JSON path or inline list) to connect external MCP servers; see
register_mcp_client(). NULL disables.- register_tools
Logical. If
TRUE(default) register all tools now.FALSEreturns a lightweight shell (chat + settings + system prompt, no tools) so callers (e.g.codeagent_app()) can render UI first and defer the expensive tool registration; call.register_all_tools()later.