Agent Assurance for your AI Deployment
Test how your agents actually behave across workflows, tools, and actions. Catch failures and vulnerabilities before they ship.
npm install -g @testmuai/rook@latest
Amazon Bedrock Agents: How to Test Them Before Release
Test Amazon Bedrock Agents before release: pin the alias, read the InvokeAgent trace, check action group calls and Lambda effects, then gate each alias in CI.
Amazon Bedrock Agents can report an action that never happened. In AWS's own BookHotel example, an agent tells a guest "Your booking is cancelled."
With tracing on, the orchestration trace shows a CancelBooking call the agent predicted and the JSON string the action group returned. Neither entry proves that the reservation system changed.
That gap between what Bedrock agents report and what they change is the testing problem, and the service around it changed this year. According to the Bedrock Agents Classic maintenance mode page, Amazon Bedrock Agents (launched November 2023) is now Amazon Bedrock Agents Classic. It has been closed to new customers since July 30, 2026, while existing agents and InvokeAgent keep working.
Teams that run these agents now test the alias they ship today and the behavior they must keep when they move to Amazon Bedrock AgentCore, and one suite can serve both.
Overview
How Do You Test an Amazon Bedrock Agent Before Release?
Test an Amazon Bedrock agent by calling a version alias through InvokeAgent with enableTrace set to true, then assert each action group call and its parameters in the orchestration trace. Read the record the Lambda function changed, such as a booking, order or ticket, because the trace alone does not prove the change.
- Bedrock Agents Classic: Amazon Bedrock Agents Classic is the new name for Amazon Bedrock Agents, in maintenance mode since July 30, 2026. Open to new customers: no. Existing agents and InvokeAgent still work: yes, with no migration deadline, but AWS plans no new features.
- Alias under test: Use Amazon Bedrock's TSTALIASID test alias, which points at the working draft, for iteration. Use a version alias for release tests, because Bedrock agent versions are immutable snapshots and a production alias can be pointed back at an earlier version.
- InvokeAgent trace: The Amazon Bedrock InvokeAgent trace carries each action group call, knowledge base lookup and observation a test asserts on. On by default: no, so set enableTrace to true. Supported in the AWS CLI: no, so tests call InvokeAgent through an AWS SDK such as Boto3.
- Action group effects: An Amazon Bedrock action group's trace entry records the call the agent predicted and the string the API returned. Proof that the record changed: no. A release test also reads the booking, order or ticket that the Lambda function changed.
- AgentCore Evaluations: Amazon Bedrock AgentCore Evaluations scores sessions, traces and tool calls, and its built-in evaluators use a model as the judge. Bedrock Agents Classic on its supported frameworks list, read on 2026-12-01: no.
- Migration baseline: An AgentCore migration baseline is the Bedrock Agents Classic suite's record of tool calls, changed records and guardrail actions per scenario. Gate every alias in CI on that suite, then replay the baseline against the AgentCore build as the acceptance test for the move.
- Agent Assurance: TestMu AI's Agent Assurance can run generated scenarios against a shipped Bedrock agent alias through InvokeAgent, using reviewable hook scripts. Needs a read-only check you give it to pass a changed record: yes. Without one, that criterion is Unable to Verify, which is not a failure.
What Are Amazon Bedrock Agents?
An Amazon Bedrock agent pairs a foundation model with action groups, knowledge bases or both, plus optional guardrails and collaborator agents. AWS's overview says agents orchestrate foundation models, data sources, applications and conversations, while Bedrock manages prompt engineering, memory, monitoring, encryption, permissions and API invocation.
- Action groups - an action group defines actions the agent can help a user perform. AWS's action group guide uses a
BookHotelgroup withCreateBooking,GetBookingandCancelBooking; fulfillment goes to a Lambda function you write, or control returns to your application in the InvokeAgent response. - Knowledge bases - an associated knowledge base supplies retrieved text that augments the agent's answers.
- Guardrails - a guardrail screens user messages and model responses to prevent unwanted behavior.
- Memory - AWS's memory guide says context stays within one session by default and, with memory enabled, the agent retains past sessions per memoryId; recall tests are in agent memory testing. The memory types and stores behind that recall are explained in the guide to AI agent memory.
- Multi-agent collaboration - a supervisor works with one or more collaborator agents, coordinating their answers (
SUPERVISOR) or routing each request to one collaborator (SUPERVISOR_ROUTER).
Action groups, knowledge bases, guardrails, collaborators and the pre- and post-processing steps each leave a trace entry; the field names below come from the service model printed in Step 2.
| Part | What it does | Where it shows up in the trace |
|---|---|---|
| Action group | Runs an action through Lambda or returns control | actionGroupInvocationInput, then the observation |
| Knowledge base | Retrieves text relevant to the request | retrievedReferences in the observation |
| Guardrail | Assesses user input and model output | guardrailTrace with its action and assessments |
| Collaborator agent | Handles a task the supervisor routes to it | callerChain and collaboratorName |
| Pre- and post-processing | Validates the input, then shapes the final response | preProcessingTrace and postProcessingTrace |
Bedrock Agents Classic and Amazon Bedrock AgentCore
AWS calls the rename a naming update, and the bedrock-agent API namespace stays the same. Only CreateAgent and InvokeInlineAgent are restricted, for accounts without prior usage; accounts with Bedrock Agents activity in the past 12 months are allowlisted.
- No deadline - there is no migration deadline and no planned end-of-life date, but the model catalog is frozen as of July 30, 2026.
- Recommended path - AWS recommends Amazon Bedrock AgentCore, a platform for building, deploying and operating agents built with any framework and model. Its harness is a managed agent loop that defines and invokes an agent with one API call.
Step 1: Pin the Bedrock Agent Alias and Version Under Test
A new agent has a working draft, the DRAFT version, and a test alias, TSTALIASID, that points at it. Per AWS's test and troubleshoot guide, every update to the draft needs a PrepareAgent call, and AWS recommends a GetAgent request to check preparedAt so you know the test runs the latest configuration.
Versions are immutable snapshots numbered from 1. A production change means a new version plus an alias pointed at it, and reverting means pointing the alias back at an earlier version.
- Iteration - run quick checks on
TSTALIASID, and fail the test whenpreparedAtis older than your last configuration change. - Release - run the full suite on a candidate alias that points at the new version, which is exactly what production will call.
- Provenance - store the
agentVersionthat every trace part carries beside each result, so a regression maps to one version.
For manual debugging, the console's test window shows the trace in real time and lets you disable action groups or knowledge bases one at a time to isolate the component behind a bad answer.
Step 2: Capture the Bedrock Agent Trace Through InvokeAgent
Automated tests call the agent with InvokeAgent. The InvokeAgent API reference says the AWS CLI does not support streaming operations in Bedrock, InvokeAgent included, so tests call it through an SDK such as Boto3 or the AWS SDK for JavaScript V3.
- enableTrace - set it to true on every test call, since Steps 3 and 4 assert on the trace.
- sessionId - 2 to 100 characters. Reusing a value continues the conversation, so give each scenario a fresh id.
Keep the raw trace events of every failed scenario, since a failing step returns its reason there; span design is covered in AI agent tracing.
InvokeAgent Trace Fields in the Botocore Service Model
Assertions should match the shapes your SDK returns, and botocore ships the bedrock-agent-runtime service model inside the package. The script below loads it and prints what InvokeAgent accepts and what its trace can carry, with no AWS call and no credentials (print helpers trimmed).
"""Print what InvokeAgent accepts and what its trace
can carry, from botocore's bundled service model.
No AWS call, no credentials."""
import botocore
import botocore.session
# line() prints one line; wrap() prints a label plus
# names, wrapped at 58 characters (helpers trimmed).
session = botocore.session.get_session()
model = session.get_service_model("bedrock-agent-runtime")
op = model.operation_model("InvokeAgent")
req = op.input_shape
line("botocore " + botocore.__version__)
line("service bedrock-agent-runtime, api "
+ model.api_version)
line("InvokeAgent " + op.http["method"])
line()
wrap("required:", sorted(req.required_members))
line("enableTrace member: %s (%s)" % (
"enableTrace" in req.members,
req.members["enableTrace"].type_name))
line("sessionState member: %s"
% ("sessionState" in req.members))
line()
events = op.output_shape.members["completion"]
wrap("stream events:", [n for n in events.members
if not n.endswith("Exception")])
part = events.members["trace"]
wrap("TracePart:", list(part.members))
trace = part.members["trace"]
line()
line("trace types (%d):" % len(trace.members))
for name, shape in trace.members.items():
line(" " + name)
wrap(" ->", list(shape.members))
orch = trace.members["orchestrationTrace"]
inv = orch.members["invocationInput"]
obs = orch.members["observation"]
line()
wrap("invocationType:", inv.members["invocationType"].enum)
wrap("observation type:", obs.members["type"].enum)
ag = inv.members["actionGroupInvocationInput"]
wrap("action group input:", list(ag.members))
kb = obs.members["knowledgeBaseLookupOutput"]
wrap("KB lookup output:", list(kb.members))
g = trace.members["guardrailTrace"]
wrap("guardrail action:", g.members["action"].enum)A run on 2026-12-01, in a virtual environment with boto3 1.44.16 and botocore 1.44.16, printed:
botocore 1.44.16
service bedrock-agent-runtime, api 2023-07-26
InvokeAgent POST
required: agentAliasId agentId sessionId
enableTrace member: True (boolean)
sessionState member: True
stream events: chunk files returnControl trace
TracePart: agentAliasId agentId agentVersion callerChain
collaboratorName eventTime sessionId trace
trace types (7):
customOrchestrationTrace
-> event traceId
failureTrace
-> failureCode failureReason metadata traceId
guardrailTrace
-> action inputAssessments metadata outputAssessments
traceId
orchestrationTrace
-> invocationInput modelInvocationInput
modelInvocationOutput observation rationale
postProcessingTrace
-> modelInvocationInput modelInvocationOutput
preProcessingTrace
-> modelInvocationInput modelInvocationOutput
routingClassifierTrace
-> invocationInput modelInvocationInput
modelInvocationOutput observation
invocationType: ACTION_GROUP KNOWLEDGE_BASE FINISH
ACTION_GROUP_CODE_INTERPRETER AGENT_COLLABORATOR
observation type: ACTION_GROUP AGENT_COLLABORATOR
KNOWLEDGE_BASE FINISH ASK_USER REPROMPT
action group input: actionGroupName apiPath executionType
function invocationId parameters requestBody verb
KB lookup output: metadata retrievedReferences
guardrail action: INTERVENED NONE- Required members - only
agentAliasId,agentIdandsessionId.enableTraceis an optional boolean, so a test client that omits it gets answers with no trace. - Seven trace types - the same seven as AWS's trace guide. The orchestration trace holds the call (
invocationInput), its result (observation) and the model'srationale. - Enums a parser must accept -
invocationTypeincludesACTION_GROUP_CODE_INTERPRETER, which the trace guide's JSON example omits, and observation types includeASK_USERandREPROMPTbesides the action group, collaborator, knowledge base and finish values.
Step 3: Assert Action Group Calls, Then Their Effects
The action group entry is the agent's tool calling step. AWS's trace guide defines actionGroupName as the action group the agent predicts should be invoked, apiPath as the operation from the API schema, and executionType as LAMBDA or RETURN_CONTROL.
- Call - assert the group name and the
functionorapiPathplusverb, and that no write ran twice. - Arguments - compare each value in
parametersorrequestBodywith the request, such as the booking id the guest named. - Returned text -
actionGroupInvocationOutputholds the JSON string the operation returned, which is the Lambda function's own claim. - Record - after the run, read the staging reservation system: the named booking is cancelled and every other booking is unchanged.
Only the record check catches a Lambda function that reports success before its write commits, or one that cancels a different booking from the id it was passed. Point it at staging systems, because the Lambda functions behind a test alias write for real.
Testing Orchestration With Return Control
An action group set to return control skips the Lambda function: the InvokeAgent response carries the predicted action and its parameters in returnControl. Your test sends a fixed result back in the next request's sessionState: the same invocationId plus returnControlInvocationResults holding a functionResult or apiResult with its responseBody. The agent continues from that result.
Script a success, a not-found error and a timeout message, and assert how the agent handles each. Execution type is set per action group. If the version you ship uses Lambda, run these scripted-result tests on a draft or test version switched to return control, and keep one Lambda-path run on the shipped version.
Testing User Confirmation on Write Actions
AWS's user confirmation page warns that data from an API or knowledge base can carry instructions, and that the agent will comply with one that invokes an unintended action. That is prompt injection through tool output, and AWS's safeguard is a confirmation step before the function runs.
Turn it on with requireConfirmation set to ENABLED on the function. Your test then answers with confirmationState set to CONFIRM or DENY in the result it sends through returnControlInvocationResults.
- CONFIRM - the function runs; assert the record changed once.
- DENY - the function must not run; assert the record is unchanged after the turn.
- Planted instruction - put an instruction to cancel a booking inside a staging knowledge base document, then assert a confirmation request appears before any write.
Step 4: Check Knowledge Base, Guardrail and Collaborator Steps
Each remaining part has an API you can test alone and a trace entry you can test in context. Testing both shows whether a bad answer came from the component or from how the agent used it.
Bedrock Knowledge Base Retrieval Checks
A knowledge base gives the agent RAG, and the Retrieve API queries it without the agent, taking a required knowledgeBaseId and retrievalQuery. Keep a set of questions with the document each should return, and fail the test when it drops out of the results.
In the agent trace, check the query the agent wrote for the lookup and the retrievedReferences, which carry the retrieved text with the Amazon S3 location of its source. When Retrieve finds the document but the agent's query misses it, fix the agent's instructions before the index. Retrieval metrics are covered in RAG testing.
Bedrock Guardrail Intervention Checks
Test the guardrail alone first. The ApplyGuardrail API assesses text against a configured guardrail without invoking a foundation model, with source set to INPUT or OUTPUT, so a table of blocked and allowed inputs runs without the agent. Choosing the policies themselves is covered in AI guardrails.
Then assert that the agent trace shows the guardrail firing on the same input, and watch the enum. The GuardrailTrace API reference and the botocore model give the agent trace's action as INTERVENED or NONE, while the trace guide's JSON example and the ApplyGuardrail response show GUARDRAIL_INTERVENED.
An equality check on the wrong string never passes, and a negated one passes even when the guardrail never fired, so code each check against the shape its own API returns.
Testing Supervisor and Collaborator Routing in Bedrock
A supervisor is associated with each collaborator's alias, so re-pointing a collaborator alias at a new version changes the supervisor's behavior with no supervisor change. Record collaborator versions with each result, and rerun the supervisor suite when one moves.
- Route - assert
collaboratorNameand theAGENT_COLLABORATORcalls against the collaborator each scenario should reach; in router mode, the routing classifier trace records the decision. - Chain -
callerChainholds the alias ARN of every agent that forwarded the request, which lets a test assert the whole path.
Handoff failures beyond Bedrock, such as loops and dropped context, are covered in multi-agent testing.
Step 5: Gate Bedrock Agent Aliases in CI and Keep a Migration Baseline
In CI, call PrepareAgent on the draft, then CreateAgentAlias for a candidate alias. The bedrock-agent service model in botocore 1.44.16 has no separate CreateAgentVersion call, so the new version comes from that alias step; run the suite against the candidate alias. Re-point the production alias only when the suite passes, and keep the previous version, because pointing the alias back is AWS's documented rollback.
Store one row per scenario: alias, agent version, action group calls with arguments, changed records, guardrail actions and the collaborator chain. That file is also your migration baseline. The maintenance mode page estimates hours of CLI import or harness setup for a straightforward agent, and more significant code work for custom orchestrators or multi-agent collaboration.
- Prompt overrides - AWS says stage-specific prompt overrides are not directly replicated, so scenarios that relied on them need a fresh pass.
- Supervisors - AWS rates multi-agent parity as limited: the supervisor pattern is possible by exposing agents as MCP tools, one of the AI agent protocols. Each collaborator handoff then becomes a tool call the baseline must record. AWS adds that routing mode is not straightforward today.
- Comparison - replay the baseline scenarios against the AgentCore build and diff the tool sequences and changed records; answer wording will differ.
What Does AgentCore Evaluations Score?
AgentCore Evaluations scores agent traces, and its built-in evaluators use a model as the judge. AWS's general availability announcement of March 31, 2026 lists 13 built-in evaluators for response quality, safety, task completion and tool usage, run online on sampled live traces or on demand for regression testing in CI/CD.
- Levels - built-in templates score at session level (goal success rate), trace level (correctness, faithfulness, helpfulness and others) and tool level (tool selection and tool parameter accuracy); see AI agent evaluation metrics.
- Judge - traces are scored with LLM-as-a-judge techniques, and a built-in tool-level evaluator reads the tool call from the trace; the system that call changed is outside what it sees.
The supported frameworks page, read on 2026-12-01, lists Strands Agents, LangGraph, OpenAI Agents, Vercel AI SDK, LlamaIndex, Google ADK and Claude Agent SDK, with no row for Bedrock Agents Classic. Its generic support excludes AWS SDK (botocore) instrumentation, so calling a Classic agent through Boto3 does not produce spans it scores.
For a Classic agent, the evaluator helps after the move, or once your test code emits its own OpenTelemetry generative AI or OpenInference spans to Amazon CloudWatch. If the AgentCore build is code-defined with Strands, Strands Agents testing covers the unit layer under it.
Testing the Shipped Alias Through InvokeAgent With Agent Assurance
Steps 2 to 5 run cases your team wrote. A release decision also needs scenarios nobody wrote by hand, functional and adversarial, run against the shipped alias and judged on the records they changed. TestMu AI's Agent Assurance covers that step for agents that act through tools, files and APIs, before release only; screening production traffic stays with the Bedrock guardrail.
Most eval and observability tools score what your agent said and recorded. Agent Assurance checks what the run changed, and reports what it could not verify. In the BookHotel case, that is the reservation record, which neither the trace nor a tool-level judge reads.
Bedrock is not a named integration. What applies is the documented profile pattern: an agent reachable through an API is invoked by reviewable Node.js hook scripts, and InvokeAgent is callable from the AWS SDK for JavaScript V3. The mapping below applies the profiles and hooks guide to a Bedrock alias; it is not a recorded run.
- prepare - runs once per run, for setup such as the credentials the SDK signs with.
- open - starts each scenario with a fresh session id.
- execute - the one required hook: it calls InvokeAgent on the alias with
enableTraceand that session id. It returns the final text plus each action group call as a{ name, arguments }tool call. Later turns of the scenario reuse the session id. - close - ends the session, for example with
endSession. - collect - fetches delayed evidence, such as the booking record the Lambda function wrote.
Each criterion gets Pass, Fail or Unable to Verify. "The booking is cancelled in the reservation system" passes only through a read-only check: a query tool you approve, a collect hook or a read-only status endpoint. Where InvokeAgent exposes nothing to check, the verdict is Unable to Verify, reported apart and kept out of the pass rate.
- Scenarios -
rook generatebuilds them from the agent's code, a PRD or a spec, and its default classes are functional and adversarial. - Staging alias - point the profile at an alias whose Lambda functions write to staging, because the agent's writes are real.
- Profiles per alias - one profile each for the current and candidate aliases, or for the Classic alias and an AgentCore endpoint, run on the same suite.
As a pre-release gate, run rook run, then rook report --json, and fail the job on the verdicts, not on the exit status alone. The exit code tells you whether the command worked; the report tells you what the agent did. Setup is in Agent Assurance in CI.
Rook CLI installs from npm on Node.js 20 or newer; installing through Homebrew or the shell script requires no Node at all. For a coding agent's skill, run npx @testmuai/rook-skill on Node.js 22 or newer.
npm install -g @testmuai/rook@latest
rook --versionPressing Start Trial in the web app opens a 7-day free trial with 10,000 credits and the Pro features, and the plans are on the pricing page.
Where Should You Start Testing Bedrock Agents?
Start with the write action that costs most when it goes wrong, the equivalent of CancelBooking in AWS's example. On a version alias, write one scenario that asserts the call and its arguments in the trace and one read of the record it changed, then add the DENY case. That suite is also what you replay against AgentCore.
For other clouds, Vertex AI agent testing and Copilot Studio agent testing cover the Google Cloud and Microsoft equivalents, and the Agent Assurance quickstart sets up a first profile.
npm install -g @testmuai/rook@latest, or for a full walkthrough of the product.Was this helpful?
Authors

