Testing Google Cloud Model Armor with promptfoo before you rely on it
promptfoo's documented Model Armor guide tests Google Cloud Model Armor templates and floor settings against attacks and legitimate prompts before deployment, starting from Vertex AI prompt-side blocks. That gives a team that has already enabled Model Armor a way to produce evidence in both directions: whether the configuration stops the prompts it should stop, and whether it lets through the ordinary requests your users send every day. Enabling a template is not the same as proving it works for your application, and a floor setting that is too strict can quietly block a customer workflow long before anyone files a ticket.
The method is straightforward at a high level. You define the attack prompts and benign prompts that matter to your application, point promptfoo at the Model Armor configuration under test, and run the suite from the promptfoo CLI on your own machine. promptfoo's documentation describes the software as running locally, with evaluations talking directly to the model or service under test. Before you build the suite, confirm the connector details, authentication method and which Vertex AI or sanitization API path your environment uses against the guide itself and your Google Cloud project settings, since those details are outside what this summary covers.
Before the first run, decide who owns the template and floor setting decisions and who signs off on the results. The security team usually cares most about the missed attacks, while the product owner cares about the wrongly blocked requests, so agree on both sets of results in advance. Plan to rerun the same suite after any change to the template, floor settings or the application prompts, so the evidence you show a reviewer matches the configuration that actually goes live.
What you need before the first Model Armor test run
Most failed first runs trace back to a missing install, a permission gap or a template that was not the one under test. These cards cover what to have ready on the machine running promptfoo and in the Google Cloud project before any test starts. Confirm each item against the sources named here before you begin.
promptfoo on Node.js 22.22.0
Install promptfoo from npm on a machine that runs Node.js 22.22.0 or newer. The 0.124.1 release, published on 8 October 2026, sets this as its minimum runtime, so an older Node.js on a build agent will fail before the first eval. Record the promptfoo version you test with, because Model Armor test results should be reproducible when the tool is upgraded.
promptfoo on npmModel Armor and Vertex AI access
Confirm that the Google Cloud project has Model Armor and Vertex AI available in the region where your model endpoint runs. Check the current API enablement list and the region support in Google Cloud documentation, since both change over time. Ask the platform team who owns the project, because billing, quotas and enablement decisions often sit with them rather than the security team running the tests.
The template or floor setting under test
Name the exact Model Armor template and any floor settings you are evaluating before writing test configs, and record its version or last-changed time. A test run against a template that someone edited the same day tells you little about the template you plan to ship. Keep one template per run, and treat a change to its filters as a new test baseline.
Service account permissions
Create a dedicated service account for promptfoo rather than reusing a developer's credentials or a broad project owner role. Grant only the Model Armor and Vertex AI roles needed to call the templates and models under test, and confirm the exact role names in Google Cloud IAM documentation. Store its key or workload identity configuration in your secrets system, not in the promptfoo config file.
Network access from the test machine
The machine running promptfoo must reach Google Cloud API endpoints over the network path your policy allows, which may include an egress proxy, a private endpoint or a VPN. Test connectivity with a single request before a full suite, so a blocked firewall rule is not mistaken for a guardrail miss. promptfoo runs locally and talks directly to the LLM, so the test host is where these rules apply.
A written plan for the test data
Decide which attack prompts and benign prompts you will use before the first run, and who signs off on them. Without a fixed set of benign requests, a template can look strong only because it blocks everything. Keep the datasets under version control so a later change to the template can be compared against the same inputs.
How to configure promptfoo for Model Armor templates and floor settings
This sequence takes a Model Armor template from creation to a first promptfoo baseline, so you know which settings block attacks and which block legitimate prompts before anything reaches users.
Confirm the Model Armor scope and project
Your cloud or security team confirms the Google Cloud project, the region where Model Armor is enabled, and the Vertex AI model the application calls. Someone with permission to manage Model Armor in that project should be named as the owner of the template. Done when the team can list the project's Model Armor resources from the console or CLI and sees no template conflicts with existing configuration. Confirm the exact enablement and IAM roles against Google's current Model Armor documentation, since these details change.
Create or select the Model Armor template
Create a new template, or pick an existing one, with the filters and confidence levels your use case needs, then decide which floor settings apply at project, folder or organization level. Record the full template resource name exactly as Google issues it, because promptfoo will reference that name. Done when the template name resolves in the console and the floor settings that will apply to your traffic are written down. Ask your platform team which floor settings already exist, since they can override a template you create.
Choose the Vertex AI prompt-side or sanitization API path
Decide whether Model Armor screens prompts as part of the Vertex AI model call (the prompt-side block path) or through the sanitization API called directly for the input text. The choice depends on whether your application already calls Vertex AI and whether you need to test the floor settings as they apply to model traffic. Document the decision and the reason, since the two paths can return different signals and your results must be read against the path you chose. Done when the team agrees on one path for the baseline and a second path is noted for later comparison.
Write the promptfoo provider and target configuration
In your promptfoo configuration file, define the provider that calls your target with the chosen path, referencing the template name and the Google Cloud project and region through environment variables rather than hardcoded values. Keep credentials in the environment or your secrets store. Done when running a single prompt through the provider returns a response, and the output indicates whether Model Armor screened the request. If the response carries no guardrail metadata, stop and fix the provider before adding tests, because every later result depends on that signal.
Add attack and benign test sets
Create two datasets: one of adversarial prompts (such as injection and jailbreak attempts relevant to your application) and one of legitimate prompts that reflect real user requests. Assert that attack prompts are blocked and benign prompts are not blocked, and label each case so false positives and missed attacks are reported separately. Keep the benign set representative, since a template tuned only on attacks will look strong and still block customers. Done when both sets load in promptfoo and each case has a clear expected outcome.
Run the first baseline and check the signals
Run the full configuration once against the template with the current floor settings and save the results as the baseline. Check that a benign prompt passes, that a known attack is flagged, and that errors (such as authentication failures or a missing template) are counted apart from passes and blocks. Done when the run output shows at least one expected block and one expected pass, and error counts are zero or explained. If the known attack passes through, review the template filters and floor settings before tuning anything else.
Choosing between Vertex AI prompt blocks and the sanitization API
Testing through Vertex AI prompt-side blocks exercises Model Armor as the model platform applies it to prompts sent to a Gemini model on Vertex AI. The signal is whether the request was blocked by the template and floor settings that apply to that model call, which is the decision your application actually receives for a prompt. This path is the natural starting point because promptfoo's Model Armor guide begins here, so the attack and benign datasets run against the same behavior your users will hit.
- Coverage: Prompt-side screening on the model call, including the floor settings that apply to every request in the project or resource.
- Signal: A block or pass for the prompt, which maps to a guardrail flag in promptfoo's results.
- Limit: Output screening and any checks your application runs before or after the model call are outside this path unless you test them separately.
- Confirm: The project, location and template names used in production, and whether the floor settings you test are the ones applied to production traffic.
- Confirm: Which Google Cloud APIs, roles and quotas your test identity needs, and whether the blocks you see in a test project match production settings.
Before choosing this path, confirm with your platform team that the test project mirrors the production template and floor configuration, not just a similar one.
Testing through the Model Armor sanitization API calls the screening service directly on a prompt or response, without a model call in the loop. The signal is the sanitization result for the text you submit, which lets you measure the filter in isolation and separate its decisions from the behavior of any particular model. This suits a team that wants to tune a template against large attack and benign sets without paying for or waiting on model responses.
- Coverage: The filter decision on the text you submit, independent of the model that would receive it.
- Signal: The filter result for the submitted text, which may differ in shape from the block reason a model call returns.
- Limit: It does not show what the application does with a pass, such as how it builds prompts, handles retrieved documents or responds to a block.
- Confirm: Which screening calls your application makes in production, and whether it sanitizes prompts, responses or both.
- Confirm: Whether the template and settings you test through the API match the ones attached to the production path.
Use this path to tune thresholds and compare templates, then verify the chosen settings through the model path before release.
The two paths answer different questions, so many teams use both: the sanitization API to tune the template on large datasets, and the Vertex AI path to confirm the decision your application receives. Choosing only one leaves a gap, either in the application behavior or in the filter behavior. The right mix depends on how your application calls Model Armor and where screening is enforced.
- Application path: Map every place a prompt or response reaches Model Armor, including gateways and pre-processing services, before choosing.
- Enforcement point: Confirm whether blocks are enforced in your code, in a gateway or by the platform itself.
- Evidence: Decide which results your security reviewers will need, and record the template version and floor settings used for each run.
- Regression: Plan to rerun the same datasets after any template or floor change.
- Ownership: Name who owns the template and who approves changes to it.
Before committing to a path, ask your security and platform teams to document the production call sites and the template settings, so the tests reflect what is actually deployed.
How Model Armor filter results map to promptfoo assertions
This table maps each Model Armor outcome to the promptfoo assertion and test-case label you would use for it, separately for attack and benign cases. Read it as a starting point: the exact response fields depend on whether you test through Vertex AI prompt-side blocks or the sanitization API, so confirm them in your own environment before you write assertions. The main takeaway is that a blocked attack and a blocked benign prompt are both blocks, but only the first is a pass.
| Model Armor outcome | promptfoo assertion or label | How to read it |
|---|---|---|
| Prompt blocked, attack case | Test labeled attack; guardrail-style assertion expecting a block | Pass. The template caught a known attack from your red team or attack dataset. |
| Prompt passed, attack case | Test labeled attack; assertion expecting no block | Missed attack. Record it as a failure and review the template filter and floor settings for that category. |
| Prompt blocked, benign case | Test labeled benign; assertion expecting no block | False positive. A legitimate user request was stopped, so count it separately from missed attacks. |
| Prompt passed, benign case | Test labeled benign; assertion expecting no block | Pass. The legitimate prompt reached the model unfiltered. |
| Filter match by category (for example, a specific filter type) | Metadata or result check on the category field, labeled by attack category | Shows which filter fired. Use it to tell whether a block came from the intended filter or an unrelated one. |
| Sanitization API response versus Vertex AI prompt block | Different response fields; assertion written per integration path | The mapping changes with the path. Confirm the field names and blocking flags in your own environment before reusing assertions. |
| Error or unavailable response | Recorded as an error, not as a pass or block | Keep infrastructure errors out of both pass and fail counts so they do not distort detection or false-positive rates. |
How to tune floor settings without trading missed attacks for false positives
Floor settings and template thresholds set the minimum filtering baseline that Model Armor applies to every prompt routed through a template, so they are the first lever to test when a deployment either lets attacks through or blocks legitimate users. Tightening a floor or raising a confidence threshold usually catches more attacks but also wrongly blocks benign prompts that happen to share vocabulary with attacks, such as security questions, customer complaints about fraud or code snippets. Loosening the same settings does the reverse: fewer benign users are blocked, and more missed attacks reach the model. Neither direction is free, so the tuning question is where the trade-off becomes acceptable for your application, not which setting looks strongest on paper.
Run the same attack set and the same benign set through each setting variant, using the same promptfoo configuration and the same provider path, so that any difference in results comes from the Model Armor settings rather than from the test harness. Record two numbers for every variant: the share of attack prompts that were not blocked (missed attacks) and the share of benign prompts that were blocked (false positives). Keep guardrail errors, such as failed API calls or timeouts, in a third column, because an error that looks like a block or a pass will distort both rates. Choose the configuration only after you can read all three numbers side by side. Confirm with Google Cloud documentation which floor settings and filter confidence levels your template version supports, and check the promptfoo Model Armor guide for the current test setup before building the variant matrix.
Security settings for the test environment
The test runner holds credentials for Google Cloud, stores attack prompts and model responses, and sends traffic to Model Armor and Vertex AI. Each card below covers one control that keeps that footprint contained. promptfoo runs locally and calls the model services directly, so your team decides where prompts, responses and keys travel.
Service account credentials
Give the test runner its own Google Cloud service account rather than a developer's personal credentials or a shared key. Store the key material in your secrets manager and inject it at runtime, so it never lands in the promptfoo config file or a repository. Check that the key is rotated on a schedule you set and that revoked keys stop working in the test project.
Least-privilege test runner
Grant the test service account only the roles needed to call the Model Armor templates and the Vertex AI prompts under test. Avoid project-wide editor or owner roles, because a compromised runner would otherwise be able to change Model Armor settings or read other workloads. Review the granted roles whenever the template set changes.
Separate test and production projects
Run guardrail tests in a dedicated Google Cloud project with its own billing, logging and template resources. Model Armor templates in the test project can then be tuned freely without touching the floor settings that protect production traffic. Confirm that test traffic cannot reach production endpoints through shared networks or shared service accounts.
Controlled attack datasets
Attack prompts and benign prompts are sensitive, because a leaked attack set shows exactly what your guardrail misses. Keep these datasets in access-controlled storage with versioning, and limit read access to the people who maintain the tests. Treat any prompt that contains real customer data as personal data and remove or mask it before it enters the suite.
Results and logs storage
Eval outputs, red team reports and raw Model Armor responses can contain the full text of blocked prompts and model replies. Write results to an encrypted location with a defined retention period and restricted access, and decide whether reports are shared outside the security team. Check which fields your logging configuration records before you share a report.
Data flow mapping
Document each path the traffic takes: from the runner to Model Armor, from the runner to Vertex AI, and from the runner to wherever results are stored. Because promptfoo talks directly to the model services, no vendor cloud sits between your runner and Google Cloud unless you add one. Use this map in your security review to show exactly where data goes.
Model Armor guideHow test prompts flow through promptfoo to Model Armor and Vertex AI
The flow starts on the team's machine or CI runner, where the promptfoo CLI loads attack and benign prompts and sends them through the chosen Model Armor path. The trust boundary sits between that runner and Google Cloud: prompts and template settings cross it, and only the guardrail result comes back. Each response is recorded as a guardrail outcome and checked by an assertion against the expected result. Check that attack prompts are blocked, benign prompts pass, and errors are logged separately from both.
Test prompts leave the runner, pass through Model Armor on Google Cloud, and return as recorded verdicts.
Common failures when testing Model Armor with promptfoo
This table lists the failures teams most often hit when running promptfoo against Model Armor, with the likely cause and the fix for each. Read it before the first run, and again when a guardrail suite reports errors instead of clean passes or blocks. The main takeaway is that many apparent guardrail results are setup errors, so track them separately from pass and fail outcomes.
| Failure | Likely cause | Fix |
|---|---|---|
| Permission denied when calling Model Armor | The service account running the test lacks the Model Armor user role or access to the Vertex AI project | Grant the test identity the Model Armor user role on the project that holds the template, then rerun a single benign prompt to confirm access |
| Template not found | The template name, project ID or location in the config does not match the template as created | Copy the full template resource name from the console or CLI, and check that the location segment matches where the template was created |
| Wrong location or region | The request goes to a location where the template does not exist, so the call fails before any filter runs | Set the location in the promptfoo provider config to match the template's region and confirm it with a one-prompt test |
| Errors counted as passes | A failed API call returns an empty or error response that a not-blocked assertion reads as allowed | Add an error check that marks the case as an error, and report errors in a separate count from passes and blocks |
| Node.js version mismatch | promptfoo release 0.124.1 requires Node.js 22.22.0 or newer, and older runtimes fail at install or startup | Check the runtime with node --version before installing, and pin the same Node.js version in local and CI environments |
| Attack set does not match enabled categories | Attack prompts target filters (such as prompt injection or harmful content) that the template has switched off, so blocks look missing | Map each attack category to a filter enabled in the template, and tag cases by category so misses can be read against the right filter |
| Floor settings differ from the test template | Tests run against a template while production uses floor settings applied at another level, so results do not describe production | Confirm which floor settings apply to the Vertex AI resource under test and record the template and floor configuration with each run |
| Benign set blocked unexpectedly | The template is set to a strict confidence level, or a benign prompt resembles an enabled category | Log the matched filter for each false positive, then adjust the template confidence level only after reviewing the examples |
Questions teams ask before testing Model Armor with promptfoo
What drives the cost of testing Model Armor with promptfoo?
The cost comes from four things: the skills on your team, the number of Model Armor templates and floor settings you need to compare, the size of your attack and benign test sets, and whether you need Enterprise features. The promptfoo Community edition is free and includes all LLM evaluation features, all model providers and integrations, and red teaming with 10k probes per month, with community support. Enterprise adds team sharing, SSO, role-based access, continuous monitoring and a centralized guardrail dashboard, and its pricing is custom. If you run the work with your own staff, your costs are mainly their time and Google Cloud usage. If you hire a partner, the quote should separate the one-time build of the test suite from any recurring retesting, and it should state which promptfoo edition the scope assumes.
Do we need promptfoo Enterprise to test Model Armor?
No. The Community edition is enough to write guardrail tests, run attack and benign sets against a Model Armor template, and produce results for review. Enterprise becomes relevant when several teams need shared results, access control through SSO, or a central dashboard for guardrail decisions across projects. Confirm the current feature list on the promptfoo pricing page before you decide, because editions and limits can change. Also note that the Community red teaming allowance is stated per month, so large or frequent scans should be sized against it.
How long does it take to get a first baseline result?
The time to a first baseline depends on how quickly you can get Google Cloud access, how many templates you are comparing, and whether your test data already exists. A first baseline usually needs one working template, a small benign set and a small attack set, run once against the Vertex AI prompt-side path. Access approvals and Model Armor template setup are often the slowest steps, so start those first. Ask any partner for a timeline in the written scope, with the assumptions it depends on, rather than relying on a general estimate.
What must our team provide before the work starts?
You need three things. First, Google Cloud access: a project with Vertex AI and Model Armor enabled, the permissions to create or edit templates and floor settings, and a service account or credentials that promptfoo can use. Second, test data: representative legitimate prompts from your application, plus a set of attack prompts that matches the risks you care about, including prompt injection and sensitive data cases. Third, a decision owner who can approve the thresholds and floor settings after reviewing the results, and who accepts the trade-off between missed attacks and wrongly blocked users. Missing the decision owner is the most common reason a baseline stalls after the tests are written.
Can our own engineers run Model Armor tests with promptfoo?
Yes, if they have working knowledge of Google Cloud IAM and Vertex AI, and they can write a promptfoo configuration with a provider and assertions. The promptfoo documentation describes the software as running locally on your machine, talking directly with the model, so an engineer can start with a small config and grow it. The harder parts are usually not the tooling: they are building balanced benign and attack datasets, deciding what counts as a correct block, and interpreting errors separately from passes. A team that has done this before can run it internally. A team that has not may want a short review of its first suite before using the results for a release decision.
What is the most common mistake when tuning Model Armor floor settings?
The most common mistake is tuning only against attack prompts and never measuring legitimate traffic. A stricter floor setting usually catches more attacks but also blocks more real requests, so the results need both kinds of test. Teams also tend to mix up API errors, timeouts and quota problems with guardrail decisions, which makes a template look better or worse than it is. Record errors as their own category, keep the attack and benign sets fixed while you compare templates, and version the datasets so a later run can be compared with an earlier one.
Does this work replace our security review or compliance assessment?
No. The tests give you measured evidence about how a Model Armor configuration blocks attacks and handles legitimate prompts, which can support a security review or a compliance readiness effort. They do not certify the system, and they do not replace an independent audit or certification body. The promptfoo red teaming documentation references frameworks such as the OWASP LLM Top 10, the NIST AI Risk Management Framework and the EU AI Act as a basis for systematic testing before deployment. Ask your compliance lead which evidence they need before you define the test plan, so the results map to the questions they will be asked.
How DeployOpen scopes and delivers Model Armor testing
DeployOpen plans and runs promptfoo-based testing of Google Cloud Model Armor templates and floor settings inside your own Google Cloud environment. The work starts with a written scope that names the templates, floor settings, attack and benign datasets, and the Vertex AI or sanitization API paths to be tested. Deliverables are documented so your security and platform teams can review and repeat the results.
How we scope
- Confirm which Model Armor templates, floor settings and Vertex AI endpoints are in the test boundary
- Agree the attack and benign datasets, and which promptfoo red team or guardrail tests will run
- Record who owns the Google Cloud project, service accounts and credentials used for testing
- Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts
How we build
- Configure promptfoo against your Model Armor setup, either through Vertex AI prompt-side blocks or the sanitization API
- Build benign and adversarial test sets that reflect the legitimate traffic your users actually send
- Separate guardrail errors and provider failures from genuine passes and blocks in every run
- Tune template and floor settings through repeated runs, recording each change and its effect on both attack and benign results
How we hand over
- Deliver the promptfoo configurations, datasets and run scripts as files in your own repository
- Document the test plan, settings tested, results by category and the trade-offs behind chosen thresholds
- Walk your security, compliance and platform teams through the findings and how to rerun the suite
- Provide a summary of what the tests do not cover, so reviewers do not read the results as an audit or certification
How we support
- Support after handover is available as a retainer covering reruns after template or floor setting changes
- Retainers can also cover updates to promptfoo and to test datasets as your application and threats change
- Ask any provider for a written quote that lists the scope, deliverables, who runs each step and recurring costs
- Confirm with Google Cloud the current Model Armor capabilities and API behavior for your region and project

