Skip to main content Switch to mobile version cli-interview-kit 0.2.1 Python CLIs whose prompts are declared once and answered at the terminal, by flags, or by an AI assistant.
pip install cli-interview-kit==0.2.1 Copy PIP instructions
Build Python command-line tools whose prompts are declared once and answered in three ways:
at the terminal, as an interview that validates every answer and asks again until it is right;
by flags, because every question has one, so the same command runs in CI and scripts;
by an AI assistant: --questions prints the interview as JSON, the assistant asks the user in its own chat and runs the command with their answers.
from cli_interview_kit import App, Command, Interview, Question NEW = Command( name="new", help="Create a project.", interview=Interview( questions=( Question( key="name", section="project", kind="text", prompt="Project name", help="The project's name.", required=True, ), Question( key="template", section="project", kind="select", prompt="Template", help="What the project starts from.", choices=("library", "service"), default="library", ), ), ), run=lambda invocation: print(invocation.answers), ) APP = App(name="projects", description="Create projects.", version="1.0.0", commands=(NEW,)) if __name__ == "__main__": raise SystemExit(APP.main()) $ projects new # a person at a terminal is interviewed ? Project name demo ? Template service {'name': 'demo', 'template': 'service'} $ projects new --yes --name demo # nobody to ask: flags and defaults {'name': 'demo', 'template': 'library'} $ projects new --yes # an answer with no safe default fails ERROR --name is required: it has no safe default, so pass it when the run cannot prompt. $ projects new --questions # what an AI assistant reads { "version": 1, "command": "projects new --yes", "procedure": [...], "questions": [...] } Status: alpha (0.x). The API may change between minor versions; see the changelog.
uv add cli-interview-kit # or: pip install cli-interview-kit Requires Python 3.11 or newer, on Linux, macOS or Windows. It builds on argparse, questionary and rich.
A complete example using every feature is in examples/projects.py. From a clone, run just example new or just example new --questions.
The run function receives an Invocation with the answers, the options, the console to print and ask through, and the interaction to pass to Consent.ask.
A question can also have:
conditions: when_all=(when("template", "service"),) asks it only when an earlier answer, an option or a derived fact matches. A flag for a question that does not apply fails the run.
a default, which may reference earlier answers (default="{name}_pkg"), or a default_from source. required=True means it has no safe default.
a validator: any function that returns the value or raises ValueError with a message. Built in: non_empty, whole_number, byte_size.
dynamic values: choices_from, items_from and suggestions_from name a function in Interview.choices that returns the current values. suggestions_from lists values under a free-text input as you type, without enforcing them.
a group: questions with safe defaults can share a group, so an assistant asks "keep these defaults?" once instead of asking each.
Mistakes in a declaration, such as a select without choices or a reference to an undeclared source, raise pydantic's ValidationError when the module is imported, not when a user runs the command.
Each run decides once whether it may prompt: it may when stdin is a terminal and --yes was not given.
At a terminal, each applicable question its flag did not answer is asked. An invalid answer shows its error under the input and is asked again.
When nobody can be asked (--yes, CI, a pipe), each question takes its default. One with no safe default fails the run, naming its flag.
Consents are given by --yes. Without it they are asked at a terminal; with nobody to ask, a consent with a safe_default takes it, and any other fails the run, asking for --yes. A piped stdin never consents by itself. Asking for a consent the command did not declare raises DeclarationError, so --questions always lists every consent.
--questions prints the command's interview as a JSON document: every question with its choices, defaults, conditions and current local values, the groups, the consents, the plain options, and a procedure for the assistant to follow. Any assistant that can run a shell command can use it, whichever product it is:
It runs projects new --questions.
It asks the user the questions in its own chat, skipping those whose conditions do not hold, and describes each consent.
It runs projects new --yes --name demo --template service. If the command rejects a value, it asks that question again.
Point your assistant at the command in your repository's agent instructions, for example: "To create a project, run projects new --questions and follow its procedure." The document has a version, raised when a field changes meaning or is removed.
A command's annotations (free-form strings, e.g. {"myapp.agent": "hand-off"}) appear in the document as they are. The kit never interprets them; they let the app built on it tell an assistant things the kit has no opinion on, such as whether it may run the command itself.
Console.print writes a command's result to stdout. Status lines (info, success, warning, error) and progress bars go to stderr, so output can be piped. Status lines are plain text: values a user typed are never interpreted as rich markup.
Documentation: the API reference, generated from the docstrings, plus requirements, design and the changelog.
Requirements: what the package must do, what it deliberately does not, and how each is verified.
Design: how it works, the module map, decisions and trade-offs.
Contributing: setup, checks and the release process.
Security: how to report a vulnerability.
Released: Dec 1, 2026
Author: Northbridge Capital
Both files in this release have provenance metadata.
View provenance details
MIT View SPDX License List
ai-agents argparse cli interactive prompts questionary rich
Development Status 3 - Alpha
Intended Audience Developers
Operating System OS Independent
Programming Language Python :: 3
Topic Software Development :: Libraries :: Application Frameworks
Software Development :: User Interfaces
Release files for cli-interview-kit 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
Built distribution (wheel)
Total release size: 117.3 kB
Release files / cli_interview_kit-0.2.1.tar.gz
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 Dec 1, 2026.
Release files / cli_interview_kit-0.2.1-py3-none-any.whl
Security for cli-interview-kit 0.2.1
Both files in this release have been uploaded with provenance metadata.
With provenance cli_interview_kit-0.2.1.tar.gz Dec 1, 2026
Attestation for cli_interview_kit-0.2.1.tar.gz
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
Dec 1, 2026 2 release files Full provenance
Nov 28, 2026 2 release files Full provenance
Nov 27, 2026 2 release files Full provenance
"PyPI", "Python Package Index", and the blocks logos are registered trademarks of the Python Software Foundation.
© 2026 Python Software Foundation
Deployed from a8e35ed











