Chunked request attacks in PyRIT

PyRIT's chunked request attack asks for a protected answer in pieces across turns, showing whether your output filters inspect each response or only whole answers. This page explains what it sends, how to configure and verify it, and what to confirm before you rely on the result.

On this page

Why chunked request attacks matter for output filter testing

A team that runs a content filter on model output needs to know whether that filter catches answers assembled from fragments, not only answers that arrive whole. The chunked request attack in PyRIT tests exactly that gap: it asks for a protected answer in pieces across several turns, so each piece may look harmless on its own while the combined answer is not. A filter that checks only complete responses can pass every individual turn and still let the assembled content through.

PyRIT's Multi-Turn Attacks documentation describes a category of multi-turn attacks that request the answer in chunks without an adversarial target. In other words, the attack does not need a separate attacker model to steer the conversation toward the objective. The documentation describes the approach at the level of the attack category, so before you rely on it, read the current PyRIT documentation for multi-turn attacks and confirm how the chunked request attack is configured, which objective and piece structure it uses, and what it records for each turn in memory.

For your own testing, the practical decision is whether your output filter sees the conversation or only the single response. Ask your team which layer scores each turn, whether the filter keeps any state across turns, and whether the target application stores or re-sends earlier chunks to the model. Those answers determine what a chunked test can prove. A pass shows the filter held against this pattern in your configuration, and a failure shows a concrete gap to fix, but neither result says anything about other fragmentation strategies.

How the chunked request sequence reaches the output filter

The flow starts with the operator's objective, which PyRIT breaks into chunk prompts that are sent across turns to the target application. Each turn's model response passes through the output filter before reaching the harness, so the filter sees one fragment at a time. The scorer judges only the assembled transcript. Check whether the filter ever sees the combined answer, because that gap is what the test is designed to expose.

Chunk prompts cross the trust boundary, and only filtered fragments return to the scorer.

Which configuration options change what the test proves

This table compares the configuration choices for a chunked request test and what each one changes in the result. Read each row as a decision: the setting you choose determines whether a pass or fail says something about the output filter, the conversation state, or the scorer. The main takeaway is that a clean result only means something when the chunking, turn limit, state handling and scoring match the defence you are trying to test.

OptionWhat it controlsWhen it fitsWhat result it changes
Chunk split of the objectiveHow the protected request is divided into pieces sent across turnsUse finer splits to test filters that look for keywords or phrases, and coarser splits when testing whether context accumulatesA filter that blocks whole answers may pass every fragment, so the split decides which weakness appears
Turn limitHow many turns the attack may use to deliver and assemble the chunksSet it to the number of chunks plus a small margin for refusals and retries, and raise it only when a run is clearly making progressToo few turns ends the attack before assembly, which reads as a false pass; too many inflates cost without adding coverage
Target state handlingWhether the target keeps conversation history between turnsStateful targets test assembly across turns, while stateless endpoints need the full context resent each turnStateless results show per-message filtering only, so a pass does not prove the target resists multi-turn assembly
Memory backendWhere each turn, score and attack result is stored, currently SQLite or Azure SQL according to the PyRIT documentationSQLite suits local runs and single analysts, while Azure SQL suits shared or audited test recordsThe backend does not change the attack outcome, but it determines whether reviewers can later reconstruct each chunk and response
Scorer applied to the combined answerWhether the judge reads the assembled text, individual turns, or bothScore the assembled answer when the question is whether harmful content was produced, and score turns when you need to see which chunk leakedScoring turns alone can miss a complete answer, while scoring only the final text can hide where a filter failed
Scorer typeLLM judge, Azure AI Content Safety, or custom logicUse custom logic for exact content checks in regulated outputs, and LLM judges for semantic harmDifferent scorers can disagree on the same transcript, so record which one produced each verdict
Adversarial or fixed chunk generationWhether chunks are supplied by you or produced by a modelFixed chunks give repeatable regression tests, and model-written chunks explore more variationModel-generated chunks change between runs, so compare results only when the chunk sequence is recorded

How to set up a chunked request test in PyRIT

