pub struct CopilotHeadlessConfig {
pub cli_path: Option<PathBuf>,
pub working_directory: Option<PathBuf>,
pub model: String,
pub github_token: Option<String>,
pub permission_policy: PermissionPolicy,
pub max_history_turns: usize,
pub mcp_tool_calling: bool,
pub reasoning_effort: Option<ReasoningEffort>,
pub builtin_tools: bool,
}Expand description
Configuration for the Copilot Headless (ACP) provider.
Fields§
§cli_path: Option<PathBuf>Override path to the copilot CLI binary (default: auto-detect via PATH).
working_directory: Option<PathBuf>Directory every copilot --acp subprocess runs in and the cwd of every
session it serves. Copilot treats that directory as the project — it
loads .mcp.json, agent files and custom instructions from it — so a
host that sets this hands the model that project. A relative path is
anchored to the host’s cwd. Unset, the runner uses a scratch directory
under the system temp dir, not the host process’s working directory.
model: StringDefault model to use for completions.
github_token: Option<String>GitHub token for authentication (optional, uses stored OAuth by default).
permission_policy: PermissionPolicyPolicy for handling permission requests from the copilot subprocess.
max_history_turns: usizeMaximum number of prior conversation messages (user + assistant) to include in the ACP prompt for multi-turn context. Set to 0 to disable history injection.
mcp_tool_calling: boolAdvertise SDK_TOOL_CALLING so callers route tool turns through the
ACP converse() loop with per-request MCP servers (native tool
calling), instead of falling through to text-based <tool_call>
parsing. The caller must pass mcp_servers on each request for tools
to be reachable. Default: false.
reasoning_effort: Option<ReasoningEffort>Reasoning effort every copilot --acp child is launched with
(--reasoning-effort). None takes the model’s family default
(crate::copilot_models::default_effort_for); a model with no known
default gets no flag, and then the CLI uses the effortLevel in the
host user’s ~/.copilot/settings.json, which can be high.
Reasoning is billed as output and is most of a short turn’s time: one
snippet on claude-haiku-5.5 (CLI 1.0.108) took 5.8 s and 1,093 output
tokens, 895 of them reasoning, at high, and 0.9 s, 65 tokens and no
reasoning at low.
builtin_tools: boolKeep the Copilot CLI’s built-in tools (bash, view, edit, glob,
grep, web_fetch, …) available to the model. Default: false.
Off, the child is launched with --available-tools mcp:* task_complete:
the MCP servers a request brings stay callable, Autopilot keeps the tool
it ends a run with, and nothing else is offered. The built-ins’ schemas
are most of what Copilot adds to every prompt: a plain completion
measured 21,149 prompt tokens with them and 4,003 without (CLI 1.0.108).
Under PermissionPolicy::DenyAll the model could only reach the ones
that need no permission, and those read the session directory.
Implementations§
Source§impl CopilotHeadlessConfig
impl CopilotHeadlessConfig
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Create configuration from environment variables.
Environment variables:
COPILOT_CLI_PATH— Override path to copilot binaryCOPILOT_HEADLESS_WORKING_DIR— Directory the subprocess and its sessions run in (default: a scratch directory under the system temp dir)COPILOT_HEADLESS_MODEL— Default model (defaults to the top-ranked candidate incrate::copilot_models::CATALOG)COPILOT_GITHUB_TOKEN/GH_TOKEN/GITHUB_TOKEN— GitHub auth tokenCOPILOT_HEADLESS_MAX_HISTORY_TURNS— Max conversation history turns (default: 20)COPILOT_HEADLESS_MCP_TOOL_CALLING— AdvertiseSDK_TOOL_CALLINGfor native ACP MCP tool calling (default: false)COPILOT_HEADLESS_REASONING_EFFORT—low,medium,highorxhigh(default: the model’s family default; an unknown value is ignored with a warning)COPILOT_HEADLESS_BUILTIN_TOOLS— Keep the CLI’s built-in tools (default: true when the permission policy approves tool calls, false otherwise)