AgentDefinition describes a specialized agent that can be used by a lead agent to delegate tasks. It bundles together a system prompt, tools, and metadata about what the agent can do.
Examples
if (FALSE) { # \dontrun{
# Define a code review agent
code_reviewer <- agent_definition(
name = "code_reviewer",
description = "Reviews code for bugs, style issues, and best practices",
prompt = "You are an expert code reviewer...",
tools = list(tool_read_file, tool_list_files)
)
# Use with a lead agent
lead <- LeadAgent$new(
chat = ellmer::chat("openai/gpt-4o"),
sub_agents = list(code_reviewer)
)
} # }