dtap-claudecode-target
A superred Target that runs the Claude Code agent (the claude_agent_sdk
Python SDK, which drives the @anthropic-ai/claude-code CLI) as one victim of the
DecodingTrust-Agent (DTAP)
benchmark, wired into superred.
It is one of two concrete agents over the shared
dtap-scaffold base; the other is
dtap-openclaw-target. The base
(dtap_scaffold.agent_base.DtapAgentTarget) owns the entire superred lifecycle:
environment activation by config, the security-domain forest, the five DTAP
attack controllables, the emit-once observables, the Docker/MCP-proxy/injection
collaborators, and the post-run query surface the DTAP claim's judge reads. This
package adds only the Claude-Code-specific pieces.
In the project's target taxonomy (chatbot < agent < assistant) this is an assistant: a container-isolated agent with full native tools (bash, file edit, web) plus the DTAP environment tools exposed over MCP.
What it adds
DtapClaudeCodeTarget implements the four abstract hooks of the base:
_agent_kind()->"claude_code"._native_tool_deny(policy)maps thenative_tools_policyconfig slot to Claude Code's native deny list:"enabled"-> none;"disabled"-> the upstream os-filesystem deny list (Bash,Read,Write,Edit,MultiEdit,Glob,Grep,NotebookEdit,AskUserQuestion); any other value is parsed as a JSON list of explicit tool names._run_episode(spec)launches the agent in an isolated Docker container via the single overridable_docker_runhelper, then reads backresult.json. The container runsdriver.py, which drivesClaudeSDKClientturn-by-turn against the host MCP proxy and writes a transcript._extract_trajectory(episode)parses that transcript withtrajectory.convert, skipping the proxied env tools (the proxy already emitted them) so only the agent's native tool calls and non-tool messages surface for the base to emit once.
How a run flows
Controller → base.run() (host)
├─ fires the 5 DTAP controllables, applies env injections, binds the proxy
├─ _run_episode(spec) → _docker_run(spec):
│ docker run (env: ANTHROPIC_BASE_URL/AUTH_TOKEN/MODEL, --add-host …)
│ └─ driver.py (in container)
│ ClaudeSDKClient ⇄ mcp__dtap_proxy__* ⇄ host MCP proxy ⇄ env
│ writes transcript.jsonl + result.json to the mounted dir
├─ _extract_trajectory → trajectory.convert(dir) → TrajectoryArtifact
└─ emits native_tool_call / agent_trace_message observables; stores the query
surface (final_response, agent_responses, trajectory_json, env_ports)
The env MCP tools are all fronted by one proxy server, dtap_proxy, so the agent
calls them as mcp__dtap_proxy__<tool>; the host proxy observes each call and
fires the per-server env-tool PostCall controllable. The converter therefore
drops every mcp__-prefixed call (proxy-owned), keeping the artifact free of
double-counted env traffic.
Usage
from dtap_claudecode_target import DtapClaudeCodeTarget
target = DtapClaudeCodeTarget(
model="claude-opus-4-8",
api_base="https://my-litellm-proxy/", # → ANTHROPIC_BASE_URL in the container
api_key="sk-...", # → ANTHROPIC_AUTH_TOKEN
image="dtap-claudecode:latest", # the agent image (built below)
state_root="/var/tmp/dtap", # optional per-instance dir root
max_turns=200,
)
The DTAP claim configures it per task via the base's config slots
(active_mcp_servers, env_injection_config, system_prompt, user_prompt,
task_dir, available_injections, threat_model, max_turns,
native_tools_policy). The model is fixed at construction (not a config slot).
Build the agent image
# build context is the package dir (which contains driver.py)
docker build -f docker/Dockerfile -t dtap-claudecode:latest \
src/dtap_claudecode_target
Install / test
pip install -e targets/dtap_claudecode
# offline unit tests (no Docker, no network, no LLM):
pytest targets/dtap_claudecode/tests -m "not docker and not live"
# full container + live-model e2e (needs Docker + LITELLM_API_KEY/BASE):
LITELLM_API_KEY=... LITELLM_API_BASE=... \
pytest targets/dtap_claudecode/tests -m "docker and live"
See ASSUMPTIONS.md for the fidelity ledger (transcript schema, the env-tool
skip, the native-tool list, and the Docker/proxy wiring).
Credits / upstream
This target is a faithful reimplementation of the Claude Agent SDK backend of
the DecodingTrust-Agent (DTAP)
red-teaming platform (Apache-2.0; arXiv:2605.04808). No upstream source is
vendored; the code independently reproduces upstream's run loop, transcript
schema, and trajectory-conversion structure, with superred-specific deviations
documented in ASSUMPTIONS.md. The only near-verbatim fragment is the
os-filesystem tool deny list. See LICENSES/NOTICE.md for full attribution.
At Docker-image build time the agent image pulls Anthropic's
claude-agent-sdk
(MIT) and the @anthropic-ai/claude-code CLI (Anthropic commercial terms)
directly from PyPI/npm; neither is redistributed inside this package.
This module's own code is released under the MIT License, Copyright (c) 2026 Simon Sure.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file superred_target_dtap_claudecode-0.1.0.tar.gz.
File metadata
- Download URL: superred_target_dtap_claudecode-0.1.0.tar.gz
- Upload date:
- Size: 36.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a53ddf76b9b28d962516676138321843e62c537bca94fec14659cde108fb2f0a
|
|
| MD5 |
ea389844350c80be55f088a530854149
|
|
| BLAKE2b-256 |
46ddb131c5a6d23917c2631fa4c874b3e912ed882c620e2d4e25e61b0f1cbfb7
|
Provenance
The following attestation bundles were made for superred_target_dtap_claudecode-0.1.0.tar.gz:
Publisher:
release.yml on RoldSI/superred-modules
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
superred_target_dtap_claudecode-0.1.0.tar.gz -
Subject digest:
a53ddf76b9b28d962516676138321843e62c537bca94fec14659cde108fb2f0a - Sigstore transparency entry: 2219132808
- Sigstore integration time:
-
Permalink:
RoldSI/superred-modules@44b3a2514b4d75fe7ebc3f015aa13ff3b6e8380c -
Branch / Tag:
refs/tags/superred-target-dtap-claudecode-v0.1.0 - Owner: https://github.com/RoldSI
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@44b3a2514b4d75fe7ebc3f015aa13ff3b6e8380c -
Trigger Event:
push
-
Statement type:
File details
Details for the file superred_target_dtap_claudecode-0.1.0-py3-none-any.whl.
File metadata
- Download URL: superred_target_dtap_claudecode-0.1.0-py3-none-any.whl
- Upload date:
- Size: 24.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0b1e7d4884d5f43aa2edb0f3ed11f8bc06ce6d5957f023b460a73217b1b1cb3
|
|
| MD5 |
c51b0d3a6e35f6616dcf7b326caf79b2
|
|
| BLAKE2b-256 |
64182554e25467f572518d813a8cdfda79a5c89041ca2bbb5c03bb19951073ff
|
Provenance
The following attestation bundles were made for superred_target_dtap_claudecode-0.1.0-py3-none-any.whl:
Publisher:
release.yml on RoldSI/superred-modules
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
superred_target_dtap_claudecode-0.1.0-py3-none-any.whl -
Subject digest:
e0b1e7d4884d5f43aa2edb0f3ed11f8bc06ce6d5957f023b460a73217b1b1cb3 - Sigstore transparency entry: 2219132843
- Sigstore integration time:
-
Permalink:
RoldSI/superred-modules@44b3a2514b4d75fe7ebc3f015aa13ff3b6e8380c -
Branch / Tag:
refs/tags/superred-target-dtap-claudecode-v0.1.0 - Owner: https://github.com/RoldSI
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@44b3a2514b4d75fe7ebc3f015aa13ff3b6e8380c -
Trigger Event:
push
-
Statement type: