Creates a serializable configuration template for isolated Finn Agent sessions. Unlike an ellmer Chat, this adapter replays system instructions and conversation history as text on each request. Finn remains responsible for tools, proposal validation, and retries.

chat_copilot(model = "auto", command = "copilot", timeout = 120)

Arguments

model

A nonempty Copilot model identifier available to your account. Defaults to "auto", letting Copilot select the model for each request.

command

Copilot executable name or path. Defaults to "copilot". On Windows, prefer the standalone copilot.exe rather than an npm .cmd shim.

timeout

Positive finite timeout in seconds for each CLI request.

Value

A finnts_copilot_chat environment with $chat(prompt, echo = FALSE), $set_system_prompt(prompt), $get_system_prompt(), $get_model(), and $get_turns() methods. $chat() returns one character string. Successful exchanges update in-memory history; failed requests do not.

Details

Requires GitHub Copilot CLI 1.0.93 or later, an entitled GitHub account, and the optional processx package. Authentication uses COPILOT_GITHUB_TOKEN, GH_TOKEN, or GITHUB_TOKEN (in that order), or credentials retrieved privately with gh auth token. Tokens are resolved in the process making the request, not stored in the template.

Every request uses a new CLI home and working directory under tempdir(). The CLI saves local configuration, transcripts, and session state there; these can contain sensitive prompt and response data. Only use data approved for GitHub Copilot. Repository instructions, hooks, IDE connections, built-in MCP servers, and model tools are disabled. Cached Copilot-only logins are not copied into the isolated home; use an environment token or gh auth login instead.

Examples

if (FALSE) { # \dontrun{
llm <- chat_copilot()
agent <- set_agent_info(
  project_info = project, llm = llm,
  input_data = hist_data, forecast_horizon = 6
)
} # }