This sequence takes a team from a clean Python environment to a stored chunked request run in PyRIT, so they can see whether an output filter checks each piece of a split answer or only the assembled response. The result is one reviewable conversation in memory with a scored outcome.

  1. Install PyRIT from PyPI

    Create a virtual environment on a supported Python version, which the PyPI package lists as 3.10 up to but not including 3.15, with 3.13 recommended in the PyRIT documentation. Install the package with pip from the pyrit project on PyPI, then confirm the install by importing pyrit in a Python shell and printing its version. Done means the import succeeds in the same environment you will use for the test, not in a system interpreter.

  2. Configure credentials and settings files

    Create ~/.pyrit/.env for the API keys and endpoint credentials your target and scorer need, and ~/.pyrit/.pyrit_conf for PyRIT settings. Keep secrets in the .env file rather than in notebooks or scripts, and restrict file permissions so only the test operator can read them. Done means a short script loads the configuration without errors and reports which target and scorer endpoints it found, with no secret values printed.

  3. Define the target

    Declare the system you are testing as a PyRIT target, such as a model endpoint, a custom HTTP or WebSocket app, or a web chat UI driven through Playwright, depending on where your output filter sits. Confirm whether the target keeps conversation state between turns, because a chunked attack depends on earlier turns being visible to the model. Done means one test prompt sent through the target returns a response that you have read and that matches what the production interface shows.

  4. Choose the objective and scorer

    Write the objective the protected answer is meant to withhold, using content your policy actually restricts and that you are authorized to test. Select a scorer that decides whether the assembled answer was disclosed, such as an LLM judge or custom logic, and check it against a few responses you have labeled yourself. Done means you have a written objective, a scorer name, and a small set of hand-labeled examples where the scorer agrees with your labels.

  5. Run the chunked request attack

    Build the chunked request attack against the target with your objective and scorer, then run it once on a single objective before any batch. Each turn asks for one piece of the protected answer, and the attack records every turn and the score for the response. Done means the run finishes without errors and returns a result object with a completed status for the attack.

  6. Inspect the stored conversation in memory

    Query PyRIT memory, which stores conversations and results in SQLite by default or Azure SQL where configured, and open the stored turns for this run. Check each filtered or blocked turn, whether the filter acted on individual chunks, and whether the scorer judged the combined text. Done means you can state, from the stored turns alone, whether any single chunk was blocked, whether the assembled answer was disclosed, and whether the scorer result matches your reading.

  7. Record the result for review

    Export the relevant conversation and score so a second reviewer can follow the same turns without rerunning the attack. Note the target version, the scorer, the objective and the PyRIT version used, since these determine whether a later rerun is comparable. Done means a reviewer who has only the export can reproduce the verdict on the same turns.

How the chunks are assembled and scored

The chunked request attack decides what to ask in each turn by splitting a protected request into smaller parts and sending them in sequence, so the question you care about is which scorer will judge the material the target produces across those turns. Each turn's response is kept in PyRIT memory as its own piece of conversation, along with the prompt that produced it. That record matters because a partial answer that looks harmless on its own can still be part of the material you are trying to test. Before you run the attack, confirm in the PyRIT documentation for the version you install how the attack constructs each turn and whether it carries earlier answers forward into later prompts, since that changes what the target can see.

Scoring the final assembled text and scoring each turn are different tests. A per-turn check asks whether this one response contains the protected content. A conversation-level check asks whether the material across the turns, read together, delivers it. An output filter that inspects whole responses may pass every individual fragment and still miss the assembled answer, and a per-turn scorer may pass fragments that a conversation-level scorer would flag. Decide which of these your deployment's controls are supposed to catch before you choose how to score, and record that choice in the test plan so a passing result means something specific.

The scorer choice determines what is detected. An LLM judge can read a whole conversation and reason about intent, but its verdict depends on the judge model and its instructions, so test it against examples you have labeled yourself. Azure AI Content Safety classifies content against defined harm categories, which suits category-based checks but may not catch a protected answer that uses no flagged category. Custom logic, such as matching for a specific string or a known leaked value, is precise for data leakage but misses paraphrase. Pick the scorer that matches the protected content, and run the same attack with two scorers where the result will drive a finding.