Samyak Goyal
Author · 56 posts
Samyak Goyal is a Senior Member of Technical Staff at TestMu AI engineering Kane CLI, the command-line tool that runs browser automation from the terminal, where a flow described in natural language executes in a real Chrome browser and returns pass or fail with shareable proof. He is a backend engineer with 4+ years of experience, previously an SDE at Innovaccer, where he built APIs, introduced Kafka, and cut deployment from weeks to hours. Samyak also builds multi-agent systems, skill-orchestration frameworks, and a personal copilot that indexes 200+ microservice repositories.

Sirajuddin Khan
Reviewer
Sirajuddin Khan is Vice President of Product Management at TestMu AI, where he drives the company's agentic AI product strategy, building a suite of autonomous agents that includes Agentic Browsers and Agentic Visual Testing and shifting the unit of work from test execution to autonomous outcomes. One of the company's earliest product leaders, he has owned the roadmap for the high-performance execution cloud and grew the cross-browser testing products from early adoption to market leadership. He brings over a decade of experience across SaaS, B2B, and eCommerce, with earlier product roles at Wydr and ShopClues, where his catalog and search work cut delivery SLAs and lifted seller activity. Sirajuddin holds an MBA in Information Technology from Sikkim Manipal University and a B.Tech in Computer Science Engineering from Maharshi Dayanand University.
Bedrock Agents Testing FAQs
TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance
- Advanced access controls
- Advanced data retention rules
- Advanced Local Testing
- Premium Support options
- Early access to beta features
- Private Slack Channel
- Unlimited Manual Accessibility DevTools Tests


