Skip to main content

GenAI Connect Rules

Pega GenAI™ Connect Rules define how Pega Platform™ interacts with large language models to generate contextual responses. Each Rule specifies the inputs that Pega Platform sends to a generative AI service and how Pega Platform makes the returned output available in a Case or workflow. With GenAI Connect Rules, you can design solutions that generate AI-driven responses, automate decision-making, and improve the user experience. 

After you create a GenAI Connect Rule, add a GenAI Connect Step to a Flow in the Case Lifecycle to invoke the Rule during Case processing. The Step sends the configured inputs to the generative AI service and makes the generated results available for use in subsequent workflow Steps.

GenAI Connect Rule structure and purpose

A GenAI Connect Rule is a Rule Type that connects a Pega application to a generative AI service. It defines:

  • The prompt or input sent to the AI model.
  • The parameters that control the model behavior, such as temperature or response length.
  • The expected response structure.
  • How the response is mapped back to the Pega Clipboard for use in the application.

These Rules act as the bridge between business logic in Pega and external or embedded AI features.

GenAI Connect Rules support a range of Case processing scenarios. Common examples include:

  • Summarizing an expense report by transforming detailed transaction data into a concise summary for approval workflows.
  • Extracting key fields from uploaded documents, such as invoices or forms, and mapping them to Case properties for downstream processing.
  • Generating customer communications, such as email responses or support summaries, based on Case context.

The response structure in a GenAI Connect rule defines how Pega processes the data returned by the LLM and maps it to Pega Clipboard. Response structures simplify response handling and take advantage of automatic data mapping. The following response structures are available in GenAI Connect rules:

  • Structured - Single: Use when the response contains a single object with defined fields, such as a customer profile or expense report.
  • Structured - List: Use when the response contains multiple records with the same fields, such as a list of products, accounts, or credit cards.
  • Unstructured: Use when the response is free-form text or a complex output that does not fit a predefined structure. In this mode.

Match the numbers to the following image to understand how data is processed with a GenAI Connect Rule:

  1. Retrieve Case data: The process begins by accessing relevant data from the Case Data Model. This data provides the context needed to generate a meaningful AI request.
  2. Build the request prompt: The GenAI Connect Rule uses selected Case data fields to construct a structured prompt. This prompt includes instructions and context that Pega Platform sends to the language model.
  3. Send a request through the AI Gateway: The prompt is passed to the AI Gateway, which acts as an intermediary. The AI Gateway prepares and routes the request to the appropriate AI model and manages communication and control.
  4. Process request in the LLM: The large language model receives the prompt, processes the input, and generates a response based on the provided instructions and data.
  5. Interpret and map results: The response is returned through the AI Gateway and interpreted by the GenAI Connect Rule. Pega Platform maps the generated output to defined properties in the Case Data Model.
  6. Update the Case data: The mapped results are written back to the Case, making the AI-generated content available for use in the workflow, for display to users or for downstream processing.
Diagram of the Case processing flow with the GenAI Connect Rule.

GenAI Connect Rule usage in Case processing

You use GenAI Connect Rules when a Case or Process needs AI-generated content as part of its Lifecycle. Instead of manually creating content or Insights, the application can dynamically generate outputs such as summaries, recommendations, or communications using an AI model. These Rules are typically invoked in a flow through a GenAI Step, where the system sends contextual data to the model and captures the response for later use in the process. AI-generated content then becomes part of Case processing.

Each GenAI Connect Rule defines how the interaction with the AI model works. The prompt configuration establishes the instructions and context that guide the response of the model, and often incorporates dynamic Case data to keep the response relevant. Model parameters influence how the model generates the response, so you can balance precision and creativity. The response schema defines a predictable structure for the output, so you can map the output into the application. Error handling supports reliability by managing incomplete or unexpected responses. These elements provide consistent and reusable AI interactions across the application.

Dynamic prompts

GenAI Connect Rules support dynamic prompt construction, so you can tailor requests based on runtime data. Instead of hardcoding instructions, you can populate prompt content by using Case data, Data Transforms, or Declare Expressions. For example, a Data Transform can assemble context-specific instructions into a property, which the GenAI Connect Rule then references. This approach improves reusability and keeps prompts flexible and context-aware without requiring changes to the Rule.

Testing and validation

Before deploying a GenAI Connect Rule, test how the model responds to different prompts and configurations. AI Designer in Pega Platform includes a playground environment where you can run GenAI Rules with various prompts and model settings. Use the playground to evaluate response quality, compare outputs across models, and refine prompt design. Prompt tuning and unit testing in the playground improve reliability and confirm that generated responses meet business expectations before you deploy to production.

Best practices when using GenAI Connect Rules

GenAI Connect Rules provide a foundation for integrating AI in a controlled and scalable way. You can reuse AI logic across Case Types, maintain consistency in how you design prompts and responses, and separate AI interaction from core business logic. This separation keeps AI features applied intentionally and aligned with business goals, and supports governance and maintainability.

To design effective solutions, follow these best practices:

  • Use clear, structured prompts so that the model produces consistent results.
  • Avoid hardcoding prompts when dynamic prompting is possible.
  • Review and validate AI-generated outputs with unit tests before using them in critical processes.
  • Avoid including sensitive or restricted data in prompts. Pega Platform provides options to mask or limit data sent in GenAI requests, which helps protect sensitive information and support responsible AI use.
  • Design Rules for reuse to promote consistency across the application.

When Solution Designers and Solution Builders combine strong design practices with a clear understanding of how GenAI Connect Rules operate, they can effectively and responsibly integrate generative AI into workflows.

Check your knowledge with the following interaction:


This Topic is available in the following Module:

If you are having problems with your training, please review the Pega Academy Support FAQs.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Academy has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice