Instructions and Guardrails
Instructions and guardrails are the governance layer of AI Hub. Instructions shape how agents respond, adding reusable guidance for tone, brand voice, or policy to every agent in scope. Guardrails enforce safety checks on what users send to an agent and what the agent returns, blocking unsafe content regardless of how a prompt is worded. Manage both from the Agent Builder in AI Hub.
Instructions
An instruction is a reusable block of guidance that AI Hub applies to an agent at runtime. Define an instruction once, and AI Hub applies it to every agent that matches the instruction’s scope, so you enforce consistent tone, brand voice, and policy without editing each agent. An instruction states both the rule and how the agent must respond when the rule applies.
The Instructions tab lists two kinds of instruction: Liferay’s built-in system instructions, which are read-only, and the instructions you create. The system instructions take precedence and can’t be overridden by the instructions you add.
Creating an Instruction
Create an instruction and choose where it applies:
-
Click Agent Builder in the AI Hub left navigation, then select the Instructions tab.
-
Click New Instruction.
-
Enter a Title.
-
Keep the prefilled External Reference Code or set your own; it identifies the instruction to external systems.
-
Optionally, enter a Description. The description is an internal note and isn’t sent to the model.
-
In the Instruction field, enter the guidance the agent must follow. State the rule and the response you want when it applies. For example:
Do not provide financial advice. If the user asks for investment recommendations, reply that you aren't authorized to give financial advice and suggest contacting a qualified advisor. -
Set Where to Use to control where the instruction applies:
- Everywhere: apply on every surface.
- CMS: apply to requests from Liferay CMS.
- Click to Chat: apply to requests from the click-to-chat experience.
-
Optionally, use When to Use to describe the situation in which the instruction applies. Leave it blank to apply the instruction to all requests within the chosen scope.
-
Turn on Enable Instruction to make the instruction active.
-
Click Save.

The instruction appears on the Instructions tab. Use its Actions
menu to view, edit, or delete it later.
Guardrails
A guardrail is a rule that screens content as it flows to and from an agent. Unlike an instruction, which guides the model through the prompt, a guardrail enforces its checks outside the model, so it holds even when a prompt tries to talk its way around the rules. AI Hub runs guardrails through Google Cloud Model Armor.
Each guardrail is one of two types:
- Input guardrails screen the user’s message before it reaches the model, catching prompt injection, jailbreak attempts, malicious links, and sensitive data.
- Output guardrails screen the model’s response before it returns to the user, catching harmful or off-policy content.
You attach guardrails to individual agents, so each agent runs only the guardrails you assign to it.
Creating a Guardrail
Create a guardrail and choose the checks it runs:
-
Click Agent Builder in the AI Hub left navigation, then select the Guardrails tab.
-
Click New Guardrail.
-
Enter a Title, keep or change the prefilled External Reference Code, and optionally add a Description.
-
Set Guardrail Type to Input or Output. The type determines which checks are available.
-
Optionally, turn on Multilanguage Detection to screen content in languages other than English.
-
Configure the checks for the type you chose:
-
For an Input guardrail, enable any of the Detections:
- Malicious URI Filter: blocks suspicious or malicious URLs.
- Prompt Injection and Jailbreak Filter: blocks attempts to bypass safety rules or manipulate the agent.
- Sensitive Data Protection: scans for personally identifiable information (PII) and other confidential data.
-
For an Output guardrail, set a Responsible AI level for each content category: Hate Speech, Dangerous, Sexually Explicit, and Harassment. Choose None to skip a category, or Low and Above, Medium and Above, or High to set how strictly it’s enforced.
-
-
Use the Active toggle to enable or disable the guardrail.
-
Click Save.


The guardrail appears on the Guardrails tab. Use its Actions
menu to view, edit, or delete it later.
Attaching a Guardrail to an Agent
A guardrail takes effect only on the agents you attach it to. When you build or edit an agent, the agent form’s Guardrails section has an Assigned Guardrails field where you select the guardrails to apply. Attach an input guardrail, an output guardrail, or both.
For a walkthrough of building an agent, see Building a Custom Agent.