Skip to contents

Reads a data file, profiles it, detects column roles, synthesizes data, and exports a zip bundle suitable for passing to an AI agent.

Usage

make_agent_bundle(
  file,
  out,
  purpose = "development",
  seed = NULL,
  overwrite = FALSE,
  ...
)

Arguments

file

Path to the input data file. Passed to read_input().

out

Path for the output zip file.

purpose

Synthesis purpose preset. Defaults to "development". See synth_spec() for valid values.

seed

Optional integer random seed for reproducible synthesis.

overwrite

Logical. When FALSE (the default), aborts if out already exists.

...

Additional arguments passed to read_input() only (e.g. encoding, sheet).

Value

Invisibly, the written bundle path.

Examples

dat <- data.frame(
  age = c(24, 28, 35, 41),
  score = c(88, 91, 84, 95),
  grp = c("A", "A", "B", "B")
)
path <- tempfile(fileext = ".csv")
readr::write_csv(dat, path)
make_agent_bundle(
  file = path,
  out = tempfile(fileext = ".zip"),
  purpose = "demo",
  seed = 1
)
#> Warning: Cannot guarantee level presence for columns: grp (2 levels at k = 5 require
#> minimum n = 10). Largest minimum n = 10; output has n = 4. Restoring as many
#> levels as fit without removing another level's last copy.