Description
TestSavant.AI for n8n
An n8n community node that runs TestSavant.AI Guard safety checks on prompts or model outputs. Use it to detect policy violations (e.g., harmful content) and gate your AI workflows.
- npm:
@testsavant/n8n-nodes-testsavant - Repo: https://github.com/TestSavantAI/n8n-nodes-testsavant
- Docs: https://docs.testsavant.ai
- n8n ( self‑hosted or desktop )
- A TestSavant API key ( get one from your TestSavant account at https://app.testsavant.ai )
- In n8n UI: Settings → Community Nodes → Install → enter:
Requirements
Install
@testsavant/n8n-nodes-testsavant
npm install @testsavant/n8n-nodes-testsavant
Set up credentials
1. In n8n, go to Settings → Credentials → New.
2. Search for “TestSavant.AI API”.
3. Fill in:
– API Key: your TestSavant API key.
4. Save the credential.
Get your API key (app.testsavant.ai)
1. Sign in at https://app.testsavant.ai
2. Open your account or workspace settings and go to “API Keys”.
3. Create a new key → give it a name → copy the key value.
4. Paste the key into the “TestSavant.AI API” credential in n8n.
Notes:
#### Create an API Key
Create or manage Projects
1. In the TestSavant app, go to “Projects”.
2. Click “New Project”, provide a name and optional description, and save.
3. Your node’s “Project” dropdown will list your projects after you select credentials.
4. Select the project you want to use for guardrailing (its policies/config apply to scans).
#### Use API Key in n8n
Credentials are stored securely by n8n.
Use the node
1. Add “TestSavant.AI” to your workflow.
2. Connect it after a node that produces the text you want to check (e.g., an LLM node).
3. Configure fields:
– Prompt / Output: strings to validate (you can map from previous node output, e.g. {{$json.data}}).
– Scan Type: Input or Output.
– Project: optional. Pick one to auto-apply its scanners, or choose “— No Project —” to manage scanners manually.
– Scanners: loads every scanner available to your account. Selecting a project automatically pre-selects its active scanners, and you can add more from the full list.
4. Run the workflow.
The node processes one item per incoming item, so it fits naturally in n8n pipelines.
Input/Output
– Expects an item with a string field you map to “Text”.
– Two outputs: the first is “valid”, the second is “not valid”.
– Each output item contains safety evaluation details:
[
{
"valid": true,
"prompt": "test message",
"output": "",
"result": {
"sanitized_prompt": "test message",
"is_valid": true,
"scanners": {
"PromptInjection:base": -1,
},
"validity": {
"PromptInjection:base": true,
}
}
}
]
– Inspect the node’s output panel in n8n to see the exact structure.
Common patterns
– LLM node → TestSavant.AI → If node (check testsavant.decision !== "allow") → handle violations.
– Webhook → TestSavant.AI (Mode: Prompt) → proceed or reject.
What is guardrailing?
Guardrailing evaluates prompts and/or model outputs to detect policy violations and risky behavior before results are used or returned. Typical checks include:
With a selected Project, the node applies your project’s policies and thresholds and returns a decision and per‑scanner details. Use the decision to allow, block, or route for human review.
Error handling
Development
npm run build
npm run deploy
npm run lint
npm run format
Support
License
MIT