fabricatio-question
Interactive questioning extension for fabricatio agents. Generates LLM-driven selection prompts and presents them to users via terminal UI, enabling agents to gather structured feedback during planning and decision-making.
Installation
pip install fabricatio[question]
# or
uv pip install fabricatio[question]
For a full installation including all fabricatio components:
pip install fabricatio[full]
API
Capability: Questioning
Extends fabricatio_core.capabilities.propose.Propose. Mix into an agent to add interactive questioning.
| Method | Description |
|---|---|
async selection(q: str, k: int = 1, **kwargs) -> str | List[str] |
Generates a selection question via LLM, presents it interactively, and returns the user's choice(s). k=1 returns a single string; k>1 returns a list of up to k selections. |
async selection_string(q: str, k: int = 1, **kwargs) -> str |
Like selection(), but returns a formatted string with the question topic, options, and selected indices. |
Model: SelectionQuestion
A SketchedAble model representing an interactive selection prompt. Generated by the LLM from a user-provided topic.
| Field | Type | Description |
|---|---|---|
q |
str |
Question text displayed to the user. |
option |
List[str] |
Available choices. |
| Method | Description |
|---|---|
async single() -> str |
Presents a single-choice selection via questionary.select. |
async multiple(k: int = 0) -> List[str] |
Presents a multi-choice checkbox. When k > 0, validates that exactly k options are selected. |
Utilities
fabricatio_question.utils
| Function | Description |
|---|---|
async ask_retain(candidates: List[str]) -> List[str] |
Presents a checkbox list with all candidates pre-checked, returning the user's retained subset. |
async ask_retain(candidates, value_mapping) -> List[V] |
Overload that maps retained choices back through value_mapping. |
async ask_edit(text_seq: List[str]) -> List[str] |
Prompts the user to edit each string sequentially; only non-empty edits are returned. |
Configuration
All options below are read through the fabricatio configuration chain (see the
Configuration Guide). Set them under the
[ext.question] table in fabricatio.toml, equivalently under
[tool.fabricatio.ext.question] in pyproject.toml, or via
FABRICATIO_EXT__QUESTION__<FIELD_UPPER> environment variables.
[ext.question]
selection_template = "built-in/selection"
selection_display_template = "built-in/selection_display"
| Option | Type | Default | Description |
|---|---|---|---|
selection_template |
str |
"built-in/selection" |
Template name for selection question |
selection_display_template |
str |
"built-in/selection_display" |
Template name for selection display. |
Access at runtime: from fabricatio_question.config import question_config.
Usage
from fabricatio_question.capabilities.questioning import Questioning
class MyAgent(Questioning):
...
async def example():
agent = MyAgent()
# Single choice — returns a str
choice: str = await agent.selection("Pick a database backend")
# Multiple choices — returns list[str]
picks: list[str] = await agent.selection("Select features to enable", k=3)
# Get a formatted response string
result: str = await agent.selection_string("Choose a deployment target")
from fabricatio_question.utils import ask_retain, ask_edit
# Let the user prune a candidate list
kept: list[str] = await ask_retain(["auth", "caching", "logging", "metrics"])
# Let the user edit a list of strings in-place
edited: list[str] = await ask_edit(["step 1", "step 2", "step 3"])
Dependencies
fabricatio-core— core interfaces and capabilitiesquestionary>=2.1.0— interactive terminal prompts
License
MIT — see LICENSE
Metadata
Release files for fabricatio-question 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fabricatio_question-0.1.8-py3-none-any.whl | Python 3 | none | any | Details |
Release files / fabricatio_question-0.1.8-py3-none-any.whl
| Download URL | fabricatio_question-0.1.8-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5a082ac2cfbd29a03b2d872b183a0224bc4b20e37d7726d5fabb8383ac1e0e85
|
|
BLAKE2b-256 checksum How to use checksums |
779a0f6f693138181d8691b4e29ec01c685ccca76536fb4b15609c188feb60a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|