fix(ai-red-teaming): route dn/* through proxy, keep local keys (ENG-7284)#66
Merged
Conversation
… (ENG-7284) The generated attack workflow routed models through the LiteLLM proxy only when OPENAI_BASE_URL was set — but the platform (cloud sandbox and local TUI/CLI runtime) injects the proxy as DREADNODE_LLM_BASE / DREADNODE_LLM_API_KEY, so dn/* target/attacker/judge/transform models fell through to litellm unresolved and failed with "LLM Provider NOT provided". Resolve each model (target, attacker, judge, transform) with resolve_dn_model_to_generator: dn/* ids become proxy-configured generators via DREADNODE_LLM_*, while every other id (groq/, anthropic/, openai/, ...) is left untouched so litellm uses the user's own local provider API keys. The two modes now work side by side. Model-id strings are preserved for the platform UI labels. Verified end to end on dev across combinations (all-dn, dn+local mixes, all-local): trials run and route correctly with no provider errors. Bumps ai-red-teaming to 1.4.2.
…SDK build The generated workflow imported resolve_dn_model_to_generator from dreadnode.generators.proxy, but execute_workflow runs the workflow under the installed CLI tool's interpreter, whose proxy module can predate that symbol — producing "ImportError: cannot import name 'resolve_dn_model_to_generator'" and 0 trials. Inline the dn/* -> LiteLLM-proxy resolution (using only get_generator + GenerateParams, present in every SDK build) instead of importing it. Verified live: execute_workflow now succeeds on first try for dn/* (proxy) and non-dn/ (local provider key) models with no ImportError and no routing errors.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to the SDK fixes in dreadnode-tiger #1840 / #1845, for the agent-generated attack workflow (
attack_runner.py) — the path the AI Red Teaming agent runs in the TUI and cloud sandbox.Previously the workflow only proxied models when
OPENAI_BASE_URLwas set. But the platform (both the cloud sandbox and the local TUI/CLI runtime) injects the LiteLLM proxy asDREADNODE_LLM_BASE/DREADNODE_LLM_API_KEY, sodn/*models fell through to litellm unresolved and failed withLLM Provider NOT provided— with the error text then reused for downstream attack steps.Fix
Resolve every model role — target, attacker, judge, and transform — through
resolve_dn_model_to_generator:dn/*→ proxy-configured Generator viaDREADNODE_LLM_*(works in sandbox and local runtime).groq/,anthropic/,openai/, …) → left untouched so litellm uses the user's own local provider keys (GROQ_API_KEY,OPENAI_API_KEY, …).Both modes now work side by side. Model-id strings are preserved for the platform UI labels; the resolved
*_GENvalues drive inference. Bumpsai-red-teaming1.4.1 → 1.4.2.Validation (end-to-end on dev,
promptattack, real trials)GROQ_API_KEYNo
LLM Provider NOT providederrors in any combination.just validate+ pre-commit clean.🤖 Generated with Claude Code