CW Ticket Sentiment Analyzer
Function agent guide for Builder - retrieve and cache ConnectWise ticket sentiment for reuse across agent workflows.
Reusable Ticket Sentiment and Experience Analysis Function
Overview
Section titled “Overview”CW Ticket Sentiment Analyzer is a function-style agent that retrieves and analyzes sentiment from ConnectWise ticket notes.
It accepts a list of ticket IDs, generates sentiment analysis when needed, and caches results for reuse.
This allows other agents to obtain reliable ticket sentiment quickly without regenerating analysis on every run.
Purpose
Section titled “Purpose”This function provides a reusable mechanism for:
- analyzing ticket sentiment
- summarizing technician-client interactions
- capturing customer feedback signals
- reducing repeated LLM processing through caching
It is designed to be called by other agents as part of larger workflows, not used directly by end users.
Role in the Agent Ecosystem
Section titled “Role in the Agent Ecosystem”Used by:
- reporting agents
- client health scoring agents
- service quality monitoring workflows
- operational insight pipelines
Problem it solves:
- eliminates repeated sentiment generation across multiple calling agents
- reduces compute cost and latency
- standardizes sentiment interpretation across workflows
Without this function, agents would need to individually retrieve and analyze ticket notes, increasing runtime and cost for every workflow that needs sentiment data.
Invocation and Execution
Section titled “Invocation and Execution”This function is called by another agent using a Call Agent node in Synthreo Builder.
Execution model: synchronous Trigger: agent flow logic Prerequisite: list of ConnectWise ticket IDs
The calling agent passes an array of ticket objects as the input payload. The function processes each ticket, applies caching logic, and returns the enriched array with sentiment data appended to each element.
Inputs
Section titled “Inputs”The function accepts an array of ticket objects.
Required
Section titled “Required”ticket_id(number) - the ConnectWise ticket ID to analyze
Optional
Section titled “Optional”include_internal(boolean, default: false) - include internal notes in sentiment analysis in addition to customer-visible notesforce_refresh(boolean, default: false) - bypass the cache and regenerate sentiment even if a valid cached result exists
Example Input
Section titled “Example Input”[ { "ticket_id": 123 }, { "ticket_id": 1234, "include_internal": true, "force_refresh": true }]Outputs
Section titled “Outputs”The function returns the input array with sentiment data added to each element. All original properties on each ticket object are preserved.
Added Properties
Section titled “Added Properties”"sentiment": { "sentiment": "positive | negative | neutral | unknown", "sentiment_score": -1.0, "explanation": "reason sentiment was assigned", "synopsis": "summary of ticket notes", "feedback": "customer feedback to technician"},"cached": truesentiment- overall sentiment label:positive,negative,neutral, orunknownsentiment_score- numeric score from -1.0 (most negative) to 1.0 (most positive)explanation- a brief description of why the sentiment was assignedsynopsis- a concise summary of the ticket note content and interaction historyfeedback- any feedback the customer directed toward the technician, if presentcached- indicates whether the result was retrieved from cache (true) or freshly generated (false)
Consumed by: any calling agent in the Synthreo Builder ecosystem.
Data Source
Section titled “Data Source”ConnectWise
Section titled “ConnectWise”The function retrieves:
- ticket notes (customer-visible, and internal if
include_internalis true) - last update timestamps (used for cache invalidation)
Cache keys are based on:
- ticket ID
include_internalflag
If the ticket has been updated since the cached result was stored, the cache is automatically invalidated and sentiment is regenerated.
Processing Flow
Section titled “Processing Flow”For each ticket in the input array:
- Retrieve ticket metadata and last update time from ConnectWise.
- Check cache for a matching sentiment record using the ticket ID and
include_internalflag as the cache key. - If a valid cache entry exists - return the cached result without calling the LLM.
- If no valid cache entry exists, or
force_refreshis true:- Pull ticket notes from ConnectWise.
- Generate sentiment using LLM analysis of the note content.
- Store the result in cache.
- Return the enriched ticket object with sentiment data appended.
This ensures sentiment reflects the most recent ticket state while minimizing unnecessary LLM calls.
Smart Analysis
Section titled “Smart Analysis”Sentiment analysis is generated using LLM interpretation of ticket notes.
The function extracts:
- overall sentiment (positive, negative, neutral, unknown)
- customer tone and experience throughout the ticket lifecycle
- feedback directed toward technicians, if present
- a concise synopsis of the full interaction history
The analysis accounts for tone shifts across multiple notes. For example, a ticket where the customer expresses frustration early but satisfaction at resolution will reflect that arc in the synopsis and may result in a neutral or slightly positive sentiment_score.
Usage Example
Section titled “Usage Example”A client health scoring agent needs sentiment data for five ConnectWise tickets to compute an overall client satisfaction signal. Rather than pulling and analyzing each ticket independently, the calling agent builds a ticket array and invokes the CW Ticket Sentiment Analyzer:
Input sent to the function:
[ { "ticket_id": 10001 }, { "ticket_id": 10002 }, { "ticket_id": 10003 }, { "ticket_id": 10004 }, { "ticket_id": 10005 }]Returned output (example for one ticket):
{ "ticket_id": 10001, "sentiment": { "sentiment": "negative", "sentiment_score": -0.7, "explanation": "Customer expressed frustration about repeated delays and lack of communication.", "synopsis": "Ticket opened for recurring email delivery failures. Customer escalated twice citing no updates from the technician. Resolved after DNS correction on day four.", "feedback": "Customer noted that faster communication would have reduced business impact." }, "cached": false}The calling agent then uses the sentiment_score values to compute an aggregate client satisfaction rating for the scorecard.
Rules and Safeguards
Section titled “Rules and Safeguards”- Input validation is enforced per ticket. Malformed or missing
ticket_idvalues return element-level errors without halting the entire batch. - Failures prevent cache writes for affected tickets.
- ConnectWise API timeouts are respected. If a ConnectWise request times out, the affected ticket returns an error result.
- Agent runtime limit: 2 hours.
Performance and Efficiency
Section titled “Performance and Efficiency”Efficiency features include:
- Cache reuse - previously analyzed tickets are returned immediately without LLM processing
- Cache invalidation - if a ticket has been updated since the last analysis, the cache is invalidated and sentiment is regenerated
- Optional forced refresh - the
force_refreshflag allows callers to bypass cache when fresh data is required - External request timeouts - ConnectWise requests enforce timeouts to prevent hanging runs
Batching and deduplication of ticket IDs are the responsibility of the calling agent.
Failure Behavior
Section titled “Failure Behavior”If an error occurs for a specific ticket:
- Missing data - returns an element-level error attached to that ticket object
- External dependency failure (ConnectWise API unavailable) - returns an error for affected tickets
- Malformed input - returns an error for the malformed element
The function returns the full input array with error details attached to affected elements. Successfully processed tickets in the same batch are unaffected.
Boundaries and Responsibilities
Section titled “Boundaries and Responsibilities”This Function Does Not
Section titled “This Function Does Not”- return full ticket data or ticket metadata beyond what is needed for sentiment
- validate ticket existence before processing (invalid ticket IDs return errors)
- batch or deduplicate large ticket lists
- manage workflow runtime limits for the calling agent
Calling Agents Are Responsible For
Section titled “Calling Agents Are Responsible For”- validating ticket IDs before passing them to the function
- batching requests to stay within the 2-hour runtime limit
- handling downstream logic based on the returned sentiment data
- deduplicating ticket IDs if the same ticket appears multiple times in a workflow
Implementation Context
Section titled “Implementation Context”Runtime: Synthreo Builder Services: Synthreo DCS Deployment: Synthreo Builder environment
Summary
Section titled “Summary”CW Ticket Sentiment Analyzer provides:
- reusable ticket sentiment analysis for any ConnectWise-connected workflow
- consistent customer experience insight across all calling agents
- cache-backed performance efficiency to minimize LLM processing cost
- structured outputs with score, label, explanation, synopsis, and feedback fields
It enables other agents to incorporate sentiment intelligence without repeated ticket processing, making it a core building block for client health, reporting, and service quality workflows.