thunc
Open source Python library for calling LLMs as typed functions with validated return values.
thunc turns Python function signatures into LLM calls: docstrings provide instructions, parameters provide inputs, and return types define checked outputs. It supports Claude, OpenAI, local models, Claude Code, Codex, typed dataclasses, retries, caching, parallel mapping, and permissioned agents.
What thunc does
- Defines LLM prompts from Python docstrings
- Validates responses against return type annotations
- Supports dataclasses and nested typed outputs
- Retries responses that fail validation
- Provides agents with configurable folders and permissions