Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixture-backed `evals/skills/triage-bug/basic`: buggy `Discount.apply` (integer division), passing happy-path tests, and a condensed `skills/triage-bug/SKILL.md`.
- Fixture-backed `evals/skills/refactor-process/basic`: duplicated `OrderProcessor` methods, passing characterization tests, and a condensed `skills/refactor-process/SKILL.md`.
- xAI (Grok) provider: OpenAI-compatible client at `https://api.x.ai/v1/chat/completions`, default model `grok-4`, `skill-bench init --xai`, env `SKILL_BENCH_XAI_API_KEY` or `XAI_API_KEY`.
- Amazon Bedrock provider: Runtime OpenAI-compatible Chat Completions with a Bedrock API key (`AWS_BEARER_TOKEN_BEDROCK` or `SKILL_BENCH_BEDROCK_API_KEY`), default region `us-east-1`, default model `amazon.nova-lite-v1:0`. IAM SigV4 is not included.

### Documentation
- Align user docs with shipped 1.3.1: OpenRouter and mock in the provider list, Azure env var `SKILL_BENCH_AZURE_OPENAI_API_KEY`, Mistral key via `skill-bench.json` (no env mapping).
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ See the [Ecosystem Overview](https://github.com/igmarin/agent-mcp-runtime/blob/m
- **Isolated Git Sandboxes**: Every run operates in a temporary repo. Clean diffs, zero side-effects, 100% reproducibility.
- **Blind Judging with Dimensions**: LLM judge scores baseline and context independently across 5 canonical dimensions (Correctness, Skill Adherence, Code Quality, Test Coverage, Documentation). Eval authors configure weights and thresholds via `criteria.json`.
- **Sophisticated ReAct Loop**: Employs a robust `Thought → Tool → Observation` loop to handle complex, multi-step engineering tasks.
- **Multi-Provider Ecosystem**: Native support for **OpenAI**, **Anthropic**, **Google Gemini**, **Azure OpenAI**, **Ollama**, **Groq**, **DeepSeek**, **Mistral**, **OpenCode**, **OpenRouter**, and **xAI**.
- **Multi-Provider Ecosystem**: Native support for **OpenAI**, **Anthropic**, **Google Gemini**, **Azure OpenAI**, **Ollama**, **Groq**, **DeepSeek**, **Mistral**, **OpenCode**, **OpenRouter**, **xAI**, and **Amazon Bedrock**.
- **Standardized Intelligence**: Consistent reporting format regardless of the underlying LLM provider.

---
Expand Down Expand Up @@ -69,6 +69,7 @@ CLI / API → RunnerService → Sandbox + ReAct Agent → LLM Client Layer → P
| **OpenCode** | `SKILL_BENCH_OPENCODE_API_KEY`, `SKILL_BENCH_OPENCODE_BASE_URL` | `:opencode` |
| **OpenRouter** | `SKILL_BENCH_OPENROUTER_API_KEY` | `:openrouter` |
| **xAI** | `SKILL_BENCH_XAI_API_KEY` or `XAI_API_KEY` | `:xai` |
| **Bedrock** | `SKILL_BENCH_BEDROCK_API_KEY` or `AWS_BEARER_TOKEN_BEDROCK` | `:bedrock` |
| **Mock** | — (offline, `skill-bench init --mock`) | `:mock` |

> **Note:** Environment variables are loaded automatically. You can also configure provider settings in `skill-bench.json` (created by `skill-bench init`).
Expand All @@ -80,6 +81,8 @@ CLI / API → RunnerService → Sandbox + ReAct Agent → LLM Client Layer → P
> **OpenRouter** uses OpenRouter's OpenAI-compatible API (default model `anthropic/claude-3.5-sonnet`). Set `SKILL_BENCH_OPENROUTER_API_KEY` and scaffold with `skill-bench init --openrouter`.
>
> **xAI** uses xAI's OpenAI-compatible chat completions API (default model `grok-4`). Set `SKILL_BENCH_XAI_API_KEY` or `XAI_API_KEY` and scaffold with `skill-bench init --xai`.
>
> **Amazon Bedrock** uses the Runtime OpenAI-compatible Chat Completions path (`https://bedrock-runtime.<region>.amazonaws.com/openai/v1/chat/completions`) with a Bedrock API key. Default region `us-east-1` (`SKILL_BENCH_BEDROCK_REGION` or `AWS_REGION`), default model `amazon.nova-lite-v1:0`. Scaffold with `skill-bench init --bedrock`. IAM SigV4 signing is not in this client.

### Command Allowlist

Expand Down Expand Up @@ -151,7 +154,7 @@ skill-bench init --openai
}
```

**Available providers:** `--openai`, `--anthropic`, `--gemini`, `--ollama`, `--azure`, `--groq`, `--deepseek`, `--mistral`, `--opencode`, `--openrouter`, `--xai`, plus `--mock` for an offline config with no API key.
**Available providers:** `--openai`, `--anthropic`, `--gemini`, `--ollama`, `--azure`, `--groq`, `--deepseek`, `--mistral`, `--opencode`, `--openrouter`, `--xai`, `--bedrock`, plus `--mock` for an offline config with no API key.

**Zero-config offline path:** `skill-bench init --mock` scaffolds a minimal offline config that needs no API key and no network — `{"provider":"mock","max_execution_time":30}`. Use it to try the full flow (and run the bundled examples) before wiring up a real provider.

Expand Down
2 changes: 1 addition & 1 deletion docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Owns per-dimension arithmetic and the boolean verdict. Does not call the network

### `Clients::BaseClient` and `ProviderRegistry`

Own HTTP to LLM providers (Faraday, retries, response normalization). Registered providers: openai, anthropic, gemini, ollama, azure, groq, deepseek, mistral, opencode, openrouter, xai, plus mock and null. Do not own eval files.
Own HTTP to LLM providers (Faraday, retries, response normalization). Registered providers: openai, anthropic, gemini, ollama, azure, groq, deepseek, mistral, opencode, openrouter, xai, bedrock, plus mock and null. Do not own eval files.

### `Config`

Expand Down
2 changes: 1 addition & 1 deletion docs/first-eval-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ skill-bench init --openai

This creates `skill-bench.json` with the OpenAI provider config. Use `--force` to overwrite.

**Available providers:** `--openai`, `--anthropic`, `--gemini`, `--ollama`, `--azure`, `--groq`, `--deepseek`, `--mistral`, `--opencode`, `--openrouter`, `--xai`, plus `--mock` for an offline config with no API key.
**Available providers:** `--openai`, `--anthropic`, `--gemini`, `--ollama`, `--azure`, `--groq`, `--deepseek`, `--mistral`, `--opencode`, `--openrouter`, `--xai`, `--bedrock`, plus `--mock` for an offline config with no API key.

> **What is `skill-bench.json`?** This is your config file. It stores your API key, chosen LLM model, timeout, and allowed shell commands. Think of it as `.env` but structured as JSON. You edit it; SkillBench reads it.

Expand Down
3 changes: 3 additions & 0 deletions lib/skill_bench/clients/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ graph TD
OpenCode[OpenCode]
OpenRouter[OpenRouter]
Xai[Xai]
Bedrock[Bedrock]
Mock[Mock]

%% Connections
Expand All @@ -47,6 +48,7 @@ graph TD
Base -.-> OpenCode
Base -.-> OpenRouter
Base -.-> Xai
Base -.-> Bedrock
Base -.-> Mock
end

Expand Down Expand Up @@ -80,6 +82,7 @@ graph TD
| **DeepSeek** | `:deepseek` | `DEEPSEEK_*` | Cost-effective alternative |
| **OpenCode** | `:opencode` | `OPENCODE_*` | **Custom endpoint required** (self-hosted proxy / LiteLLM / vLLM) |
| **xAI** | `:xai` | `SKILL_BENCH_XAI_*` / `XAI_*` | Grok via `https://api.x.ai` |
| **Bedrock** | `:bedrock` | `SKILL_BENCH_BEDROCK_*` / `AWS_BEARER_TOKEN_BEDROCK` | Runtime OpenAI-compatible Chat Completions |
| **Null Client** | `:null` | N/A | Mock / Fallback testing |

