Advanced Prompting
Advanced Prompting & CRAFT Engine
In AI Suite, Agents construct their system prompts using the CRAFT Framework (Context, Role, Action, Format, Target & Tone). Reusable Roles and Tones & Targets are managed centrally in the UI and can be shared across multiple agents, while CraftPromptable compiles the 5 sections into a structured markdown system prompt:
### CONTEXT:
...
### ROLE:
...
### ACTION:
...
### FORMAT:
...
### TARGET & TONE:
...
Try it in the UI:
1. Step-by-Step: Creating, Editing & Deleting a Role (/ai-suite#/roles)
A Role defines who the AI agent is (its persona and behavioral traits) and populates the ### ROLE: section of the compiled system prompt.
Creating a New Role
- In the top navigation bar, click Agents ▾ and select Roles.
- Click the blue New Role button in the top-right corner to open the Create Role modal.
- Fill in the three fields:
- Name: A short, recognizable label displayed in UI tables, agent badges, and role dropdowns (e.g.,
Claims SpecialistorSenior Copywriter). - Role (e.g. Copywriter): The actual instruction text injected into the agent's
### ROLE:prompt section (e.g.,You are a senior insurance claims handler who evaluates damaged package claims accurately and fairly.). - Characteristic (e.g. Writes clearly): A brief summary of the role's key traits displayed in the Roles overview table (e.g.,
Analytical, objective, policy-driven).
- Name: A short, recognizable label displayed in UI tables, agent badges, and role dropdowns (e.g.,
- Click Save.
Editing a Role
- On
/ai-suite#/roles, click the blue pencil icon on the right side of the role's row. - Update the Name, Role, or Characteristic in the Edit Role modal and click Save.
- Any agent linked to this role automatically inherits the updated
### ROLE:text.
Deleting a Role
- Click the red trash icon on the right side of the role's row and confirm deletion in the dialog.
- Dependency Protection: If the role is still assigned to one or more agents, the server returns a
409 Conflictand the UI opens a Cannot delete role alert listing every linked agent. Unlink or reassign the role on those agents first before deleting it.
2. Step-by-Step: Creating, Editing & Deleting a Tone & Target (/ai-suite#/tones)
A Tone & Target defines the voice, style, and target audience of the agent and populates the ### TARGET & TONE: section of the compiled system prompt.
Creating a New Tone
- In the top navigation bar, click Agents ▾ and select Tones & Targets.
- Click the blue New Tone button in the top-right corner to open the Create Tone modal.
- Fill in the fields:
- Name: A short label for dropdowns and badges (e.g.,
Empathetic Customer SupportorFormal Legal). - Tone & Target Description (e.g. Formal tone for legal team): The full instruction text injected into the agent's
### TARGET & TONE:section (e.g.,Write in a warm, empathetic, and reassuring tone aimed at retail customers experiencing delivery issues.).
- Name: A short label for dropdowns and badges (e.g.,
- Click Save.
Editing or Deleting a Tone
- Edit: Click the blue pencil icon on a tone row, modify the Name or Tone & Target Description, and click Save.
- Delete: Click the red trash icon on a tone row and confirm. If the tone is still linked to any agents, a dependency alert will list the linked items.
3. Step-by-Step: Organizing Agents with Folders (/ai-suite#/agents)
On the Agents overview page, you can organize your agents into hierarchical folders:
- Create a Folder:
- Click the New Folder button in the top-right bar.
- Enter a Folder Name in the modal and click Create (if you are currently inside a folder, the new folder is created as a subfolder).
- Navigate Folders:
- Click any folder row to open it.
- Click the
..(Up to parent folder) row or the ← Back button next to the page title to return to the parent folder.
- Move an Agent into a Folder:
- Drag & Drop: Grab an agent row by its drag handle (
⋮⋮on the left of the agent name) and drop it onto a folder row (or onto the..row to move it up to the parent folder). - Move Modal: Alternatively, click the Move to Folder (
⇄) icon in the agent's Actions column, select Root or a target folder in the Move Agent modal, and click Move.
- Drag & Drop: Grab an agent row by its drag handle (
- Rename or Delete a Folder:
- Click the pencil icon on a folder row to rename it.
- Click the red trash icon to delete a folder. (Note: A folder must be empty—containing no agents or subfolders—before it can be deleted.)
4. Step-by-Step: Creating & Editing an Agent with the CRAFT Editor
Creating a New Agent in the UI
- Navigate to Agents ▾ → Agents.
- Click the blue + New Agent button in the top-right corner.
- In the Create New Agent modal, enter the agent's Name and click Create.
- The agent is created in the current folder with a unique 8-character
sync_hash, and you are automatically redirected to the Edit Agent screen (/ai-suite#/agent/{id}/edit).
Configuring the CRAFT Prompt (/ai-suite#/agent/{id}/edit)
You can reach the CRAFT editor at any time by clicking the Edit Prompt (pencil/document) icon on /ai-suite#/agents or clicking Edit Prompt inside the system prompt card on /ai-suite#/agent/{id}.
The Edit Agent screen features a split view:
- Left Panel — CRAFT Prompt Engine:
- Agent Name: The display name of the agent.
- Structured Output (JSON): Check this box if the agent returns structured JSON data (enables using this agent inside
Enumworkflow nodes and matching JSON keys inStatementnodes). - Context (Background info, e.g., rules, facts): Enter domain rules, policies, or background knowledge (
### CONTEXT:). - Role (Who is the agent?): Select a reusable Role from the dropdown (
### ROLE:), or-- None --. - Action (What precisely should the agent do?): Describe the exact task or instructions the agent must execute (
### ACTION:). - Format (How should the answer look?): Specify output formatting requirements, such as markdown structure, length limits, or JSON fields (
### FORMAT:). - Tone & Target (Voice and audience): Select a reusable Tone from the dropdown (
### TARGET & TONE:), or-- None --.
- Right Panel — Live System Prompt Preview & Runtime Variables:
- As you edit any CRAFT field or switch Role/Tone dropdowns, the Live System Prompt Preview updates immediately to show the exact compiled markdown prompt.
- Dynamic Variables (
{{...}}): You can include placeholders like{{customer_name}}or{{node_php}}anywhere in your CRAFT sections. All detected placeholders are automatically highlighted in purple in the preview and listed at the top of the preview panel under Variables expected at runtime.
- Saving Changes:
- Click the purple Save Changes button in the top-right corner.
5. Exporting UI Agents to PHP Code & Syncing Code Agents
AI Suite supports both Database (Custom) Agents created in the UI and Imported (External) Agents backed by PHP classes in app/Ai/Agents:
- Exporting a UI Agent to PHP (
Export to Code):- Open a UI-created agent in the CRAFT editor (
/ai-suite#/agent/{id}/edit). - Click Export to Code in the top-right bar and confirm in the dialog.
- AI Suite generates
app/Ai/Agents/{StudlyName}.phpimplementingLaravel\Ai\Contracts\Agentand using theApp\Ai\Concerns\CraftPromptabletrait (context(),role(),action(),format(),target()), and converts the agent into an Imported agent.
- Open a UI-created agent in the CRAFT editor (
- Editing an Imported Agent:
When an agent has the amber Imported badge, saving changes in
/ai-suite#/agent/{id}/editupdates both the database version and writes the updated CRAFT sections directly back to the PHP class file. - Syncing Agents from Code (
Sync Agents): On/ai-suite#/agents, click the indigo Sync Agents button in the top-right bar to scanconfig('ai-suite.agent_directories')(app/Ai/Agents), import new PHP agent classes, and synchronize existing code agents (including auto-creating missing Role and Tone records).