Creates an ellmer::tool() from a markdown file that defines a custom agent.
The tool can be registered with a chat client to delegate tasks to a
specialized assistant with its own system prompt and tool configuration.
Icon Specification
The icon field supports three formats:
Plain icon name: Uses shiny::icon() (Font Awesome icons). Example:
icon: robot or icon: code
Raw SVG: Starts with <svg and is used literally. Example:
icon: '<svg viewBox="0 0 24 24">...</svg>'
Package-prefixed icon: Uses pkg::icon-name format to specify icons
from other icon packages. Supported packages:
| Package | Syntax | Function Called |
| fontawesome | fontawesome::home | fontawesome::fa() |
| bsicons | bsicons::house | bsicons::bs_icon() |
| phosphoricons | phosphoricons::house | phosphoricons::ph() |
| rheroicons | rheroicons::home | rheroicons::rheroicon() |
| tabler | tabler::home | tabler::icon() |
| shiny | shiny::home | shiny::icon() |
The specified package must be installed. If the package is missing or the
icon name is invalid, a warning is issued and the default agent icon is
used.
Example Agent File
---
name: code_reviewer
description: Reviews code for best practices and potential issues.
title: Code Reviewer
icon: magnifying-glass
tools:
- files
- docs
---You are a code reviewer. Analyze code for:
- Best practices and style
- Potential bugs or issues
- Performance considerations
Provide specific, actionable feedback.
Automatic Discovery
Agent files are automatically discovered by btw_tools() when placed in
the following locations (in order of priority):
Project level (btw): .btw/agent-*.md in your project directory
User level (btw): ~/.btw/agent-*.md or ~/.config/btw/agent-*.md
Project level (Claude Code): .claude/agents/*.md in your project directory
User level (Claude Code): ~/.claude/agents/*.md
btw-style agents take precedence over Claude Code agents with the same name.
When duplicate agent names are found, a warning is issued.
Claude Code Compatibility
btw supports loading agent files from Claude Code's .claude/agents/
directory for compatibility. However, there are some small differences
when Claude Code agents are used in btw:
Name normalization: Agent names with hyphens (e.g., code-reviewer)
are automatically converted to underscores (code_reviewer) for R
compatibility.
Ignored fields: The following Claude Code fields are ignored (with
a warning): model, tools, permissionMode, skills. Use btw's
client field instead of model, and btw agents use default tools.
client argument: Use the client argument to manually override
the model for any agent file.