## ----include=FALSE------------------------------------------------------------ knitr::opts_chunk$set( collapse = TRUE, comment = "#>", eval = identical(tolower(Sys.getenv("LLMRAGENT_RUN_VIGNETTES", "false")), "true") ) ## ----setup-------------------------------------------------------------------- # library(LLMRagent) # cfg <- LLMR::llm_config("groq", "openai/gpt-oss-20b", temperature = 0.7) ## ----run---------------------------------------------------------------------- # panel <- list( # agent("Optimist", cfg, persona = "You see opportunity first."), # agent("Skeptic", cfg, persona = "You probe for hidden costs.") # ) # debate <- deliberate(panel, "Should the department adopt a four-day week?", # rounds = 1) # # run <- as_agent_run(debate) ## ----levels------------------------------------------------------------------- # tibble::as_tibble(run, level = "utterance") # who said what, in order # tibble::as_tibble(run, level = "call") # one row per model call # tibble::as_tibble(run, level = "event") # the full event graph # tibble::as_tibble(run, level = "tool") # every tool invocation # tibble::as_tibble(run, level = "state") # each agent's memory at the end ## ----diag--------------------------------------------------------------------- # diagnostics(run) ## ----report------------------------------------------------------------------- # report(run) ## ----manifest----------------------------------------------------------------- # m <- agent_manifest(run) # m$manifest_hash # changes iff the design changes ## ----archive------------------------------------------------------------------ # dir <- file.path(tempdir(), "four_day_week_study") # archive_agent_study(run, dir) # list.files(dir) ## ----join--------------------------------------------------------------------- # calls <- tibble::as_tibble(run, level = "call") # archived <- LLMR::llm_log_read(file.path(dir, "calls.jsonl")) # # # every archived call is one of the calls the run actually made # all(archived$manifest$request_hash %in% calls$request_hash) ## ----redact------------------------------------------------------------------- # archive_agent_study(run, file.path(tempdir(), "redacted_study"), # redact = c("four-day", "salary"))