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.
Tool Summary
Section titled “Tool Summary”| Tool | Action | Permission |
|---|---|---|
get_plan_template_details | Full details for a single template | PlanTemplate:Instance:View |
create_plan_template | Create a new template | PlanTemplate:Collection:Create |
update_plan_template | Update an existing template | PlanTemplate:Instance:Update |
get_plan_template_actions | List all assignable actions | PlanTemplate: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.
get_plan_template_details
Section titled “get_plan_template_details”Returns the full configuration for a single plan template, including assigned actions and sender phone number.
Parameters:
{ id: string // Plan template UUID}Response includes:
| Field | Type | Description |
|---|---|---|
id | UUID | Template ID |
deep_link | string | In-app link to the template |
name | string | Template name |
description | string | What the template does |
trigger | string | Trigger type (e.g. "post_call", "inbound_sms", "manual") |
auto_approve | boolean | Plans start executing without manual review |
autopilot | boolean | Actions execute without per-action approval |
is_active | boolean | Whether the template is enabled |
re_enrollment_policy | string | "once" or "multiple" |
start_condition | string? | Free-text trigger condition |
sender_phone_number | object? | { id, number, friendly_name } |
model_override | string? | AI model override for plan execution |
actions | array | [{ id, name, description }] — assigned actions |
created_at | string | Org-local timestamp |
updated_at | string | Org-local timestamp |
create_plan_template
Section titled “create_plan_template”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.
update_plan_template
Section titled “update_plan_template”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.
get_plan_template_actions
Section titled “get_plan_template_actions”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.
Typical Flow
Section titled “Typical Flow”The assistant follows this pattern when a user asks to set up a plan template:
get_plan_template_actions— discover available actions and their IDscreate_plan_templatewithconfirmed: false— preview (pass the phone number directly, e.g."+15551234567")- User confirms →
create_plan_templatewithconfirmed: true— create it
For updates:
get_plan_template_details— load current configurationupdate_plan_templatewithconfirmed: false— preview changes- User confirms →
update_plan_templatewithconfirmed: true— apply
Key Files
Section titled “Key Files”| Path | Purpose |
|---|---|
src/mods/assistant/tools/workflow/ai_get_plan_template_details_tool.rs | Detail view handler |
src/mods/assistant/tools/workflow/ai_create_plan_template_tool.rs | Create handler with preview |
src/mods/assistant/tools/workflow/ai_update_plan_template_tool.rs | Update handler with preview |
src/mods/assistant/tools/workflow/ai_get_plan_template_actions_tool.rs | Action discovery handler |
src/mods/assistant/services/tool_registry_service.rs | Permission-gated registration |
Related Pages
Section titled “Related Pages”- Expanded Tool Suite — all 50+ assistant tools
- Write Actions — two-step confirmation pattern
- Tool Permissions — permission model
- Plan Module — plan template data model and lifecycle