Skip to content

Plan Template Tools

PR #633 added four workflow tools that let users manage plan templates entirely through the assistant. These cover the full CRUD lifecycle for plan templates plus action discovery.

ToolActionPermission
get_plan_template_detailsFull details for a single templatePlanTemplate:Instance:View
create_plan_templateCreate a new templatePlanTemplate:Collection:Create
update_plan_templateUpdate an existing templatePlanTemplate:Instance:Update
get_plan_template_actionsList all assignable actionsPlanTemplate:Collection:List

All tools are registered in tool_registry_service.rs behind permission gates. create_plan_template and update_plan_template follow the two-step confirmation pattern.

Returns the full configuration for a single plan template, including assigned actions and sender phone number.

Parameters:

{
id: string // Plan template UUID
}

Response includes:

FieldTypeDescription
idUUIDTemplate ID
deep_linkstringIn-app link to the template
namestringTemplate name
descriptionstringWhat the template does
triggerstringTrigger type (e.g. "post_call", "inbound_sms", "manual")
auto_approvebooleanPlans start executing without manual review
autopilotbooleanActions execute without per-action approval
is_activebooleanWhether the template is enabled
re_enrollment_policystring"once" or "multiple"
start_conditionstring?Free-text trigger condition
sender_phone_numberobject?{ id, number, friendly_name }
model_overridestring?AI model override for plan execution
actionsarray[{ id, name, description }] — assigned actions
created_atstringOrg-local timestamp
updated_atstringOrg-local timestamp

Creates a new plan template. Call with confirmed: false to preview, then confirmed: true to execute.

Parameters:

{
name: string, // Short, descriptive name
description: string, // What this template does
trigger: string, // "post_call", "inbound_sms", "manual"
sender_phone_number: string, // E.164 format (e.g. "+15551234567")
auto_approve?: boolean, // default: false
autopilot?: boolean, // default: false
is_active?: boolean, // default: true
re_enrollment_policy?: string, // "once" (default) or "multiple"
start_condition?: string, // free-text trigger condition
model_override?: string, // AI model override
action_ids?: string[], // UUIDs of actions to assign
confirmed: boolean // false = preview, true = execute
}

Preview response (confirmed: false):

{
"action": "create_plan_template",
"status": "preview",
"preview": { /* all fields, sender_phone_number_id resolved */ },
"message": "Ready to create plan template 'Post-Call Follow-up'. Call again with confirmed=true to proceed."
}

Execute response (confirmed: true):

{
"action": "create_plan_template",
"status": "created",
"template_id": "a1b2c3d4-...",
"deep_link": "/plan-templates/a1b2c3d4-...",
"message": "Plan template 'Post-Call Follow-up' created successfully."
}

The template insert and action assignments are wrapped in a database transaction — both succeed or both roll back.

Updates all fields on an existing plan template. Uses the same two-step confirmation flow. Action assignments are replaced — the tool deletes all existing assignments and inserts the new set.

Parameters:

{
id: string, // Template UUID to update
name: string, // Updated name
description: string, // Updated description
trigger: string, // Updated trigger type
sender_phone_number: string, // E.164 format (e.g. "+15551234567")
auto_approve?: boolean, // default: false
autopilot?: boolean, // default: false
is_active?: boolean, // default: true
re_enrollment_policy?: string, // "once" or "multiple"
start_condition?: string, // updated condition
model_override?: string, // updated model override
action_ids?: string[], // replaces all existing assignments
confirmed: boolean // false = preview, true = execute
}

The update tool checks permissions before resolving the phone number. This prevents unauthorized users from probing whether a phone number exists. The template update and new action assignments are wrapped in a transaction.

Returns all system-defined actions that can be assigned to plan templates. Takes no parameters.

Response:

{
"actions": [
{
"id": "uuid",
"name": "Send SMS",
"description": "Sends an SMS message to the contact"
}
],
"total": 5
}

Each action carries a prompt fragment injected into the plan executor’s system prompt, defining what the plan can do. Use this tool before creating or updating a template to discover valid action IDs.

The assistant follows this pattern when a user asks to set up a plan template:

  1. get_plan_template_actions — discover available actions and their IDs
  2. create_plan_template with confirmed: false — preview (pass the phone number directly, e.g. "+15551234567")
  3. User confirms → create_plan_template with confirmed: true — create it

For updates:

  1. get_plan_template_details — load current configuration
  2. update_plan_template with confirmed: false — preview changes
  3. User confirms → update_plan_template with confirmed: true — apply
PathPurpose
src/mods/assistant/tools/workflow/ai_get_plan_template_details_tool.rsDetail view handler
src/mods/assistant/tools/workflow/ai_create_plan_template_tool.rsCreate handler with preview
src/mods/assistant/tools/workflow/ai_update_plan_template_tool.rsUpdate handler with preview
src/mods/assistant/tools/workflow/ai_get_plan_template_actions_tool.rsAction discovery handler
src/mods/assistant/services/tool_registry_service.rsPermission-gated registration