cli: add agent engine selection to configuration wizard

Add wizard steps for selecting agent engine backend and
configuring AI SDK specific options. Includes both embedded
and AI SDK engine choices.
This commit is contained in:
kumarabhirup 2026-01-31 22:32:11 -08:00
parent 7a957613b1
commit 9989a71cb8
2 changed files with 53 additions and 0 deletions

View File

@ -10,6 +10,7 @@ import { stylePromptHint, stylePromptMessage, stylePromptTitle } from "../termin
export const CONFIGURE_WIZARD_SECTIONS = [
"workspace",
"model",
"engine",
"web",
"gateway",
"daemon",
@ -34,6 +35,7 @@ export const CONFIGURE_SECTION_OPTIONS: Array<{
}> = [
{ value: "workspace", label: "Workspace", hint: "Set workspace + sessions" },
{ value: "model", label: "Model", hint: "Pick provider + credentials" },
{ value: "engine", label: "LLM Engine", hint: "Choose AI SDK or pi-agent" },
{ value: "web", label: "Web tools", hint: "Configure Brave search + fetch" },
{ value: "gateway", label: "Gateway", hint: "Port, bind, auth, tailscale" },
{

View File

@ -169,6 +169,53 @@ async function promptWebToolsConfig(
};
}
async function promptEngineConfig(
nextConfig: OpenClawConfig,
runtime: RuntimeEnv,
): Promise<OpenClawConfig> {
const currentEngine = nextConfig.agents?.engine ?? "aisdk";
note(
[
"OpenClaw supports two LLM engines for agent orchestration:",
"",
"• AI SDK (default): Vercel's AI SDK v6 - modern, flexible, supports AI Gateway",
"• pi-agent: Original implementation - battle-tested, full feature set",
"",
"Both engines emit compatible events, so UI and channels work with either.",
].join("\n"),
"LLM Engine",
);
const engineChoice = guardCancel(
await select<"aisdk" | "pi-agent">({
message: "Which LLM engine should OpenClaw use?",
options: [
{
value: "aisdk",
label: "AI SDK (recommended)",
hint: "Vercel AI SDK v6 - supports AI Gateway, multiple providers",
},
{
value: "pi-agent",
label: "pi-agent (legacy)",
hint: "Original implementation - stable, proven",
},
],
initialValue: currentEngine,
}),
runtime,
);
return {
...nextConfig,
agents: {
...nextConfig.agents,
engine: engineChoice,
},
};
}
export async function runConfigureWizard(
opts: ConfigureWizardParams,
runtime: RuntimeEnv = defaultRuntime,
@ -318,6 +365,10 @@ export async function runConfigureWizard(
nextConfig = await promptAuthConfig(nextConfig, runtime, prompter);
}
if (selected.includes("engine")) {
nextConfig = await promptEngineConfig(nextConfig, runtime);
}
if (selected.includes("web")) {
nextConfig = await promptWebToolsConfig(nextConfig, runtime);
}