pub struct CopilotSdkConfig {
pub runtime_path: Option<PathBuf>,
pub base_directory: PathBuf,
pub model: String,
pub github_token: Option<String>,
pub provider: Option<CopilotSdkProvider>,
pub permission_policy: PermissionPolicy,
pub max_history_turns: usize,
pub mcp_tool_calling: bool,
pub prompt_timeout: Duration,
pub session_timeout: Duration,
}Expand description
Configuration for the Copilot SDK provider.
Fields§
§runtime_path: Option<PathBuf>Path to the copilot-runtime wrapper. runtime.node must sit next to
it. None lets the SDK resolve COPILOT_CLI_PATH itself; there is no
PATH scan.
base_directory: PathBufDirectory the runtime treats as its home (COPILOT_HOME): session
state, credential store, logs. Required because the client runs in
ClientMode::Empty, which
refuses to fall back to ~/.copilot.
model: StringModel used when a request names none.
github_token: Option<String>GitHub token the runtime authenticates with; None uses the runtime’s
stored login.
provider: Option<CopilotSdkProvider>Route sessions to this model provider instead of GitHub Copilot.
None is Copilot’s own routing, checked against its catalogue.
permission_policy: PermissionPolicyPolicy for handling permission requests from the runtime.
max_history_turns: usizeMaximum number of prior conversation messages (user + assistant) rendered into the prompt for multi-turn context. Set to 0 to disable history.
mcp_tool_calling: boolAdvertise SDK_TOOL_CALLING so callers route tool turns through
HeadlessTurnProvider::converse
with per-request MCP servers (native tool calling), instead of falling
through to text-based <tool_call> parsing. Default: false.
prompt_timeout: DurationBound on one turn, prompt sent to session idle.
session_timeout: DurationBound on client start and session creation.
Implementations§
Source§impl CopilotSdkConfig
impl CopilotSdkConfig
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Create configuration from environment variables.
Environment variables:
COPILOT_RUNTIME_PATH— Path to thecopilot-runtimewrapper (runtime.nodeadjacent); unset lets the SDK resolveCOPILOT_CLI_PATHCOPILOT_SDK_HOME— The runtime’s home directory (default: a per-process directory under the system temp dir)COPILOT_SDK_MODEL— Default model (defaults to the top-ranked candidate incrate::copilot_models::CATALOG)COPILOT_GITHUB_TOKEN/GH_TOKEN/GITHUB_TOKEN— GitHub auth tokenCOPILOT_PROVIDER_BASE_URL— Route sessions to this model provider instead of GitHub Copilot (seeCopilotSdkProvider::from_env), withCOPILOT_PROVIDER_TYPE,COPILOT_PROVIDER_API_KEYandCOPILOT_PROVIDER_MAX_PROMPT_TOKENSCOPILOT_SDK_PERMISSION_POLICY—auto_approveto approve the runtime’s permission prompts; anything else deniesCOPILOT_SDK_MAX_HISTORY_TURNS— Max conversation history turns (default: 20)COPILOT_SDK_MCP_TOOL_CALLING— AdvertiseSDK_TOOL_CALLINGfor native MCP tool calling (default: false)EMBACLE_SDK_PROMPT_TIMEOUT_SECS— Bound on one turn (default: 300)EMBACLE_SDK_SESSION_TIMEOUT_SECS— Bound on client start and session creation (default: 60)