Security and operational risks of running chunked tests

A chunked test sends real attack content to a target, writes every exchange to memory, and calls paid endpoints across many turns. The risks below concern the target, the data PyRIT keeps, the credentials it reads, and the cost of the traffic, so each one needs an owner before the first run.

Harmful objective content reaching production

Chunked attacks ask for a protected answer in pieces, so the objective and each chunk are harmful content sent to whatever endpoint you configure. If that endpoint is a production assistant with real users or live tools, a test can produce outputs customers see or trigger actions. Point chunked tests only at an isolated test deployment with the same system prompt, filters and tools, and confirm with the owner that it is not wired to production data.

Sensitive output in logs and memory

PyRIT records conversations and scores in its memory, so partial answers that a filter would have blocked as whole responses are now stored in full. Those fragments can contain regulated data, internal instructions or credentials the model echoed. Ask who can read the logs of the test host and the memory database, and set a retention rule before the first chunked run rather than after the data accumulates.

Credentials in .env files

PyRIT reads target credentials from ~/.pyrit/.env, so a chunked run on a shared workstation or CI runner leaves model keys readable to anyone with that account. Keep the file out of repositories, scope keys to the test target only, and rotate them after the test window. Confirm whether your team will use a secret manager instead of a plaintext file on each host.

Rate limits and cost on paid endpoints

Each chunked attack sends several requests per objective, and the scorer and any adversarial model add more calls. Against a paid model endpoint, the bill grows with objectives, retries and concurrency, and a misconfigured loop can exhaust a quota that production depends on. Set per-run budgets on the provider account, use a separate key, and check the rate limit settings in the PyRIT configuration before scaling a run.

Test traffic affecting shared systems

A chunked run sends many sequential requests to one endpoint, which can slow a shared gateway, fill logs in a monitoring stack or trigger intrusion alerts on the SOC side. Agree the test window and source addresses with the teams that run those services, and tell the security operations team that the traffic is authorized so an incident is not opened against your own test.

Result stores needing access control

Results live in SQLite on the host or in Azure SQL, and a chunked run's results show exactly which prompt fragments worked. That makes the database a map of your weaknesses, so it needs the same access control as other security test data. Restrict read access to the people who triage findings, encrypt the store where your policy requires it, and confirm the backup location before the database is copied anywhere.

Questions teams ask before testing chunked request attacks

What drives the cost of a chunked request test?

The cost follows the amount of configuration and analysis the test needs, not the attack itself. The main drivers are how complex the target is (a single chat endpoint or a multi-step application with session state), how many output filters sit in front of the model and need to be exercised, how the scorer is set up to judge whether a stitched answer reveals protected content, and how much reporting the audience expects. Cost is one-time for the test design and recurring only if you rerun the pass after each filter or model change. Ask any provider for a written scope that names the target, the filters in scope, the objectives, the scorer and the deliverables, then price against that list.

How long does a chunked request pilot take?

Duration depends on how quickly the team can reach the target and agree on what counts as a failure. The pilot usually covers a small set of approved objectives against one endpoint, with time spent on target access, scorer configuration, a few calibration runs and a review of the results. Delays most often come from waiting on test credentials, slow policy approval of objectives, or a target that needs session handling before multi-turn attacks work. Ask for a timeline that lists these dependencies separately so you can see which ones are yours to clear.

What must our team provide before testing starts?

Four inputs unblock most of the work:

Can our own engineers run chunked request tests without outside help?

Yes, if they have Python experience, can operate an API endpoint, and understand how the target filters and logs responses. PyRIT is an open-source framework installed with pip and documented for Python 3.13, which the documentation recommends. Engineers need to configure a target, choose an objective, set up a scorer and read the stored conversations in memory. The harder skill is judgment: deciding whether a stitched answer exposes protected content, and whether a failure is a real weakness or a scorer error. Teams without security testing experience often benefit from an outside review of their first results.

Is a chunked request pass enough evidence on its own?

