Skip to main content

superred-target-minimal-llm-chat

A minimal single-turn LLM chat target for the superred red-teaming framework.

This is the smallest useful target: it takes one user message, sends it to an LLM (through litellm, so any model litellm supports works), and stores the reply for evaluation. It is the reference implementation used in superred's "writing a target" guide, and a good starting point for building your own target.

For a fuller chat target with a writable system prompt, a writable response, and conversation history, see superred-target-chatbot.

Install

pip install superred-target-minimal-llm-chat

Usage

from minimal_llm_chat import MinimalLLMChatTarget, USER_INPUT_TAG
from superred.core.controller import Controller, TargetFactory

target_factory = TargetFactory(
    create=lambda: MinimalLLMChatTarget(
        model="gpt-4o-mini",
        api_base="https://api.openai.com/v1",
        api_key="sk-...",
    ),
)

controller = Controller(
    optimizer_factory=lambda: MyOptimizer(),
    target_factory=target_factory,
    security_claim=my_claim,
    scope=frozenset({USER_INPUT_TAG}),   # attacker may inject the user message
)
result = await controller.run()

The attack surface

Security domain forest (two tags, one tree):

system            (root)
└── user_input    (child)
Surface Name Domain Description
Controllable user_input user_input The user message sent to the LLM. The only injection point.
Observable (static) model system The litellm model identifier.
Observable (per run) model_request user_input The user message actually sent.
Observable (per run) model_response system The LLM's reply.
ConfigSpec system_prompt system Set by the task before the run. Never attacker-writable.
QuerySpec last_response n/a The reply, for post-run evaluation.

Because user_input is a child of system, a scope containing system also includes user_input.

  • scope={USER_INPUT_TAG} gives a prompt-only, blind attacker: it injects the user message and sees only its own echo, not the model's reply.
  • scope={SYSTEM_TAG} additionally reveals model and model_response.

The system prompt is never attacker-writable and is never emitted as an observable, so it stays hidden at every scope.

Behaviour notes

  • Strictly single-turn: no conversation history, no durable memory. reset_ephemeral_state() clears the stored response between runs.
  • If the attacker does not inject (for example, user_input is out of scope), the target falls back to sending the literal message "Hello". A no-injection run is therefore a "Hello" run, not a no-op.
  • The target calls the LLM with its own credentials, so its inference cost is not bounded by the attacker's task_cost_cap_usd.

License

MIT

Metadata

Release files for superred-target-minimal-llm-chat 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for superred-target-minimal-llm-chat 0.1.0
File Size Uploaded Provenance
superred_target_minimal_llm_chat-0.1.0.tar.gz 4.7 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for superred-target-minimal-llm-chat 0.1.0
File Interpreter ABI Platform
superred_target_minimal_llm_chat-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.2 kB

Release files / superred_target_minimal_llm_chat-0.1.0.tar.gz

Download URL superred_target_minimal_llm_chat-0.1.0.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
99cbd0befefae7a83fc81890d7e712d2957faf690509a836b558170f76830310
BLAKE2b-256 checksum
How to use checksums
be5c44396a391367fb5870856f196a2514fd3dc605e4f3ac4438ab1e990bbd98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 15, 2026.

Transparency log

Release files / superred_target_minimal_llm_chat-0.1.0-py3-none-any.whl

Download URL superred_target_minimal_llm_chat-0.1.0-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98644ccdf754a3a8ca04c0b6fadb014ba59826075a85017e77e49adc8d767944
BLAKE2b-256 checksum
How to use checksums
2b30bb6c85d00ee60ccd9de6e27990c164441ff20223469ef6e6992a56633647
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 15, 2026.

Transparency log

Security for superred-target-minimal-llm-chat 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for superred_target_minimal_llm_chat-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page