#1592·guardrails

1.0.0: kill reask; return the reask request as data on the outcome object

Author: zsimjeeCreated Jul 24, 2026Updated Sep 23, 2026
LabelsStale

Target: 1.0.0. Guardrails stops re-prompting the LLM itself. Instead, when validation fails in a way that warrants a retry, the outcome object carries the reask request as data and the caller decides whether to send it.

Directly resolves open questions #1 and #2 in #1591. Depends on the tagged-resolution outcome in guardrails-ai/guardrails-ai#11 — reask becomes a resolution variant with a payload rather than a control-flow mechanism.

Why this is the right call

  1. It makes Guard's LLM dependency optional. Nothing inside loops, so Guard no longer needs to own an LLM client. This is the precondition for Guard/Validator unification (guardrails-ai/guardrails-ai#12) — a guard built from v1 + v2 never had an LLM to reask with anyway.
  2. It collapses Runner. Runner.__call__ is the reask loop (guardrails/run/runner.py:142–186, do_loop at :493). Remove the loop and a runner is a single pass: build → call → parse → validate → resolve. That is plausibly the end of the 2×2 (runner / async_runner / stream_runner / async_stream_runner), because multi-attempt control flow is what makes the sync/async split so invasive.
  3. The server already behaves this way. guarded_chat_completion forces num_reasks=0 — the OpenAI-compatible endpoint, our highest-traffic server path, does not reask today. This aligns the SDK with shipped behavior rather than inventing new behavior.
  4. Reask is already incompatible with streaming (stream_runner.py raises "Reasks are not yet supported with streaming"; sequential_validator_service.py:328 rejects REASK outright). Removing it deletes an axis of divergence rather than papering over it.
  5. Hidden cost is the #1448 problem in the money dimension. A single guard() call silently issuing N extra LLM calls is exactly the kind of invisible behavior the issue objects to. Returning the prompt puts budget control with whoever pays for it — and in an agent loop the caller already owns retry, budget, and accounting.
  6. It fixes a confusing field. ValidationOutcome.reask currently means "the reask we would have sent if budget remained." As a resolution variant it becomes coherent.

What we actually lose — needs decisions, not hand-waving

1. Subschema reask and response merging. This is the real cost. Today guardrails can reask only the failed fields and merge the response back into the previously-good output: get_reask_subschema (actions/reask.py:69), prune_obj_for_reasking (:130), merge_reask_output (:584), update_reasked_elements (:609), gated by full_schema_reask. If the caller re-prompts, they receive a partial response and must merge it themselves — realistically nobody will. Options:

  • Ship the merge as a public helper on the outcome (e.g. outcome.merge_retry(new_llm_output)), keeping the logic but inverting who drives it.
  • Return only the full-schema reask and drop partial reasking entirely (simpler; more tokens per retry).
  • Return the pruned subschema in the payload so the caller's next request is well-formed by construction.

2. We are not deleting 639 lines. The prompt builders must survive to produce what we return: get_reask_setup_for_string (:205), get_reask_setup_for_json (:293), get_reask_setup (:450), plus the templates in constants.xml (high_level_json_reask_prompt, high_level_skeleton_reask_prompt, high_level_json_parsing_reask_prompt, high_level_string_reask_prompt). The win is removing control flow, not prompt logic. Two of the six templates (high_level_xml_reask_prompt, high_level_xml_parsing_reask_prompt) die with #1590 regardless.

3. FIX_REASK and the parse-failure reasks. FIX_REASK (fix → recheck → reask if still failing) becomes "fix, recheck, return a reask resolution." SkeletonReAsk and NonParseableReAsk become resolution variants too. All are on_fail enum semantics changes — coordinate with the on_fail question in #1591.

4. DX regression for the simple case. guard(..., num_reasks=2) currently just works for one-shot scripts; those users now write a loop. Mitigation: a small opt-in convenience (guard.with_retry(llm) or a guardrails.retry(...) helper) that lives outside the core and is explicitly sugar — so the core stays LLM-free without regressing the happy path.

5. num_reasks is public API in three places. Guard.__call__ / configure() / parse() (guard.py:201, 285, 491), the server's /guards/{id}/validate request body, and persisted guard configs. Removal is a wire-format change, not just an SDK one.

Design questions

  • What exactly is returned? A rendered prompt string is not sufficient for structured output, because reask today also modifies the output schema. The payload likely needs messages + (sub)schema + which paths failed.
  • Does it include the original messages or just the delta? (get_original_prompt at :278 exists for this.)
  • Is the payload inspectable and editable, or opaque? Callers will want to modify it before sending.
  • Attempt correlation is an observability regression to design for. If the caller loops, each attempt is a fresh call_id with no linkage, whereas today the attempts are Iterations inside one Call. Do we need parent_call_id / an attempt chain so history and traces stay coherent?
  • Does Iteration survive? The Call → Iteration[] layer exists because of reasks. With one attempt per call, that layer collapses — a simplification, but it's where multi-attempt correlation currently lives.

Source: guardrails-ai/guardrails