Skip to content

Commit 7e1f07d

Browse files
authored
test(Guardrail Node): Add Guardrail tests (#21388)
1 parent f9ae948 commit 7e1f07d

File tree

10 files changed

+1905
-0
lines changed

10 files changed

+1905
-0
lines changed

packages/@n8n/ai-workflow-builder.ee/evaluations/programmatic/evaluators/agent-prompt.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,29 @@ describe('evaluateAgentPrompt', () => {
196196
expect(result.violations).toHaveLength(0);
197197
});
198198

199+
it('should not check agent nodes with promptType set to guardrails', () => {
200+
const workflow = mock<SimpleWorkflow>({
201+
nodes: [
202+
{
203+
id: '1',
204+
name: 'AI Agent',
205+
type: '@n8n/n8n-nodes-langchain.agent',
206+
typeVersion: 2,
207+
position: [0, 0],
208+
parameters: {
209+
promptType: 'guardrails',
210+
text: 'This would normally trigger a violation',
211+
},
212+
},
213+
],
214+
connections: {},
215+
});
216+
217+
const result = evaluateAgentPrompt(workflow);
218+
219+
expect(result.violations).toHaveLength(0);
220+
});
221+
199222
it('should check agent nodes with promptType set to define', () => {
200223
const workflow = mock<SimpleWorkflow>({
201224
nodes: [

0 commit comments

Comments
 (0)