Hi everyone,
I wanted to share an approach I recently implemented to proactively identify performance risks in Report Definitions using GenAI in Pega.
In most projects, Report Definitions are created primarily to meet functional needs, but performance considerations such as join complexity, filter usage, and data access patterns are often not evaluated during development. These issues usually surface later during testing or production.
To address this, I built a small utility-driven solution that analyzes Report Definitions and provides an LSA-style performance assessment.
Implementation Overview:
-
Fetching Report Definitions
-
Built a utility (Activity) to retrieve all instances of
Rule-Obj-Report-Definition -
Filtered based on ruleset/application context
-
Iterated through each RD for analysis
-
-
Metadata Extraction
For each Report Definition, extracted key attributes such as:-
.pyRuleName(Report Name) -
.pyClassName(Applies-To Class) -
Join count
-
Filter count
-
Associations and sub-reports
-
(Optionally) index awareness
-
-
Dynamic Input Construction
-
Constructed a structured string using Property-Set:
Report Number - X Report Name - <name> Report Class - <class> Filter Count - <n> Join Count - <n>
-
-
GenAI Integration
-
Used GenAI Connect to pass the constructed input
-
System prompt designed to behave like a Pega LSA
-
Enforced strict output format:
Risk Assessment: <LOW/MEDIUM/HIGH> | Reason: <...> | Fix: <...> -
Limited response to ~200 characters for UI readability
-
-
Evaluation Logic (via AI prompt)
The analysis is based on common performance heuristics:-
Join count > 3 → High risk
-
No filters → Full table scan risk
-
Combination of high joins + no filters → Critical
-
Consideration of overall structure and data volume
-
-
Result Persistence
-
Stored output along with RD metadata in a database table
-
Enables tracking, reporting, and future dashboarding
-
Sample Output:
Risk Assessment: HIGH RISK | Reason: No filters and high joins causing full table scan | Fix: Add indexed filters and reduce joins
Key Learnings:
-
Many RD performance issues are design-related rather than infrastructure-related
-
Simple heuristics (joins + filters) can identify a majority of risks
-
GenAI works best when:
-
input is clearly structured
-
output is tightly controlled
-
-
This approach helps bridge the gap between development and LSA-level performance thinking
Next Steps / Enhancements:
-
Introduce risk scoring (0–10 scale)
-
Build a dashboard for high-risk RDs
-
Integrate with PDC for runtime validation
-
Extend analysis to Data Pages and data access patterns
RD Risk Intelligence AI.docx (17.8 KB)
Techinical Doc- RD Risk Intelligence AI.docx (541.9 KB)