---
Expand Down
1 change: 1 addition & 0 deletions lib/skill_bench/clients/all.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@
require_relative 'providers/mistral'
require_relative 'providers/openrouter'
require_relative 'providers/xai'
require_relative 'providers/bedrock'
require_relative 'providers/mock'
5 changes: 5 additions & 0 deletions lib/skill_bench/clients/provider_schemas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ class ProviderSchemas
xai: {
api_key: nil,
model: 'grok-4'
}.freeze,
bedrock: {
api_key: nil,
model: 'amazon.nova-lite-v1:0',
location: 'us-east-1'
}.freeze
}.freeze

Expand Down
49 changes: 49 additions & 0 deletions lib/skill_bench/clients/providers/bedrock.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# frozen_string_literal: true

require_relative '../base_client'
require_relative '../provider_registry'

module SkillBench
module Clients
module Providers
# Amazon Bedrock LLM client.
# Uses Bedrock Runtime's OpenAI-compatible Chat Completions path with a
# Bedrock API key (bearer). IAM SigV4 signing is a follow-up.
class Bedrock < BaseClient
SkillBench::Clients::ProviderRegistry.register(:bedrock, self)

DEFAULT_REGION = 'us-east-1'

# Returns the provider identifier.
#
# @return [Symbol]
def provider_name
:bedrock
end

