diff --git a/core/config/yaml/loadYaml.ts b/core/config/yaml/loadYaml.ts index 40821bb04..535dd8d35 100644 --- a/core/config/yaml/loadYaml.ts +++ b/core/config/yaml/loadYaml.ts @@ -187,6 +187,7 @@ export async function configYamlToContinueConfig(options: { autocomplete: [], rerank: [], summarize: [], + subagent: [], }, selectedModelByRole: { chat: null, @@ -196,6 +197,7 @@ export async function configYamlToContinueConfig(options: { autocomplete: null, rerank: null, summarize: null, + subagent: null, }, rules: [], requestOptions: { ...config.requestOptions }, diff --git a/extensions/cli/src/services/ModelService.ts b/extensions/cli/src/services/ModelService.ts index 3fc4a4126..82e5d21e9 100644 --- a/extensions/cli/src/services/ModelService.ts +++ b/extensions/cli/src/services/ModelService.ts @@ -314,7 +314,7 @@ export class ModelService const subagentModels = state.assistant.models ?.filter((model) => !!model) .filter((model) => !!model.name) // filter out models without a name - .filter((model) => model.roles?.includes("apply")) // filter with role subagent + .filter((model) => model.roles?.includes("subagent")) // filter with role subagent .filter((model) => !!model.chatOptions?.baseSystemMessage); // filter those with a system message if (!subagentModels) { diff --git a/extensions/cli/src/subagent/get-agents.ts b/extensions/cli/src/subagent/get-agents.ts index 3f64acc04..80a84bd69 100644 --- a/extensions/cli/src/subagent/get-agents.ts +++ b/extensions/cli/src/subagent/get-agents.ts @@ -3,7 +3,7 @@ import { services } from "../services/index.js"; /** * Get an agent by name */ -export function getAgent(name: string) { +export function getSubagent(name: string) { return ( services.model .getSubagentModels() @@ -23,18 +23,14 @@ export function generateSubagentToolDescription(): string { ) .join("\n"); - return `Launch a specialized subagent to handle complex, multi-step tasks autonomously. + // todo: refine this prompt later + return `Launch a specialized subagent to handle a specific task. -Available agent types: +Here are the available subagents: ${agentList} - -When to use this tool: -- Complex research tasks requiring multiple file reads and searches -- Multi-step implementation tasks -- Tasks that benefit from autonomous execution -- When you need to parallelize independent work - -When NOT to use this tool: -- Tasks you can complete directly with available tools -- Trivial operations that don't require multiple steps`; +`; +} + +export function getAgentNames(): string[] { + return services.model.getSubagentModels().map((model) => model.model.name); } diff --git a/extensions/cli/src/tools/subagent.ts b/extensions/cli/src/tools/subagent.ts index 5b0a7f641..29a44c549 100644 --- a/extensions/cli/src/tools/subagent.ts +++ b/extensions/cli/src/tools/subagent.ts @@ -1,7 +1,8 @@ import { executeSubAgent } from "../subagent/executor.js"; import { generateSubagentToolDescription, - getAgent, + getSubagent, + getAgentNames as getSubagentNames, } from "../subagent/get-agents.js"; import { logger } from "../util/logger.js"; @@ -28,8 +29,9 @@ export const subagentTool: Tool = { }, subagent_name: { type: "string", - description: - "The type of specialized agent to use for this task (e.g., 'general')", + description: `The type of specialized agent to use for this task. Available agents: ${getSubagentNames().join( + ", ", + )}`, }, }, }, @@ -37,7 +39,7 @@ export const subagentTool: Tool = { preprocess: async (args) => { const { description, subagent_name } = args; - const agent = getAgent(subagent_name); + const agent = getSubagent(subagent_name); if (!agent) { throw new Error( `Unknown agent type: ${subagent_name}. Available agents: general`, @@ -61,7 +63,7 @@ export const subagentTool: Tool = { logger.debug("subagent args", { args, context }); // Get agent configuration - const agent = getAgent(subagent_name); + const agent = getSubagent(subagent_name); if (!agent) { throw new Error(`Unknown agent type: ${subagent_name}`); } diff --git a/packages/config-yaml/src/schemas/models.ts b/packages/config-yaml/src/schemas/models.ts index 9f5a9e96e..cefbd93fa 100644 --- a/packages/config-yaml/src/schemas/models.ts +++ b/packages/config-yaml/src/schemas/models.ts @@ -28,6 +28,7 @@ export const modelRolesSchema = z.enum([ "edit", "apply", "summarize", + "subagent", ]); export type ModelRole = z.infer;