No. A chunked request pass shows whether an output filter inspects only whole responses, which is one specific weakness. It does not show that the deployment is safe overall. Reviewers usually expect it alongside other attack types, such as multi-turn and single-turn tests, and with repeated runs so results are not a single lucky outcome. Record the objectives, configuration, scorer settings and stored conversations so an assessor can trace each finding. Confirm with your compliance team and any independent assessor which evidence they accept before you treat one pass as sufficient.

Which objectives and test data need approval before a chunked attack?

Objectives should be approved by the owner of the system and by whoever governs acceptable testing in your organization before any prompt is sent. Chunked requests aim at protected content, so the objective list needs to name what the model must not reveal and why the test is allowed. Keep the approved list in writing, restrict who can edit it, and store results under the same controls as other sensitive test output. Confirm your internal policy on testing production systems, since many teams test only in a staging environment that mirrors production filters.

Does DeployOpen run chunked request tests for us?

DeployOpen runs security testing of applications and AI systems, including AI and agent security review, and delivers findings with fixes and a retest. Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts, and quotes follow from that written scope. DeployOpen does not issue audit reports or certifications, so evidence from a test is an input to your own assessment rather than a certificate. Ask for the written scope first so you can compare it with running the pass in-house.

Turning a chunked result into a finding

A chunked run only becomes a finding if you can show exactly what was asked, what came back and how the filter handled each step. Record five things for every run: the objective, the chunk sequence as sent, the assembled output, the filter response on each turn, and the scorer verdict. Keep the conversation export with them, so a reviewer can replay the turns in order without rerunning the attack. PyRIT keeps conversations and results in its memory, which is SQLite or Azure SQL by default, so the export should come from that store rather than from a copied transcript. Write down the target configuration as well, including the model version, the system prompt, the filter settings and any deployment-side moderation, because a chunked result is only meaningful for that exact stack.

Read a success narrowly. If the scorer marks the assembled output as meeting the objective while each turn passed the filter, the evidence shows that the filter missed a fragmented answer on that configuration. It does not show that the model is unsafe in general, and it does not show which part of the pipeline failed unless you compare turns. Check whether the per-turn filter responses were all benign, and whether the scorer judged the assembled text rather than fragments. Confirm the scorer choice with its own accuracy checks before you report the verdict as settled.

Read a failure just as narrowly. A run that the filter blocked, or a run whose assembled output the scorer rejected, does not prove the system is safe against other chunking strategies. Different chunk sizes, orderings, languages or encodings can produce different filter behavior, so record the strategy used and list the strategies you did not try. A useful finding states the configuration tested, the objective, the evidence files, the verdict and the untested cases, and it names a retest after any filter or prompt change.

How DeployOpen works on this

DeployOpen plans and runs PyRIT-based security testing as a fixed-scope engagement, starting from the filters and endpoints you actually run. The work covers how chunked requests reach your target, which responses your filters inspect, and what evidence your team receives to fix and retest the gaps.

How we scope

  • Written scope names the target endpoints, the output filters in the path and the chunked request objectives to test.
  • Scope records whether the target is stateful or stateless, since that changes how each chunk is sent and scored.
  • Scope states which assessment evidence, retest rounds and report format the deliverables include before work starts.

How we build

  • We configure PyRIT against your target, connecting custom HTTP or WebSocket endpoints or web app targets where needed.
  • We build the multi-turn sequence that requests the answer in pieces and record each turn in PyRIT memory.
  • We score the assembled answer and each partial answer separately, so gaps in per-response inspection are visible.

How we hand over

  • You receive the test configuration, the chunked prompt sequences and the scorer settings as files your team can rerun.
  • The findings report explains which chunks passed the filter, which were blocked and where the assembled answer leaked.
  • We document recommended filter changes and retest them, and we hand over the conversation records for your review.

How we support

  • Ongoing support, upgrades and continuous testing are available as a retainer, which suits filters that change often.
  • A retainer can rerun the chunked request suite after each model, prompt or filter change in your environment.
  • Ask us to confirm which PyRIT release your environment supports before any upgrade, since releases change APIs.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.