← All notes

Validation retries for LLM output: Instructor max_retries and Tenacity

Answer: Instructor treats bad output as a validation error with a clear message the system can use to self-correct. With the max_retries parameter you set the number of times you can reask the model to correct the output.

Two settings share one name

Tenacity

Tenacity adds retry logic with decorators such as @retry(stop=stop_after_attempt(3), wait=wait_exponential(multiplier=1, min=4, max=10)).

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: 567-labs/instructor (GitHub), Validation and reasking (Instructor docs), MIT (https://raw.githubusercontent.com/567-labs/instructor/main/LICENSE). Copyright (c) 2023 Jason Liu; 567-labs/instructor (GitHub), Retrying (Instructor docs), MIT (https://raw.githubusercontent.com/567-labs/instructor/main/LICENSE). Copyright (c) 2023 Jason Liu; jd/tenacity (GitHub), Tenacity documentation, Apache-2.0 (https://raw.githubusercontent.com/jd/tenacity/main/LICENSE). Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: 567-labs/instructor (GitHub), Validation and reasking (Instructor docs), MIT (https://raw.githubusercontent.com/567-labs/instructor/main/LICENSE). Copyright (c) 2023 Jason Liu; 567-labs/instructor (GitHub), Retrying (Instructor docs), MIT (https://raw.githubusercontent.com/567-labs/instructor/main/LICENSE). Copyright (c) 2023 Jason Liu; jd/tenacity (GitHub), Tenacity documentation, Apache-2.0 (https://raw.githubusercontent.com/jd/tenacity/main/LICENSE).

Cite this

Permanent ID: iil:note:4pf7e0qz

iinventedlight. 2026. "Validation retries for LLM output: Instructor max_retries and Tenacity." iinventedlight Library, iil:note:4pf7e0qz, version of 2026-11-16. https://iinventedlight.com/library/notes/ao-structured-instructor-validation-retries/. License: CC-BY-4.0.

@misc{iil_note_4pf7e0qz,
  author = {{iinventedlight}},
  title = {{Validation retries for LLM output: Instructor max\_retries and Tenacity}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-16},
  url = {https://iinventedlight.com/library/notes/ao-structured-instructor-validation-retries/},
  note = {Permanent ID iil:note:4pf7e0qz. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/ao-structured-instructor-validation-retries.md.