Enjoyed this article? See more similar articles in ![]()
![]()
Pega Gen AI Cookbook - Recipes ![]()
![]()
series
Pega Conversational AI Agent: What Belongs in a Prompt vs. a Pega Rule
The Scenario
This article focuses on a common and growing Pega architecture pattern: a conversational AI agent built using Pega Constellation AI, Customer Service, or GenAI capabilities. These agents engage with customers or internal users to manage enquiries, complaints, and service requests.
As these solutions evolve, a key question consistently arises during design discussions:
“Should this logic be implemented in the agent’s prompt, or defined as a Pega rule?”
Making the wrong choice can lead to agents that miss validations, behave unpredictably, or lack auditability.
Scope
The term prompt here refers specifically to the instruction provided to the AI within a Pega GenAI action—the input that determines what the agent generates or communicates. This does not relate to developers using AI tools to generate Pega code, which is a separate concern.
The Core Principle: One Decision to Guide Everything
Does this requirement need to be guaranteed—executed consistently on every interaction, auditable, channel-independent, and version-controlled?
-
YES → Implement it as a Pega rule. A prompt cannot guarantee enforcement.
-
NO (it influences generated language) → Define it in the agent prompt
Pega rules are deterministic. For example, a Validate rule executes on every submission—without exception—and is fully logged.
Prompts, on the other hand, are generative. They guide how the AI produces content such as summaries, responses, or classifications. Their output is probabilistic and not enforced by the case engine.
Most common mistake
Placing validation logic such as “ensure the date is not in the past” or “email must be provided” inside prompts. These instructions do not reliably prevent case progression. Prompts cannot stop the Pega flow engine.
Validation, Mandatory Fields, and Business Logic Always belong in Pega Rules
The following must never be handled in prompts—they belong in Pega rules:
Validations
✗ Avoid in prompts
-
“Do not allow past dates”
-
“Accept only future dates”
-
“Date must be within 5 years”
✓ Configure in Validate rules
-
.Date < @today() -
.Date > @today() -
Range checks using
@addToDate()
Email and Phone Validations
✗ Avoid in prompts
-
“Check email format”
-
“Ensure phone number has 10 digits”
✓ Configure in Validate rules
-
Email: built-in Email type or
@matchesRegex() -
Phone:
@matchesRegex()with pattern
Mandatory Fields
✗ Avoid in prompts
-
“Ensure customer name is filled”
-
“Amount required when order type is Urgent”
✓ Configure in Pega
-
Always required → Required checkbox
-
Conditional → When rule
Business Logic, Routing, and Calculations
✗ Avoid in prompts
-
Routing based on conditions
-
Financial calculations (e.g., DTI)
-
Conditional UI visibility
✓ Configure in Pega
-
Routing → Decision Tables
-
Calculations → Declare Expressions
-
Visibility → When rules
Why this matters
Even when users interact through an AI agent, enforcement occurs at the Pega flow engine, not the UI. Prompts cannot block case progression—rules always can.
What Agent Prompts are meant for?
Prompts should focus purely on shaping the language and generated output of the agent.
Typical Responsibilities
-
Case summaries
-
Suggested replies
-
Next-best-action messaging
-
Classification and extraction
-
Research and Reason
Key Distinction
| Use Case | Prompt Controls | Pega Rules Control |
|---|---|---|
| Case summary | Content, format, tone | Data inputs, trigger timing |
| Suggested reply | Tone, safeguards, structure | When it appears |
| Research and Reason | Structure Output | Decisioning |
| Classification | Categories, output format | Routing execution |
| Extraction | Fields and fallback logic | Validation after ingestion |
What never belongs in Prompts
-
Validation & Mandatory fields
-
Email/phone formatting
-
Routing logic
-
Calculations
-
Business rules for determinsistic workflow
These must always be handled by Pega rules.
Best Practices for Scalability
-
Avoid duplication
Do not replicate rule logic in prompts -
Version prompts properly
Use GenAI action rules—not embedded logic -
Clear separation of roles
-
Rules govern behaviour
-
Prompts generate content
-
Summary
-
Agent prompts → control generated output
(structured responses, summaries, classifications) -
Pega rules → enforce system behaviour
(validation, routing, calculations, business rules)
Even in conversational experiences, enforcement occurs at the flow engine level, not within the prompt. Prompts guide language; rules guarantee execution.
Enjoyed this article? See more similar articles in ![]()
![]()
Pega Gen AI Cookbook - Recipes ![]()
![]()
series