mini007

CRAN status R badge metacran downloads metacran downloads

mini007 is a lightweight and extensible R framework for building multi-agent AI systems. It lets you create specialised LLM-backed agents, orchestrate them through a lead agent that decomposes and delegates complex tasks, and wire them together into explicit sequential pipelines called Workflows, all built on top of the excellent ellmer package and compatible with any chat model it supports.

Key components

library(mini007)

retrieve_open_ai_credential <- function() {
  Sys.getenv("OPENAI_API_KEY")
}

llm <- ellmer::chat(
  name        = "openai/gpt-4.1-mini",
  credentials = retrieve_open_ai_credential,
  echo        = "none"
)

Agent a stateful LLM-backed worker

An Agent wraps an ellmer chat object and adds identity, persistent message history, budget tracking, and tool support.

researcher <- Agent$new(
  name        = "researcher",
  instruction = "You are a research assistant. Answer factual questions concisely.",
  llm_object  = llm
)

researcher$invoke("What is the capital of Algeria?")

Agents remember the full conversation, so follow-up questions work naturally:

researcher$invoke("And what is its population?")

Key capabilities:


LeadAgent multi-agent orchestration

A LeadAgent extends Agent with the ability to decompose a complex prompt into subtasks and automatically delegate each one to the most suitable registered agent.

summariser <- Agent$new(
  name        = "summariser",
  instruction = "Summarise text into three bullet points.",
  llm_object  = llm
)

translator <- Agent$new(
  name        = "translator",
  instruction = "Translate text from English to German.",
  llm_object  = llm
)

lead <- LeadAgent$new(name = "Lead", llm_object = llm)
lead$register_agents(c(summariser, translator))

lead$invoke("Summarise the history of the Roman Empire, then translate it into German.")

Key capabilities:


Workflow explicit sequential pipelines

A Workflow lets you build a predefined pipeline of Stations connected by Routes. Each Station’s output becomes the next one’s input. Unlike LeadAgent, the execution path is fully explicit, you control the order and branching logic.

wf <- Workflow$new(name = "article-pipeline")

wf$add_station("research", Agent$new(
  name        = "researcher",
  instruction = "Gather concise facts on the topic.",
  llm_object  = llm
))
wf$add_station("write", Agent$new(
  name        = "writer",
  instruction = "Turn the facts into an engaging paragraph.",
  llm_object  = llm
))
wf$add_station("edit", Agent$new(
  name        = "editor",
  instruction = "Polish the paragraph for grammar and clarity.",
  llm_object  = llm
))

wf$add_route("research", "write")
wf$add_route("write",    "edit")

wf$run("The history of the printing press")

Key capabilities:

Installation

You can install mini007 from CRAN with:

install.packages("mini007")

The documentation is available here

Code of Conduct

Please note that the mini007 project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.