Learn R Programming

aisdk (version 1.1.0)

create_coder_agent: Create a CoderAgent

Description

Creates an agent specialized in writing and executing R code. The agent can execute R code in the session environment, making results available to other agents. Enhanced version with better safety controls and debugging support.

Usage

create_coder_agent(
  name = "CoderAgent",
  safe_mode = TRUE,
  timeout_ms = 30000,
  max_output_lines = 200
)

Value

An Agent object configured for R code execution.

Arguments

name

Agent name. Default "CoderAgent".

safe_mode

If TRUE (default), restricts file system and network access.

timeout_ms

Code execution timeout in milliseconds. Default 30000.

max_output_lines

Maximum output lines to return. Default 50.

Examples

Run this code
# \donttest{
if (interactive()) {
  coder <- create_coder_agent()
  session <- create_shared_session(model = "openai:gpt-4o")
  result <- coder$run(
    "Create a data frame with 3 rows and calculate the mean",
    session = session,
    model = "openai:gpt-4o"
  )
}
# }

Run the code above in your browser using DataLab