Confirm ABC¶
pycodeloop.abc.confirm.Confirm
¶
Bases: ABC
Import
You can import the Confirm class with:
from pycodeloop.abc.confirm import Confirm
Gate a dangerous tool call behind a yes/no/redirect question. Pass
an instance to Agent(confirm=...) — a plain
Callable[[str, str], bool | str] still works too, Confirm just
gives pluggable implementations (CLI, chat, Slack bot, ...) a shared
interface instead of an ad-hoc function.
Source code in pycodeloop/abc/confirm.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
ask(name, preview)
abstractmethod
¶
Ask whether to run tool name, given a human-readable
preview of what it would do.
Return True to run it, False to skip it, or any other
non-empty string to skip it and feed that text back to the
model as a redirect.
Source code in pycodeloop/abc/confirm.py
22 23 24 25 26 27 28 29 30 | |