Restores an agent saved with save_agent(): same persona, config, memory
contents, budget, guardrails, and accounting. Because the config holds an
environment-variable reference rather than a key, the loaded agent works
immediately wherever that variable is set. Call, token, and tool counters
carry over, so a budget keeps binding across sessions; the wall-clock
(max_seconds) budget restarts at load. A file saved before the count of
calls with unreported usage was kept loads with n_unknown_usage set to
NA.
Usage
load_agent(path, tools = list(), embed_config = NULL)Arguments
- path
File path written by
save_agent().- tools
Tools to re-attach (functions are not serialized).
- embed_config
Required only when the saved agent used
memory_recall(); the embedding config to rebuild it with. Without it, the memory is restored as a plain buffer, with a warning.
Value
An Agent.
Examples
path <- tempfile(fileext = ".rds")
save_agent(agent("Ada", LLMR::llm_config("groq", "openai/gpt-oss-20b"),
quiet = TRUE), path)
load_agent(path)
unlink(path)