Writes the agent's name, persona, config, memory contents, and trace to an
RDS file. Tools are functions and are not serialized; re-attach them at
load time via load_agent(tools = ...).
Arguments
- x
An Agent.
- path
File path (
.rds).
Examples
if (FALSE) { # \dontrun{
cfg <- LLMR::llm_config("groq", "openai/gpt-oss-20b")
a <- agent("Ada", cfg, persona = "Terse.")
a$chat("Remember this: the project deadline is March 3.")
save_agent(a, "ada.rds")
# a later session, any machine with GROQ_API_KEY set:
ada <- load_agent("ada.rds")
ada$chat("When is the deadline?") # the memory came along
} # }