Files
wehub-resource-sync 0d3cb498a3
Deploy local.promptfoo.app / Deploy to Cloudflare Pages (push) Waiting to run
Test and Publish Multi-arch Docker Image / test (push) Waiting to run
Test and Publish Multi-arch Docker Image / build-docker-and-push-digests (map[digest-suffix:linux-amd64 platform:linux/amd64 runner:ubuntu-latest]) (push) Blocked by required conditions
Test and Publish Multi-arch Docker Image / build-docker-and-push-digests (map[digest-suffix:linux-arm64 platform:linux/arm64 runner:ubuntu-24.04-arm]) (push) Blocked by required conditions
Test and Publish Multi-arch Docker Image / merge-docker-digests (push) Blocked by required conditions
Test and Publish Multi-arch Docker Image / Attest Multi-arch Image (push) Blocked by required conditions
CI / Shell Format Check (push) Waiting to run
CI / Check Ruby (3.4) (push) Waiting to run
CI / CI Config (push) Waiting to run
CI / Test on Node ${{ matrix.node }} and ${{ matrix.os }}${{ matrix.shard && format(' (shard {0}/3)', matrix.shard) || '' }} (push) Blocked by required conditions
CI / Build on Node ${{ matrix.node }} (push) Blocked by required conditions
CI / Style Check (push) Waiting to run
CI / Generate Assets (push) Waiting to run
CI / Check Python (3.14) (push) Waiting to run
CI / Check Python (3.9) (push) Waiting to run
CI / Build Docs (push) Waiting to run
CI / Code Scan Action (push) Waiting to run
CI / Site tests (push) Waiting to run
CI / webui tests (push) Waiting to run
CI / Run Integration Tests (push) Waiting to run
CI / Run Smoke Tests (push) Waiting to run
CI / Go Tests (push) Waiting to run
CI / Share Test (push) Waiting to run
CI / Redteam (Production API) (push) Waiting to run
CI / Redteam (Staging API) (push) Waiting to run
CI / GitHub Actions Lint (push) Waiting to run
CI / Check Ruby (3.0) (push) Waiting to run
release-please / release-please (push) Waiting to run
release-please / build (push) Blocked by required conditions
release-please / publish-npm (push) Blocked by required conditions
release-please / publish-npm-backfill (push) Waiting to run
release-please / docker (push) Blocked by required conditions
release-please / publish-code-scan-action (push) Blocked by required conditions
release-please / attest-code-scan-action (push) Blocked by required conditions
Validate Renovate Config / Validate Renovate Configuration (push) Waiting to run
chore: import upstream snapshot with attribution
2026-07-13 13:24:08 +08:00
..

integration-strands-agents (Strands Agents SDK example)

This example demonstrates how to evaluate Strands Agents SDK with promptfoo.

Strands Agents is an open-source AI agent framework developed by AWS that provides a model-driven approach to building AI agents.

You can run this example with:

npx promptfoo@latest init --example integration-strands-agents
cd integration-strands-agents

Overview

This example showcases:

Prerequisites

Setup

1. Install Python dependencies

pip install -r requirements.txt

This installs:

2. Set environment variables

export OPENAI_API_KEY=your-api-key-here

Alternative: use Anthropic or Bedrock

Strands supports multiple model providers. To use Anthropic:

pip install 'strands-agents[anthropic]'
export ANTHROPIC_API_KEY=your-key

Then modify agent.py to use AnthropicModel instead of OpenAIModel.

To use Amazon Bedrock:

pip install 'strands-agents[bedrock]'

Running the example

# Run evaluation
npx promptfoo eval

# View results in the web UI
npx promptfoo view

How it works

Agent structure

The agent is defined in agent.py using the Strands Agent class with two tools:

  • get_weather: Returns mock weather data for cities (New York, London, Tokyo, Paris, Seattle, San Francisco)
  • convert_temperature: Converts temperatures between Fahrenheit and Celsius

Tools are defined using the @tool decorator which automatically exposes them to the LLM based on their docstrings.

Provider integration

agent_provider.py exposes a call_api function that promptfoo's Python provider calls to interact with the Strands agent.

Test cases and assertion types

The promptfoo config includes 5 test cases that demonstrate different assertion types:

Test Description Assertion types used
Weather query for New York Basic tool usage contains-any, llm-rubric, latency
Weather query for London Verify temperature format contains-any, javascript, latency
Weather query for Tokyo Case-insensitive matching icontains, javascript, latency
Weather with temperature conversion Multi-tool chaining llm-rubric, javascript, latency
Weather for unknown city Graceful fallback handling icontains, not-contains, latency

Assertion types explained

  • latency - Ensures responses complete within 30 seconds (applied to all tests via defaultTest)
  • contains-any - Verifies the agent returns expected city names and weather data from the mock tool
  • icontains - Case-insensitive matching to verify city names appear regardless of formatting
  • not-contains - Ensures the agent handles unknown cities gracefully without error messages
  • javascript - Validates temperature format (°F/°C symbols) and response length requirements
  • llm-rubric - Semantically evaluates whether the agent correctly chains weather lookup with temperature conversion