protected

# Returns the Bedrock Runtime host for the configured region.
#
# @return [String]
def base_url
@base_url_config || "https://bedrock-runtime.#{region}.amazonaws.com"
end

# Returns the OpenAI-compatible chat completions path.
#
# @return [String]
def request_path
@request_path_config || '/openai/v1/chat/completions'
end

private

def region
loc = @location.to_s.strip
loc.empty? ? DEFAULT_REGION : loc
end
end
end
end
end
3 changes: 2 additions & 1 deletion lib/skill_bench/config/defaults.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ def self.config
deepseek: { api_key: nil, model: 'deepseek-chat' },
opencode: { api_key: nil, model: 'opencode-model', base_url: nil },
openrouter: { api_key: nil, model: 'anthropic/claude-3.5-sonnet' },
xai: { api_key: nil, model: 'grok-4' }
xai: { api_key: nil, model: 'grok-4' },
bedrock: { api_key: nil, model: 'amazon.nova-lite-v1:0', location: 'us-east-1' }
}
}
end
Expand Down
7 changes: 6 additions & 1 deletion lib/skill_bench/config/env_overrides.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ class EnvOverrides
'SKILL_BENCH_XAI_API_KEY' => %i[xai api_key],
'XAI_API_KEY' => %i[xai api_key],
'SKILL_BENCH_XAI_MODEL' => %i[xai model],
'XAI_MODEL' => %i[xai model]
'XAI_MODEL' => %i[xai model],
'SKILL_BENCH_BEDROCK_API_KEY' => %i[bedrock api_key],
'AWS_BEARER_TOKEN_BEDROCK' => %i[bedrock api_key],
'SKILL_BENCH_BEDROCK_MODEL' => %i[bedrock model],
'SKILL_BENCH_BEDROCK_REGION' => %i[bedrock location],
'AWS_REGION' => %i[bedrock location]
}.freeze

# Returns provider overrides from the given environment.
Expand Down
112 changes: 112 additions & 0 deletions test/evaluator/clients/providers/bedrock_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# frozen_string_literal: true

require 'test_helper'

module SkillBench
module Clients
module Providers
class BedrockTest < Minitest::Test
def setup
Config.reset
Config.current_llm_provider = :bedrock
end

def test_call_returns_message_content_on_success
Config.setup do |config|
config.set_provider_api_key(:bedrock, 'test_bedrock_key')
config.set_provider_location(:bedrock, 'us-west-2')
end

stub_request(:post, 'https://bedrock-runtime.us-west-2.amazonaws.com/openai/v1/chat/completions')
.to_return(
status: 200,
body: { choices: [{ message: { content: 'Hello from Bedrock', role: 'assistant' } }] }.to_json,
headers: { 'Content-Type' => 'application/json' }
)

old_stderr = $stderr
$stderr = StringIO.new
begin
result = Bedrock.call(
api_key: 'test_bedrock_key',
model: 'amazon.nova-lite-v1:0',
location: 'us-west-2',
system_prompt: 'System',
messages: [{ role: 'user', content: 'Hi' }]
)
ensure
$stderr = old_stderr
end

