Prompt Chain

Generate and debug code with adaptive agentic reasoning

Promptfoo example testing Claude Sonnet 5's agentic reasoning and coding at high effort with opt-in adaptive thinking.

Works with anthropicclaude

92
Spark score
out of 100
Updated 22 days ago
Version code-scan-action-0.1
Models
claude 3 5 sonnet

Add to Favorites

Why it matters

Execute complex coding tasks using Claude Sonnet 5's agentic reasoning capabilities with high-effort adaptive thinking to generate, debug, and refine code solutions autonomously.

Outcomes

What it gets done

01

Generate code solutions using agentic reasoning patterns

02

Debug and refine code through adaptive thinking cycles

03

Execute multi-step coding workflows with high effort level

04

Apply machine learning approaches to code generation tasks

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/pfoo-sonnet-5 | bash

Steps

Steps in the chain

01
Set your API key
02
Run the evaluation
03
View results

Overview

Sonnet 5

A promptfoo example testing Claude Sonnet 5 on agentic bug diagnosis and code generation, covering its opt-in adaptive thinking and effort-level tuning across providers. Use when evaluating Claude Sonnet 5 for agentic debugging or code generation and you need to tune effort and adaptive thinking for cost/performance.

What it does

This example exercises Claude Sonnet 5 on agentic reasoning and coding tasks using the high effort level with adaptive thinking. Claude Sonnet 5 is the Claude 5-generation Sonnet, built to be Anthropic's most agentic Sonnet, with capability approaching Opus 4.8 at Sonnet pricing and a 1M-token context window. The example evaluates multi-system bug diagnosis of an intermittent production failure and production-quality code generation with error handling and caching.

When to use - and when NOT to

Use this example when evaluating Sonnet 5 on agentic debugging or code-generation tasks where reasoning depth and effort level matter. Unlike Fable 5/Mythos 5, adaptive thinking on Sonnet 5 is opt-in - without an explicit thinking block the model runs without extended thinking even at high effort, so set thinking: { type: adaptive } (as this example does) to let the model decide when and how much to reason per request; Sonnet 5 also accepts thinking: { type: disabled }, unlike Fable 5/Mythos 5.

Inputs and outputs

Set ANTHROPIC_API_KEY, then scaffold and run:

npx promptfoo@latest init --example anthropic/sonnet-5
cd sonnet-5
export ANTHROPIC_API_KEY=your_api_key_here
npx promptfoo@latest eval
npx promptfoo@latest view

effort tunes the cost/performance tradeoff and supports low, medium, high, xhigh, and max - high is a cost-efficient default, stepping up to xhigh/max for the hardest work paired with a large max_tokens. Sonnet 5 rejects temperature, top_p, and top_k at the model level, and promptfoo omits them automatically. Pricing is $3/$15 per million input/output tokens standard, with introductory pricing of $2/$10 through August 31, 2026; the full 1M-token context bills at the standard rate with no long-context surcharge.

Integrations

Sonnet 5 is also reachable through AWS Bedrock (bedrock:us.anthropic.claude-sonnet-5 or bedrock:converse:us.anthropic.claude-sonnet-5), Google Vertex (vertex:claude-sonnet-5 with config.region: global, availability possibly rolling out after the Anthropic API launch), and Azure AI Foundry (pointing anthropic:messages:claude-sonnet-5 at https://<resource>.services.ai.azure.com/anthropic via apiBaseUrl). Across all four providers, promptfoo automatically omits the unsupported sampling parameters for Sonnet 5; the Anthropic Messages provider (used directly and for Azure via apiBaseUrl) logs a one-time warning if they're set explicitly, while Bedrock and Vertex omit them silently.

Who it's for

Teams evaluating Claude Sonnet 5 for agentic debugging and code-generation tasks who want to tune effort and adaptive-thinking settings for a cost/performance tradeoff, and who need it available consistently across Anthropic's direct API, AWS Bedrock, Google Vertex, and Azure AI Foundry.

Source README

anthropic/sonnet-5 (Claude Sonnet 5 Agentic Reasoning)

This example exercises Claude Sonnet 5 on agentic reasoning and coding tasks using the high effort level with adaptive thinking.

You can run this example with:

npx promptfoo@latest init --example anthropic/sonnet-5
cd sonnet-5

What This Tests

Claude Sonnet 5 is the Claude 5-generation Sonnet - built to be Anthropic's most agentic Sonnet, with capability approaching Opus 4.8 at Sonnet pricing and a 1M-token context window. This example evaluates:

  • Multi-system bug diagnosis of an intermittent production failure
  • Production-quality code generation with error handling and caching

Working with Sonnet 5

  • Adaptive thinking is opt-in. Set thinking: { type: adaptive } (as this example does) to let the model decide when and how much to reason per request. Without an explicit thinking block the model runs without extended thinking, even at high effort. Unlike Fable 5 / Mythos 5, Sonnet 5 also accepts thinking: { type: disabled }.
  • effort tunes the cost/performance tradeoff. Sonnet 5 supports low, medium, high, xhigh, and max. high is a good cost-efficient default; step up to xhigh/max for the hardest work and pair high effort with a large max_tokens.
  • Sampling controls are managed for you. Sonnet 5 rejects temperature, top_p, and top_k at the model level; promptfoo omits them automatically (don't set them in config).
  • Pricing. $3/$15 per million input/output tokens standard, with introductory pricing of $2/$10 through August 31, 2026. The full 1M-token context bills at the standard rate (no long-context surcharge).

Running the Example

### Set your API key
export ANTHROPIC_API_KEY=your_api_key_here

### Run the evaluation
npx promptfoo@latest eval

### View results
npx promptfoo@latest view

Other providers

Sonnet 5 is also reachable through:

  • AWS Bedrock - bedrock:us.anthropic.claude-sonnet-5 (or bedrock:converse:us.anthropic.claude-sonnet-5)
  • Google Vertex - vertex:claude-sonnet-5 with config.region: global (availability may roll out after the Anthropic API launch)
  • Azure AI Foundry - point anthropic:messages:claude-sonnet-5 at https://<resource>.services.ai.azure.com/anthropic via apiBaseUrl

Across all four providers, promptfoo automatically omits the unsupported sampling parameters (temperature, top_p, top_k) for Sonnet 5. The Anthropic Messages provider - used directly and for Azure AI Foundry via apiBaseUrl - logs a one-time warning if you set them explicitly; the Bedrock and Vertex paths omit them silently.

Learn More

FAQ

Common questions

Discussion

Questions & comments ยท 0

Sign In Sign in to leave a comment.