Skip to contents

A LeadAgent is an agent that can delegate tasks to specialized sub-agents. It automatically has a delegate_to_agent tool that allows it to spawn sub-agents based on registered AgentDefinitions.

Super class

deputy::Agent -> LeadAgent

Public fields

sub_agent_defs

List of AgentDefinition objects

Methods

Inherited methods


Method new()

Create a new LeadAgent.

Usage

LeadAgent$new(
  chat,
  sub_agents = list(),
  tools = list(),
  system_prompt = NULL,
  permissions = NULL,
  working_dir = getwd()
)

Arguments

chat

An ellmer Chat object

sub_agents

List of agent_definition() objects

tools

Additional tools for the lead agent

system_prompt

System prompt for the lead agent

permissions

Permissions for the lead agent (also applied to sub-agents)

working_dir

Working directory

Returns

A new LeadAgent object


Method register_sub_agent()

Register a new sub-agent definition.

Usage

LeadAgent$register_sub_agent(definition)

Arguments

definition

An agent_definition() object

Returns

Invisible self


Method available_sub_agents()

Get available sub-agent names.

Usage

LeadAgent$available_sub_agents()

Returns

Character vector of sub-agent names


Method print()

Print the lead agent.

Usage

LeadAgent$print()


Method clone()

The objects of this class are cloneable with this method.

Usage

LeadAgent$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.