Skip to contents

Defines a tool or action that an agent can perform. Used for prompt-based tool discovery.

Value

An `AgentTool` object.

Public fields

name

String. The unique name of the tool.

description

String. A clear description of what the tool does.

parameters

List. A description of the expected parameters.

example

String. An example of how to use the tool.

Methods


Method new()

Initialize AgentTool

Usage

AgentTool$new(name, description, parameters = list(), example = "")

Arguments

name

String.

description

String.

parameters

List or String.

example

String. Format for Prompt


Method format()

Usage

AgentTool$format()

Returns

A formatted string describing the tool.


Method clone()

The objects of this class are cloneable with this method.

Usage

AgentTool$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

if (FALSE) { # \dontrun{
# Define a tool for searching genomic databases
tool <- AgentTool$new(
  name = "blast_search",
  description = "Perform a BLAST search against the NCBI non-redundant database.",
  parameters = list(
    query = "The DNA sequence string",
    evalue = "The e-value threshold (default 1e-5)"
  ),
  example = "blast_search(query='ATGC...', evalue=0.001)"
)

# Format for injection into a system prompt
message(tool$format())
} # }