Skip to contents

Creates a new HalClient instance for low-level ACP communication. Most users should use hal_chat() instead.

Usage

hal_client(
  model = NULL,
  cli_path = NULL,
  permission_policy = "auto-allow",
  on_text = NULL,
  on_tool_call = NULL,
  on_thought = NULL,
  quiet = FALSE
)

Arguments

model

Model identifier (e.g., "claude-sonnet-5", "gpt-5.2"). Passed as --model to the CLI at startup. If NULL, falls back to the COPILOT_MODEL environment variable, then the server default.

cli_path

Path to the Copilot CLI binary. If NULL, searches PATH and common install locations.

permission_policy

How to handle tool permission requests: "auto-allow" (default) auto-approves, "auto-deny" auto-denies, "ask" prompts interactively (vscode backend only), or a function receiving permission params. The function returns an ACP option id on copilot, or a string containing "allow"/"deny" on vscode/claude.

on_text

Callback for streaming text chunks: function(chunk).

on_tool_call

Callback for tool call events: function(tool_call).

on_thought

Callback for thought chunks: function(chunk).

quiet

Logical; suppress informational messages (default FALSE).

Value

A HalClient object.

Examples

if (FALSE) { # \dontrun{
client <- hal_client()
client$start()
client$handshake()
session <- client$new_session()
client$stop()
} # }