Skip to content

feat: add Netra.redteam.runRedteam() to trigger an existing red-team config - #134

Draft
jithin23-kv wants to merge 2 commits into
mainfrom
feat/redteam-sdk-client
Draft

feat: add Netra.redteam.runRedteam() to trigger an existing red-team config#134
jithin23-kv wants to merge 2 commits into
mainfrom
feat/redteam-sdk-client

Conversation

@jithin23-kv

@jithin23-kv jithin23-kv commented Aug 10, 2026

Copy link
Copy Markdown
  • Netra.redteam.runRedteam({configId, handler, maxConcurrency?}) — fetches the run's prompt list once, drives every session's turns locally against a plain handler function, submits results, returns aggregated results/progress/riskScore
  • Depends on the backend PR (KeyValueSoftwareSystems/combat-ai-core#1445) for the /redteam/sdk/* endpoints

104/104 tests passing. Verified against a real running backend + real Postgres (not just mocks) — full multi-turn attack loop, judge scoring, progress/riskScore aggregation.

…red-team config

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@jithin23-kv jithin23-kv changed the title feat(redteam): add Netra.redteam.runRedteam() to trigger an existing red-team config feat: add Netra.redteam.runRedteam() to trigger an existing red-team config Aug 10, 2026
Netra.init() and runRedteam() each installed their own independent
SIGINT/SIGTERM listener; Netra.init()'s process.exit(0) could win the
race and kill the process before runRedteam()'s cancel POST got a
response back from the backend, leaving runs stuck "running"
server-side. Replaces both with a single shared, dependency-free
shutdown-hook registry (src/utils/shutdown-hooks.ts) that installs
the SDK's one real signal listener lazily, on first registration —
so it works for a standalone `new Redteam(config)` instance with no
Netra.init() call too.

Also:
- Adds runNumber to RedteamResult/RunProgress, passed through from
  the backend's new getRunNumber() (matches the dashboard's "Run #N").
- Wraps each redteam turn in its own span and stamps
  netra.trace.origin=redteam on the root span, mirroring the backend's
  existing filter for redteam-originated traces.

Verified live: real SIGINT against a running backend, both via
Netra.init() and via a standalone Redteam instance, each confirmed
server-side (independent of client-side logs) to leave the run
"cancelled" rather than stuck "running".

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants