Testing Amazon Bedrock Agents with promptfoo before release
A team that has built an agent on Amazon Bedrock Agents needs evaluations and red team runs it can repeat before each release. promptfoo's Bedrock Agents provider is the supported way to do this, and it covers setup, authentication, session management, knowledge bases and tracing options. The provider lets a promptfoo configuration address a specific agent and alias, send test prompts to it, and grade the responses with the same assertions and plugins used for other targets. Because the agent is a managed service, the test harness has to call it through the AWS APIs with credentials that have permission to invoke it, so the first decisions are which AWS account, Region and IAM principal the tests will use.
The integration does not decide on its own what is worth testing. It sends prompts and records what the agent returns, but the test cases, assertions, red team plugins and pass thresholds are still the team's to define. It also does not inspect the security of the surrounding system. Tool permissions on the action groups, the IAM role attached to the agent, the data sources behind each knowledge base and any Lambda functions the agent calls sit outside what a prompt-level test proves. Multi-turn tests depend on session handling, so the team should confirm how sessions are created, reused and ended in its configuration before trusting results from a conversation-style suite. Confirm current provider options against the promptfoo Bedrock Agents documentation, since option names change between releases.
The agent runs in the customer's AWS account, and the Bedrock service processes the requests there. promptfoo runs on a developer workstation or inside the team's CI pipeline and calls the agent over the network using the AWS credentials it is given. Test prompts, model responses and any traces returned are therefore handled in the customer's environment, but the grader used for model-based assertions may send content to a separate model, so the team should confirm which model grades each run and where it is hosted. Plan the credential source, the Region and the location of result files before the first run, and keep a separate test agent alias where possible so release-candidate tests do not share traffic with production.
What you need before connecting promptfoo to a Bedrock agent
Connecting promptfoo to an Amazon Bedrock agent depends on four layers working together: the local runtime, the promptfoo install, AWS identity and the network path to Bedrock. Check each one before writing a configuration, because a failure at any layer looks like a generic provider error.
Node.js at the required version
promptfoo release 0.124.1 requires Node.js 22.22.0 or newer, so the test runner must meet that floor before anything else. Confirm the version on the machine or CI image that will run the tests, not only on a developer laptop. An older Node.js install often produces install or runtime errors that look unrelated to the Bedrock provider.
promptfoo on npmA promptfoo installation
Install promptfoo as a CLI, as a library or in your pipeline image, and pin the version so suite results stay comparable between runs. Record the installed version next to your test results so you can reproduce a run after an upgrade. The Bedrock Agents provider ships with the package, so no separate plugin is needed once the install is verified.
promptfoo releasesAn agent and alias you can invoke
You need an agent ID and an alias ID for the agent version your users reach, both in the AWS account and region where the agent lives. Confirm that the alias points to the version you intend to test, because a suite run against a draft or an older alias will not reflect production behavior. Ask the agent owner which alias is the release candidate.
AWS credentials for the test runner
The test runner needs AWS credentials that can invoke the agent, and CI systems should receive them from a short-lived source such as a role assumed by the pipeline rather than long-lived access keys stored as variables. Keep the test identity separate from production application roles so that test traffic is visible in logs. Confirm the exact IAM permissions required for agent invocation in the promptfoo Bedrock Agents docs and in your own AWS account, rather than assuming them.
Bedrock Agents docsNetwork path to the Bedrock runtime
The machine running promptfoo must reach the Bedrock runtime endpoint for the agent's region, which can be blocked by corporate egress rules, private network policies or proxies. Test connectivity from the actual runner, including any proxy settings your pipeline uses. Confirm regional availability of Bedrock Agents and the endpoint names in the AWS documentation for your region, since support varies by region.
Trace and logging access
Testing agent actions depends on the traces the agent returns, so confirm that tracing is enabled for the alias and that the test identity is allowed to receive it. Check with the platform owner whether invocation logs for test sessions are retained and who can read them. Without this check, a suite can pass while you have no evidence of which tools or knowledge base calls ran.
How to configure the Bedrock Agents provider step by step
This sequence takes you from a clean machine to a first passing single-prompt check against an Amazon Bedrock agent, with each step closed by a result you can see. It is written for the engineer who will own the test suite and needs a working baseline before adding sessions, knowledge base checks or red team scans.
Install promptfoo on a machine you control
Install the promptfoo CLI from npm on a workstation or CI runner that meets the Node.js requirement in the release notes (Node.js 22.22.0 or newer for release 0.124.1). Run the version command to confirm the binary resolves. Evals run locally and call Bedrock directly, so no promptfoo server is needed for this step. Done when the version command prints a release number and the help output loads without errors.
Configure AWS authentication for the test runner
Set up AWS credentials for the identity that will invoke the agent, using the credential sources the Bedrock Agents provider documentation lists for your environment, such as a named profile or environment variables. Use an identity with only the permissions needed to invoke the agent alias, and confirm the region matches where the agent is deployed. Verify by running a plain AWS call that lists agents in that region with the same credentials. Done when the call returns your agent in the expected account.
Identify the agent ID and alias ID in the console
In the Amazon Bedrock console, open the agent and record its agent ID. Then open the Aliases tab and record the ID of the alias that routes to the version you want to test, since tests should target a fixed alias rather than the working draft. Confirm the alias status is prepared and that the agent has no pending changes. Done when you have both IDs written down and the alias points to the version your team expects.
Add the Bedrock Agents provider to the config
Create a promptfooconfig.yaml file and add a provider entry that uses the Bedrock Agents provider ID from the promptfoo documentation. Set the agent ID, alias ID and region using the exact configuration keys listed on the provider page, because key names are not repeated here. Keep credentials out of the file and reference the sources from step two. Done when promptfoo validate or a dry run loads the config without an error about a missing agent or alias.
Write a first test case with a known answer
Add one test to the config with a simple prompt the agent should answer from its instructions, such as a greeting or a question about a fact you have confirmed. Attach a plain assertion, for example a check that the output contains an expected phrase. Keep the first suite to a single case so any failure points at configuration rather than grading. Done when the test file parses and the case appears in the list of tests.
Run a single-prompt check and inspect the output
Run promptfoo eval against the config and open the results. Confirm that one turn returned a response from the agent, that the assertion status matches what you expect, and that the output records the alias you configured. If tracing is enabled through the options in the provider docs, confirm a trace is attached to the result, since it shows which actions and knowledge base calls ran. Done when the run completes, the response text is visible, and the trace or alias detail matches the agent you identified in step three.
Mapping agent, alias, session and knowledge base settings to promptfoo
This table maps each Amazon Bedrock Agents concept a test depends on to the promptfoo configuration element that carries it, who usually owns the value, and where to confirm the exact key name. Read it before writing a provider block, then check each key against the Bedrock Agents provider documentation for your promptfoo version. The main takeaway is that the agent and alias identifiers come from the AWS account owner, while session and trace choices belong to the team that writes the tests.
| Bedrock concept | What it controls in tests | Who owns the value | Where to confirm the key name |
|---|---|---|---|
| Agent ID | Identifies which agent receives the test prompts. Each test run calls this agent, so a wrong ID tests the wrong system. | AWS account owner, who created the agent | Bedrock Agents provider docs, provider configuration section |
| Agent alias ID | Selects the deployed version the tests reach, such as a draft or a published alias. Results only apply to the version the alias points to. | Application team, who promotes agent versions | Bedrock Agents provider docs, provider configuration section |
| AWS region | Sets the regional endpoint the agent runs in. A region mismatch fails before any prompt is sent. | AWS account owner | Bedrock Agents provider docs and AWS region settings |
| Authentication source | Supplies the credentials promptfoo uses to call the agent runtime, such as a profile, environment credentials or an assumed role. | Security team, who sets the test role and its permissions | Bedrock Agents provider docs, authentication section |
| Session handling | Keeps conversation state across turns in a multi-turn test. Without it, each turn looks like a new user and memory-based attacks cannot be tested. | Application team, who defines the conversation flows | Bedrock Agents provider docs, session management section |
| Knowledge base answers | Controls whether retrieved passages from the attached knowledge base appear in the output that graders score for grounding and leakage. | Application team, with the data owner for the knowledge base | Bedrock Agents provider docs, knowledge base section |
| Trace options | Decides whether the run returns the steps the agent took, such as action group invocations and retrieval calls, so graders can check which actions ran. | Security team, who decides what trace data may be stored | Bedrock Agents provider docs, tracing section |
| Action group permissions | Defines which tools the agent can call. Tests for excessive agency check whether a prompt can trigger actions outside this set. | AWS account owner and application team | Confirm in the agent configuration in the Bedrock console, then match names in test assertions |
Using sessions for multi-turn tests and traces to see which actions ran
Multi-turn red team attacks only work if the agent remembers what came before, so the test needs a stable session across turns. Many attacks build up over several messages: a first turn establishes a fictional role or a benign task, a second turn shifts the goal, and a third asks for the action that would have been refused if asked directly. Each of those steps depends on the agent's conversation state. In the promptfoo Bedrock Agents provider, session management is configured as part of the test setup, so the sequence of messages in one test case can reach the agent in one conversation. Confirm in the provider documentation how the session identifier is generated and carried between turns before you design multi-turn cases.
The reverse risk matters just as much. If a session is not reset between test cases, state from one attack can leak into the next. A refusal in a later case may then reflect context planted by an earlier case, and a pass may hide a failure that only appears on a fresh conversation. Give each independent test case its own session, and reserve shared sessions for cases that are meant to be sequential. Review the results for unexpected carry-over, especially when the same agent alias serves several test scenarios in one run.
Traces show which steps ran during a turn, including action group invocations and knowledge base lookups. A reviewer can use them to decide where a refusal came from: the model declined to act, a tool or action permission blocked the call, or a guardrail intervened on input or output. Those three causes call for different fixes, so an assertion that checks only the final text is not enough. Before writing assertions against trace data, confirm the trace output format for your agent version and your chosen tracing options in the promptfoo Bedrock Agents documentation, and run a few known requests to capture real trace samples. Assertions built on an unverified format break silently when the format changes.
How a promptfoo test reaches the Bedrock agent and returns a trace
The run starts in the test runner, either a developer's terminal or a CI job, where promptfoo loads the Bedrock Agents provider configuration. The provider authenticates with AWS credentials from the runner's environment and calls the agent alias inside your AWS account. The agent may invoke action group tools or query a knowledge base before it returns an answer and, when tracing is enabled, a trace of the steps it took. Check that the trace reaches promptfoo, because assertions on which actions ran depend on it. Promptfoo then applies assertions and writes results to the local output or to a shared store you choose.
Test traffic flows from the runner into the customer's AWS account and back as answers and traces.
Securing the test setup for Bedrock agents
A promptfoo test run against a Bedrock agent needs an identity that can invoke the agent, and that identity, the logs it produces and the traces it returns all carry risk. The cards below cover how to keep the test setup narrow, short-lived and separated from production data.
Use short-lived role credentials
Run promptfoo under an assumed IAM role or another short-lived credential source rather than static access keys saved in promptfooconfig.yaml. Keep long-lived keys out of config files and repositories. Confirm the exact Bedrock Agents runtime actions the role needs against current AWS documentation, and confirm how the provider reads credentials in your version of promptfoo.
Scope identity to one agent alias
Grant the test identity permission to invoke only the agent and alias under test, not every agent in the account. A test that can reach a staging alias should not also reach a production alias with the same underlying agent. Check the agent ID and alias ID in the config against the resources the role is allowed to call, so a typo cannot send traffic somewhere unintended.
Limit reachable tools and actions
Red team runs deliberately try to make an agent misuse its tools, so the identity and the agent's action groups should only expose the tools a test needs. Review which Lambda functions, APIs and knowledge bases the agent can call with the test role. Map this to OWASP ASI02 Tool Misuse and ASI03 Identity and Privilege Abuse, and keep write actions behind a separate test sandbox where possible.
OWASP agentic Top 10Keep test traffic out of production logs
Agent invocations and red team prompts will produce logs in CloudWatch, the agent's logging destinations and any gateway or proxy in the path. Route test runs to a separate log group or account, set retention on it, and label test sessions so they can be filtered out of production dashboards and alerts. Confirm which logging options apply to Bedrock Agents in your account and region.
Treat traces as sensitive data
Bedrock Agent traces can show the inputs passed to tools, retrieved knowledge base passages and the model's reasoning steps. Those fields may include customer data, internal documents or credentials that a tool received. Store promptfoo results that include traces with the same access controls as the source data, restrict who can open them, and remove or redact trace fields before sharing reports outside the test team.
Tracing options in the docsConfirm guardrail and IAM settings
Guardrails attached to the agent or its foundation model change what a red team run can observe, so record which guardrail version was active during each run. Verify IAM actions, guardrail configuration and any resource policies against AWS documentation before each test cycle, since service permissions and guardrail options change over time. Keep a dated record of these checks with the test results.
Common failures when testing Bedrock agents with promptfoo
This table lists the failures teams most often hit when pointing promptfoo at a Bedrock agent, with the likely cause, the fix and how to confirm the cause. Work through the rows in order, since credential and region problems hide the others.
| Failure | Likely cause | Fix and how to confirm |
|---|---|---|
| Authentication errors | AWS credentials are missing, expired or resolved from a different profile than the one you intended | Confirm the identity promptfoo uses with the AWS CLI in the same shell or CI job, then refresh or replace the session credentials and rerun a single test case |
| Wrong region or endpoint | The agent lives in a different Region than the one set in the provider config, so the runtime call fails or returns a not-found error | Check the Region where the agent was created in the Bedrock console, set it explicitly in the provider config and confirm with one direct invocation |
| Agent ID from another account | The agent ID was copied from a different AWS account or environment, so the caller has no access to it | Compare the account ID of your credentials with the account that owns the agent, then copy the agent ID from the console of that account |
| Alias points to a draft or old version | The alias target was not updated after changes, so tests exercise a previous version or the working draft | Open the alias in the console to see which agent version it targets, and record that version in the test run notes so results can be traced back |
| Sessions reused across unrelated tests | Multi-turn memory from an earlier case leaks into later cases, so answers depend on test order | Give each independent test case its own session ID and reserve shared sessions for steps that must follow one conversation; rerun the suite in reverse order to confirm results are stable |
| Empty responses from knowledge base questions | No knowledge base is attached to the agent, or the attached base has no synced data, so retrieval returns nothing | Confirm the knowledge base association and sync status in the agent configuration, then ask a question you know the documents answer and check that the trace shows a retrieval step |
| Missing traces | The trace option is off in the provider config, so the output contains only the final answer | Enable tracing in the provider settings, rerun one case and check that the output includes the action and retrieval steps before writing assertions that depend on them |
Questions teams ask before testing Bedrock Agents with promptfoo
What does it cost to test Bedrock Agents with promptfoo?
The promptfoo software is MIT licensed and the Community edition is free, so the main costs are the people doing the work and the AWS usage generated by test runs. Your AWS bill covers the agent invocations, model calls and any knowledge base queries each suite triggers, so it grows with the number of test cases, repeat runs and the number of agents under test. Engineering time is the larger cost in most cases. If you ask a partner for a quote, ask for the written scope to name the agents, tools, knowledge bases, environments and CI integration it covers, and ask which costs are one-time setup and which recur with each test cycle.
What drives the effort of a Bedrock Agents test project?
Effort rises with the number of things under test. The main drivers are:
- The number of agents and aliases, since each agent and alias pair needs its own configuration and test coverage.
- The number of action group tools and how much each one can change data or call external systems.
- The number of knowledge bases and how many document sources sit behind them.
- The number of environments, such as development, staging and production, and how their access differs.
- Whether results must run in CI/CD pipelines with pass-rate gates and reports.
A single agent with one knowledge base in one environment is a small job. Many agents with shared tools across several accounts takes more planning and more test data.
How long does a first working Bedrock Agents connection take?
The timeline depends mostly on access and on how quickly the team can agree the test scope. A first connection needs an AWS identity with permission to invoke the agent, the agent ID and alias ID, and a working session so multi-turn tests can run. Delays usually come from waiting for IAM permissions, confirming which alias maps to which environment, or agreeing on which knowledge base answers count as correct. Ask any partner to state the duration in the written scope, and confirm with your own AWS and security teams how long access approvals take in your organization.
What must our team provide before testing starts?
Before testing starts, your team should provide:
- AWS access in the account and region where the agent runs, with an IAM identity scoped to the test purpose.
- The agent ID and the alias IDs for each environment under test.
- Test accounts for the application users the agent serves, so authorization tests use real permission boundaries.
- Named owners who will review findings, approve fixes and decide which failures block a release.
- Access to the knowledge base sources and sample documents, so expected answers can be written and checked.
Confirm with your security team where test traffic may be sent and how the AWS credentials will be stored.
Can an in-house team set up promptfoo for Bedrock Agents alone?
Yes, an in-house team with AWS and Node.js experience can set up the promptfoo Bedrock Agents provider alone, since the software is open source and the provider documentation covers setup, authentication, session management, knowledge bases and tracing. The harder part is usually test design rather than configuration. Writing useful cases for authorization, indirect prompt injection through documents and excessive agency requires security knowledge and time to review results. A partner can help when the team lacks that skill or capacity. DeployOpen plans and implements this kind of setup and runs security testing of agents, and its scope and deliverables are agreed in writing before work starts.
Does the promptfoo Community edition cover Bedrock Agents testing?
The 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. The Bedrock Agents provider is a model provider integration, so it is part of that free set. What Community does not include is team sharing, teams-based access control, SSO, custom roles, continuous monitoring and priority support, which are Enterprise features. If several teams need to share results or enforce access rules across agents, check the Enterprise edition terms. Confirm the current feature list on the promptfoo pricing page before you decide.
How do we keep agent test traces and data under control?
Agent traces can contain user inputs, retrieved documents and tool outputs, so treat them as sensitive data. Decide which trace fields the provider stores, where the promptfoo results are written and who can read them. Promptfoo runs locally on your machine and talks directly with the model, so you control where results are kept. Use test accounts with no production data, restrict the IAM role to the agent and alias under test, and set a retention rule for results. Ask your security team to review the data handling before runs use production-like knowledge bases.
How DeployOpen scopes and delivers Bedrock agent testing
DeployOpen plans, configures and tests promptfoo against your Amazon Bedrock Agents in your own AWS accounts, with the agent, alias, session and trace settings written down before any test runs. The work ends with a documented test suite, red team results and a handover your team can run without us.
How we scope
- We confirm which agents, aliases and knowledge bases are in scope, and which AWS accounts and regions they run in.
- The written scope names the test types, such as multi-turn session tests, knowledge base answer checks and red team runs on the agent.
- Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts; ongoing support is available as a retainer.
How we build
- We set up the promptfoo Bedrock Agents provider with the authentication method your AWS security team approves.
- We build test suites that use session management for multi-turn scenarios and check which actions ran through trace output.
- We run red team scans mapped to OWASP agentic risks such as goal hijack, tool misuse and privilege abuse, then document each finding.
How we hand over
- You receive the promptfoo configuration, test cases, agent and alias mapping, and the credential setup written as a runbook.
- We deliver a findings report with reproduction steps, fixes for the agent configuration, and a retest of each fixed item.
- Your team gets a walkthrough of how to rerun the suite, read trace results and add cases when the agent changes.
How we support
- Support covers upgrades of promptfoo and the Bedrock Agents provider, with changes tested against the existing suite first.
- Continuous testing can run on a retainer, with scheduled red team runs after agent prompt, action group or knowledge base changes.
- We confirm with your team which evidence each run keeps and where results are stored in infrastructure you control.

