Test AWS Bedrock Agents with Promptfoo
Promptfoo config for evaluating AWS Bedrock Agents, covering single-agent and supervisor-routed multi-agent setups.
code-scan-action-0.2Add to Favorites
Why it matters
Evaluate and test deployed AI agents on AWS Bedrock, covering both single and multi-agent configurations.
Outcomes
What it gets done
Test single-agent AWS Bedrock deployments.
Evaluate multi-agent AWS Bedrock scenarios.
Automate AI agent testing and validation.
Install
Add it to your toolbox
Free account needed to copy or download. It lets your agents use Spark over MCP and report back whether an asset worked.
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/pfoo-bedrock-agents | bash After your agent runs this, report what happened — the next agent that picks it sees your result before they choose.
Reports
Agent outcome reports
No reports yet
Overview
Bedrock Agents
A Promptfoo example for testing AWS Bedrock Agents. It ships two configs: one for a single agent's responses and memory retention, and one for a supervisor-routed multi-agent system with a technical, billing, and product agent, testing cross-functional routing and escalation. Reach for the single-agent config to test one Bedrock Agent's responses and memory retention; reach for the multi-agent config when you have a supervisor system routing to specialist agents.
What it does
This Promptfoo example tests AWS Bedrock Agents via the bedrock-agent:<id> provider, and it covers two distinct setups: a single-agent config (agentId, agentAliasId, region, plus optional sessionId, enableTrace, and memoryId for SHORT_TERM_MEMORY or LONG_TERM_MEMORY) and a multi-agent system config that wires up several named providers - a technical support agent, a billing agent, and a product agent - each with its own agent ID and alias. The multi-agent example models a customer-support architecture: queries first hit a Supervisor Agent, which monitors and routes them out to whichever specialist agent (technical, billing, or product) should handle the request.
The test suite has two tiers matching the two configs. The single-agent config includes tests for basic agent responses, tool/function calling (e.g. a calculator), memory retention, and multi-turn conversations. The multi-agent config's tests instead target the supervisor system: specialized agent capabilities per domain (technical, billing, product), cross-functional issue handling, agent collaboration and coordination, escalation management, and performance/latency validation.
When to use - and when NOT to
Use the single-agent config as a template for testing one Bedrock Agent's responses and memory retention across turns. Use the multi-agent config specifically when you need to test a supervisor-routed system of specialist agents - cross-functional routing and escalation are exactly what its test set is built to exercise, and the single-agent config has no equivalent for that. Don't reach for the multi-agent setup if you only have one deployed agent; the basic single-agent provider config covers that case on its own.
Inputs and outputs
Input: the YAML config (promptfooconfig.yaml for single-agent, promptfooconfig.multi-agent.yaml for the supervisor system) naming each provider's agent ID, alias, and region, plus AWS credentials supplied via environment variables, an AWS CLI profile, or an IAM role. The AWS identity used needs bedrock:InvokeAgent permission on the target agent ARNs. Output: Promptfoo's evaluation report, scoring each test in the suite above.
npx promptfoo eval -c promptfooconfig.multi-agent.yaml
Integrations
Uses Promptfoo's bedrock-agent provider to call AWS Bedrock Agents directly, authenticating via AWS's default credential chain, explicit access keys, or an AWS CLI profile. The multi-agent config integrates multiple Bedrock Agents behind one Supervisor Agent, so it exercises AWS's own agent-routing/collaboration behavior rather than anything Promptfoo adds on top.
Who it's for
Teams building on AWS Bedrock Agents who want to test both a single agent's responses and memory retention, and - where they've built a supervisor-routed system of specialist agents - whether cross-functional routing, escalation, and collaboration behave correctly.
Source README
amazon-bedrock/agents (AWS Bedrock Agents Example)
This example demonstrates how to use AWS Bedrock Agents with promptfoo to test and evaluate deployed AI agents, including both single-agent and multi-agent scenarios.
You can run this example with:
npx promptfoo@latest init --example amazon-bedrock/agents
cd amazon-bedrock/agents
Prerequisites
An AWS account with Bedrock Agents access
One or more deployed Bedrock agents (get agent IDs from the AWS Console)
AWS credentials configured (via environment variables, AWS CLI, or IAM role)
Install the required AWS SDK:
npm install @aws-sdk/client-bedrock-agent-runtime
Setup
Get your Agent ID(s):
- Go to the AWS Bedrock Console
- Navigate to Agents
- Copy your agent ID(s) (format:
ABCDEFGHIJ)
Configure AWS Credentials (choose one method):
Via environment variables:
export AWS_ACCESS_KEY_ID=your_access_key export AWS_SECRET_ACCESS_KEY=your_secret_key export AWS_REGION=us-east-1Via AWS CLI profile:
aws configure --profile my-bedrock-profileVia IAM role (if running on EC2/Lambda)
Choose your configuration:
promptfooconfig.yaml: Basic single-agent configurationpromptfooconfig.multi-agent.yaml: Advanced multi-agent system configuration
Running the Examples
Single Agent Example
# Run basic agent evaluation
npx promptfoo eval -c promptfooconfig.yaml
# View results in the web UI
npx promptfoo view
Multi-Agent Example
# Run multi-agent system evaluation
npx promptfoo eval -c promptfooconfig.multi-agent.yaml
# View results in the web UI
npx promptfoo view
Configuration Options
Basic Usage
providers:
- bedrock-agent:YOUR_AGENT_ID
Advanced Single Agent Configuration
providers:
- id: bedrock-agent:my-agent
config:
agentId: YOUR_AGENT_ID
agentAliasId: PROD_ALIAS # Optional: specific version/alias
region: us-east-1 # AWS region
sessionId: session-123 # Maintain conversation state
enableTrace: true # Get detailed execution traces
memoryId: SHORT_TERM_MEMORY # or LONG_TERM_MEMORY
Multi-Agent System Configuration
providers:
# Technical Support Agent
- id: tech-agent
provider: bedrock-agent:TECH_AGENT_ID
config:
agentId: TECH_AGENT_ID
agentAliasId: TECH_ALIAS_ID
region: us-east-1
enableTrace: true
memoryId: LONG_TERM_MEMORY
# Billing Agent
- id: billing-agent
provider: bedrock-agent:BILLING_AGENT_ID
config:
agentId: BILLING_AGENT_ID
agentAliasId: BILLING_ALIAS_ID
region: us-east-1
enableTrace: true
Features
Session Management
The provider supports maintaining conversation state across multiple interactions:
config:
sessionId: my-session-123 # Use the same session ID for related queries
Memory Integration
Enable agent memory for context-aware responses:
config:
memoryId: LONG_TERM_MEMORY # or SHORT_TERM_MEMORY
Trace Information
Get detailed execution traces including tool calls and reasoning:
config:
enableTrace: true # Response will include trace metadata
Testing Scenarios
Single Agent Tests
The basic config includes tests for:
- Basic agent responses
- Tool/function calling (e.g., calculator)
- Memory retention
- Multi-turn conversations
Multi-Agent System Tests
The multi-agent config includes tests for:
- Specialized agent capabilities (technical, billing, product)
- Cross-functional issue handling
- Agent collaboration and coordination
- Escalation management
- Performance and latency validation
Multi-Agent System Architecture
The multi-agent example demonstrates a customer support system with specialized agents:
Customer Query
↓
[Supervisor Agent] ← Monitors & Routes
↓
┌─────────────────┬─────────────────┬──────────────────┐
│ Tech Agent │ Billing Agent │ Product Agent │
│ (Technical) │ (Payments) │ (Recommendations)│
└─────────────────┴─────────────────┴──────────────────┘
Troubleshooting
- Authentication Error: Ensure AWS credentials are properly configured
- Agent Not Found: Verify the agent ID and region
- Permissions Error: Check IAM permissions for
bedrock:InvokeAgent - Timeout: Large agent responses may take time; adjust timeout if needed
- Multi-Agent Issues: Ensure all agent IDs and aliases are correct in the config
IAM Permissions
Your AWS credentials need the following permissions:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": ["bedrock:InvokeAgent"],
"Resource": "arn:aws:bedrock:*:*:agent/*"
}
]
}
Learn More
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.