andy-stack_vaultkeeper-ai/AIClasses/FunctionDefinitions/Functions/CompletePlan.ts
Andrew Beal fbb2d8275d feat: add CompletePlan function to explicitly mark plan execution as complete
Add new CompletePlan function with schema and validation to allow agents to explicitly signal when all execution steps are done. Update system prompt to include completion confirmation step. Refactor execution loop to recursively prompt for completion if incomplete, with MAX_EXECUTION_DEPTH limit replacing MAX_PLANNING_ITERATIONS. Remove automatic incomplete execution handling in favor of explicit agent-driven completion.
2026-01-04 22:47:22 +00:00

31 lines
No EOL
1.1 KiB
TypeScript

import { AIFunction } from "Enums/AIFunction";
import type { IAIFunctionDefinition } from "../IAIFunctionDefinition";
export const CompletePlan: IAIFunctionDefinition = {
name: AIFunction.CompletePlan,
description: `Marks the current execution plan as fully completed.
Use this function when all steps in the plan have been successfully executed and
the original goal has been achieved.
Call this function:
- After the final step in the plan has been completed successfully
- When all plan objectives have been fully satisfied
- Before providing the user with a completion summary
Do NOT use this function:
- While there are still pending steps to execute
- If any critical steps failed or were skipped
- If the plan was modified and needs replanning`,
parameters: {
type: "object",
properties: {
confirm_completion: {
type: "boolean",
description: "Safety flag that must be explicitly set to true to confirm the completion is intentional. This prevents accidental plan completions.",
default: false
}
},
required: ["confirm_completion"]
}
}