assert result[:success]
assert_equal 'Hello from Bedrock', result[:response][:message]['content']
end

def test_call_sends_bearer_auth_to_openai_compatible_path
Config.setup do |config|
config.set_provider_api_key(:bedrock, 'test_bedrock_key')
end

stub = stub_request(:post, 'https://bedrock-runtime.us-east-1.amazonaws.com/openai/v1/chat/completions')
.with(
headers: { 'Authorization' => 'Bearer test_bedrock_key' },
body: hash_including('model' => 'amazon.nova-lite-v1:0')
)
.to_return(
status: 200,
body: { choices: [{ message: { content: 'ok', role: 'assistant' } }] }.to_json,
headers: { 'Content-Type' => 'application/json' }
)

old_stderr = $stderr
$stderr = StringIO.new
begin
Bedrock.call(
api_key: 'test_bedrock_key',
model: 'amazon.nova-lite-v1:0',
system_prompt: 'System',
messages: [{ role: 'user', content: 'Hi' }]
)
ensure
$stderr = old_stderr
end

assert_requested stub
end

def test_call_returns_error_on_missing_api_key
Config.setup do |config|
config.set_provider_api_key(:bedrock, nil)
end

result = Bedrock.call(api_key: nil, system_prompt: 'System', messages: [])

refute result[:success]
assert_equal 'API Key not set for Bedrock', result[:response][:error][:message]
end

def test_provider_name
client = Bedrock.new(system_prompt: '', messages: [])

assert_equal :bedrock, client.provider_name
end

def test_default_region_is_us_east1
client = Bedrock.new(system_prompt: '', messages: [])

assert_equal 'https://bedrock-runtime.us-east-1.amazonaws.com', client.send(:base_url)
end

def test_request_path
client = Bedrock.new(system_prompt: '', messages: [])

assert_equal '/openai/v1/chat/completions', client.send(:request_path)
end

def test_schema_default_model
assert_equal 'amazon.nova-lite-v1:0', ProviderSchemas.for(:bedrock)[:model]
end
end
end
end
end
16 changes: 16 additions & 0 deletions test/evaluator/config/env_overrides_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,22 @@ def test_omits_absent_env_values
assert_equal({}, result[:response][:overrides])
end

def test_maps_bedrock_bearer_token_and_region
result = EnvOverrides.call(
env: {
'AWS_BEARER_TOKEN_BEDROCK' => 'bedrock-token',
'SKILL_BENCH_BEDROCK_REGION' => 'eu-west-1',
'SKILL_BENCH_BEDROCK_MODEL' => 'amazon.nova-lite-v1:0'
}
)

assert result[:success]
assert_equal(
{ bedrock: { api_key: 'bedrock-token', location: 'eu-west-1', model: 'amazon.nova-lite-v1:0' } },
result[:response][:overrides]
)
end

def test_maps_xai_api_key_from_prefixed_and_native_env
result = EnvOverrides.call(
env: {
Expand Down
5 changes: 3 additions & 2 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
#
# Strip both SKILL_BENCH_<PROVIDER>_<SETTING> and legacy <PROVIDER>_<SETTING>
# for every EnvOverrides-capable setting on every registered provider.
%w[OPENAI ANTHROPIC GEMINI OLLAMA AZURE GROQ DEEPSEEK MISTRAL OPENCODE OPENROUTER XAI]
.product(%w[API_KEY MODEL BASE_URL ENDPOINT LOCATION PROJECT_ID API_VERSION])
%w[OPENAI ANTHROPIC GEMINI OLLAMA AZURE GROQ DEEPSEEK MISTRAL OPENCODE OPENROUTER XAI BEDROCK]
.product(%w[API_KEY MODEL BASE_URL ENDPOINT LOCATION PROJECT_ID API_VERSION REGION])
.each do |provider, setting|
ENV.delete("#{provider}_#{setting}")
ENV.delete("SKILL_BENCH_#{provider}_#{setting}")
end
%w[AWS_REGION AWS_DEFAULT_REGION AWS_BEARER_TOKEN_BEDROCK].each { |key| ENV.delete(key) }
Loading