How Variables Work in Magic AI + Magic Agents
Prompts drive everything in Magic AI and Magic Agents. To make them dynamic, Triage Agent can inject live context using variables—like{{contact_name}}, {{ticket_source}}, or {{current_datetime}}.
Variables are resolved before runtime, meaning they’re replaced with real values before the prompt reaches Magic AI.
Magic AI never sees {{contact_name}}—it sees “Jane Doe”. It doesn’t see {{ticket_source}} it sees “email” or “chat”.
Write your prompts in plain, natural language. Don’t reference variable names like {{variable_name}} Magic AI never sees them and can’t reason about them.
Write Prompts in Natural Language, Not with Variable Names
You should never reference the variable name inside a prompt. Always write as if the value has already been substituted. Correct:If the contact company name is Contoso, and the request mentions SharePoint, escalate immediately.Incorrect:
If {{contact_company_name}} is Contoso, and the request mentions SharePoint, escalate…
This is important as Magic AI doesn’t interpret {{contact_company_name}} it only sees the final value, like “Contoso”. Write your prompts as if that value is already there—in clear, natural language.
Examples in Practice
Below are working examples. Notice how the logic refers to concepts like “ticket source” or “company name” in native language—not as{{variables}}.
1. After-Hours & Holiday Handling for Triage Agent
This prompt module enables the AI triage agent to identify when a ticket arrives outside of standard business hours or on recognized U.S. holidays. It dynamically generates natural, non-repetitive first responses depending on the source (email vs. chat/portal), informing clients of delay while capturing initial details for later handling. It enforces time-based gating logic before any triage or troubleshooting occurs, ensuring proper tone and SLA alignment.2. Timeout Follow-Up Behavior by Ticket Source
This rule instructs the AI triage agent to generate appropriate follow-up messages when a client becomes unresponsive, tailoring tone and language based on how the ticket was submitted. If submitted via email, the response should remain formal and professional; for live sources like chat or portal, the tone should shift to a more conversational, real-time style. The prompt ensures all messages sound natural, avoid scripted repetition, and reflect the agent’s role in seamless escalation.3. Escalation Trigger Enforcement for Sensitive Clients
A strict triage agent prompt designed to detect and immediately escalate requests from specific high-priority clients (Contoso, ACME CORP) when sensitive terms are present. This logic bypasses all troubleshooting, clarification, and standard triage. It ensures zero interaction and immediate handoff. The agent is instructed to follow this flow without deviation, emphasizing precision and compliance.
4. Triage Agent Workflow with Priority-Based Escalation
Escalation includes SLA-specific messaging based on exact ticket priority values (e.g., Priority 1 – Critical).For SLA-based responses to work correctly, the
{{priority}} value must exactly match your PSA’s priority labels (e.g., “Priority 1 - Critical”). If your PSA uses different labels (e.g., “P1”, “High”, “Critical”), you’ll either need to: Adjust the prompt to match your exact priority names and response times, or prompt your triage agent to use LIKE operators or mapped values to normalize priority labels before the prompt runs.Available Variables by Feature
Below is a reference list of all variables available across Magic AI and Magic Agent features. These values are dynamically injected into prompts before runtime, so Magic AI only sees the resolved text (e.g. “Contoso”, not{{contact_company_name}}).
Use this list to understand what context is passed into each feature’s prompt—and write as if those values are already present.
Prioritization
Auto Prioritization sends the model the ticket context below as structured background. Write your priority rules in plain language—describe the situation you want prioritized rather than typing these token names.- Contact Company Name
- Contact Type (if present)
- Ticket Summary and first note (together, as the service request)
- Ticket Chat History
- Ticket agreement
Categorization
- Ticket Chat History
{{ticket_chat}} - Ticket Summary
{{ticket_summary}} - Ticket First Note
{{first_note}} - Contact Type (if present)
{{contact_type}} - Contact Company Name
{{company_name}} - Ticket agreement
{{ticket_agreement}}
Title
- Ticket Chat History
{{ticket_chat}} - Ticket summary
{{ticket_summary}} - Ticket agreement
{{ticket_agreement}} - Current date & time
{{current_datetime}} - Contact company name
{{contact_company_name}} - Ticket Contact Name
{{contact_name}} - Ticket source
{{ticket_source}}
Recap
- Ticket Category
{{type}},{{sub_type}},{{item}} - Ticket summary
{{ticket_summary}} - Ticket Configuration array
{{ticket_configuration}} - Contact Type (ConnectWise PSA)
{{contact_type}} - Ticket Priority
{{priority}} - Ticket Status
{{status}} - Ticket Created at
{{created_at}} - Ticket System Id
{{system_id}} - Ticket Board
{{board}} - Ticket Chat History
{{chat}} - Recap Rules
{{recap_rules}} - Contact Full Name
{{contact_fullname}} - Member Full Name
{{member_fullname}} - Ticket agreement
{{ticket_agreement}}
Magic Agents
- Contact Name
{{contact_name}} - Contact Email
{{contact_email}} - Ticket Board
{{board}} - Ticket source
{{ticket_source}} - Ticket ID
{{ticket_id}} - Ticket agreement
{{ticket_agreement}} - Current Date time
{{current_datetime}} - Triage instructions
{{triage_instructions}} - Ticket Priority
{{priority}} - Contact company name
{{contact_company_name}} - Contact type (ConnectWise PSA)
{{contact_type}} - Working Hours Flag
{{working_hours_flag}}(Boolean)