ADR 014: Command-Line Interface and Structured Logging Architecture¶
Context¶
Operators and automation pipelines require a command-line interface to inspect, validate, run, and resume workflows without writing Python driver scripts. Additionally, observability requires structured logging without imposing unwanted logging configurations on embedded library users.
Options Considered¶
- Third-party CLI frameworks (e.g. Click, Typer, Rich):
- Tradeoff: Violates the zero-runtime-dependencies core design philosophy.
- Standard library
argparseandlogging.NullHandler(Chosen): - Provide CLI entry points via
[project.scripts] orchestration-engine = "orchestration_engine.cli:main"andpython -m orchestration_engine. - Implement commands:
validate,run,resume,status,history,runs. - Contracted exit codes:
0(succeeded),1(workflow failed),2(usage/definition error),3(internal error). - Stable machine-readable
--jsonoutput for automation scripts. - Dynamic runner resolution via
importlib.import_modulewith current working directory prepended tosys.path. - Library logger
orchestration_engineconfigured withNullHandler(). Transitions logged at INFO, retries/timeouts at WARNING, database errors at ERROR, with structuredextrafields. CLI enables global logging only when--log-levelis explicitly provided.
Decision¶
- Build
orchestration_engine.cliusingargparse. - Add
orchestration_engine/__main__.py. - Configure
logging.NullHandler()on library logger in__init__.py. - Document CLI contracts and exit codes in
docs/cli.md.
Consequences¶
- Zero runtime dependencies maintained.
- Standardized exit codes and JSON output allow reliable pipeline automation.
- Safe library logging avoids hijacking client application logging configurations.