Skip to content

Build AI methods with your coding agent, then run them anywhere: as an MCP for chatbots, as a webapp for people, or via API for your software.

Release v0.30.1

Louis Choquel6902952c1e0e
diff --git a/.badges/tests.json b/.badges/tests.json
index b9906d3bf..75fad69de 100644
--- a/.badges/tests.json
+++ b/.badges/tests.json
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
"label": "tests",
- "message": "6111",
+ "message": "6112",
"color": "blue",
"cacheSeconds": 300
}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b5dd93758..e0c8ebaac 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,19 @@
# Changelog
+## [v0.30.1] - 2026-05-25
+
+### Fixed
+
+- **`pipelex-agent` now silences all pipelex logs on stderr regardless of user TOML.** The agent CLI is machine-consumed: stdout is reserved for the structured success envelope (JSON / markdown) and stderr for the structured error envelope. Free-floating `log.*` calls — even a single `log.debug` from `telemetry_factory.py` or a `log.warning` from `validation_error_categorizer.py` — would corrupt the stderr channel for downstream parsers (`mthds-js`'s `PipelexRunner` doing `JSON.parse(stderr)` on the validate hook). `make_pipelex_for_agent_cli` now injects `config_overrides` into `Pipelex.make()` that pin `default_log_level = OFF` and `package_log_levels.pipelex = OFF` from the very first `log.configure` call — so a user setting `[pipelex.log_config.package_log_levels] pipelex = "DEBUG"` in `~/.pipelex/pipelex.toml` can no longer leak DEBUG/INFO/WARNING lines onto the agent CLI's stderr channel. The DEBUG log line in `telemetry_factory.py:77` itself is unchanged — it's still useful diagnostic info for the human `pipelex` CLI.
+
+### Changed
+
+- **`pipelex-agent` no longer accepts `--log-level`.** Log suppression is unconditional by design — there is no verbosity setting on the agent CLI. The `log_level` parameter is removed from `make_pipelex_for_agent_cli()` and `apply_agent_cli_output_discipline()`, and the corresponding `ctx.obj["log_level"]` plumbing is gone from every caller. For verbose debugging, use the human `pipelex` CLI, which honors the user's TOML log config.
+
+- **`pipelex/cli/commands/doctor_cmd.py::setup_doctor_runtime` now `deep_update`s `log_config_overrides` into the loaded config** (was a flat-merge that silently replaced nested dicts like `package_log_levels`). With the flat merge, pinning `package_log_levels.pipelex = OFF` for the agent doctor path would have wiped out all the third-party package levels (`anthropic`, `asyncio`, `botocore`, ...) shipped in the default config. The deep merge preserves them.
+
+- **Removed `ctx: typer.Context` from 8 agent CLI commands that no longer used it.** `validate/{pipe,bundle,method}_cmd.py`, `inputs/{pipe,bundle,method}_cmd.py`, `models_cmd.py`, `check_model_cmd.py` had `ctx.obj["log_level"]` as their only ctx usage; with `--log-level` gone, the parameter became dead weight. The `run/` commands keep `ctx` because they still read `ctx.obj["runner"]`. Test callers (and the now-unused `agent_ctx` conftest fixture) updated to match.
+
## [v0.30.0] - 2026-05-25
### Fixed
diff --git a/pipelex/cli/agent_cli/_agent_cli.py b/pipelex/cli/agent_cli/_agent_cli.py
index d0ce6e861..a5f8b4072 100644
--- a/pipelex/cli/agent_cli/_agent_cli.py
+++ b/pipelex/cli/agent_cli/_agent_cli.py
@@ -21,7 +21,6 @@ from pipelex.cli.agent_cli.commands.models_cmd import agent_models_cmd
from pipelex.cli.agent_cli.commands.pipe_cmd import pipe_cmd
from pipelex.cli.agent_cli.commands.run.app import run_app
from pipelex.cli.agent_cli.commands.validate.app import validate_app
-from pipelex.tools.log.log_levels import LogLevel
from pipelex.tools.misc.package_utils import get_package_version
@@ -91,31 +90,25 @@ def app_callback(
is_eager=True,
),
] = False,
- log_level: Annotated[
- str,
- typer.Option("--log-level", help="Log verbosity level (debug, verbose, info, warning, error, critical)."),
- ] = "warning",
runner: Annotated[
str,
typer.Option("--runner", help="Runner to use: 'pipelex' (local) or 'api' (remote MTHDS API)."),
] = "pipelex",
) -> None:
- """Agent CLI callback - no logo, minimal output."""
+ """Agent CLI callback - no logo, minimal output.
+
+ Note: there is no ``--log-level`` flag. ``pipelex-agent`` is machine-consumed:
+ stdout is reserved for the success envelope and stderr for the error envelope.
+ Free-floating logs would corrupt those channels, so pipelex's logs are silenced
+ unconditionally by the factory. For verbose debugging, use the human ``pipelex``
+ CLI instead.
+ """
# Reset the error-format ContextVar at the single choke point every command passes through, so
# a markdown command cannot leak markdown into a later JSON-only command in the same process.
# --format / --error-format commands override this afterwards; JSON-only commands keep the JSON default.
set_agent_cli_error_format(CliOutputFormat.JSON)
ctx.ensure_object(dict)
- try:
- ctx.obj["log_level"] = LogLevel(log_level.upper())
- except ValueError:
- valid_values = ", ".join(level.value.lower() for level in LogLevel)
- agent_error(
- f"Invalid log level '{log_level}'. Valid values: {valid_values}",
- "ArgumentError",
- )
-
try:
ctx.obj["runner"] = RunnerType(runner)
except ValueError:
diff --git a/pipelex/cli/agent_cli/commands/agent_cli_factory.py b/pipelex/cli/agent_cli/commands/agent_cli_factory.py
index aac4c228b..4724ce0c2 100644
--- a/pipelex/cli/agent_cli/commands/agent_cli_factory.py
+++ b/pipelex/cli/agent_cli/commands/agent_cli_factory.py
@@ -29,61 +29,75 @@ from pipelex.tools.log.log_levels import LogLevel
from pipelex.tools.misc.pretty import PrettyPrinter, PrettyPrintMode
# Canonical leaf dict for "for any agent-CLI invocation, both Rich-managed channels land
-# on stderr." Composed by two distinct call sites:
-# - ``_AGENT_CLI_STDERR_CONSOLE_OVERRIDES`` below wraps it in the full-config-tree shape
-# required by ``Pipelex.make(config_overrides=...)`` for the full-init path.
+# on stderr AND all pipelex logs are silenced from the very first ``log.configure`` call."
+# Consumed by:
+# - ``AGENT_CLI_CONFIG_OVERRIDES`` below wraps it in the full-config-tree shape required
+# by ``Pipelex.make(config_overrides=...)`` for the full-init path.
# - ``pipelex.cli.agent_cli.commands.doctor_cmd`` passes it flat to
# ``setup_doctor_runtime(log_config_overrides=...)`` for the doctor-only path that
# does not go through ``Pipelex.make``.
#
-# These two knobs only control Rich-managed diagnostic channels — NOT the agent CLI's
-# data channel:
+# Four knobs:
# - ``console_log_target`` -> the ``RichHandler`` for Python's logging system
# (``log.debug/info/warning/error``).
# - ``console_print_target`` -> the ``Console`` returned by ``get_console()`` and used
# for banners, deck notices, and the main ``pipelex`` CLI's
# ``show backends`` / ``show models`` tables.
+# - ``default_log_level`` -> root-logger level. Pinned at OFF so any third-party
+# package that inherits root (no explicit override) is
+# fully silenced.
+# - ``package_log_levels`` -> per-package overrides. ``pipelex`` is pinned at OFF here;
+# deep-merged into the user's config, so third-party
+# package levels (anthropic, asyncio, ...) are preserved.
#
-# The agent CLI's actual results (the JSON / markdown success envelope) are written by
-# ``agent_success`` / ``agent_success_formatted`` in ``agent_output.py`` via the bare
-# builtin ``print(...)`` straight to ``sys.stdout``. They do NOT go through Rich, so they
-# are unaffected by these overrides. Error envelopes go via ``print(..., file=sys.stderr)``
-# — also bypassing Rich.
+# Why silence all pipelex logs? The agent CLI is machine-consumed. Its contract is:
+# stdout = structured success envelope (JSON or markdown), stderr = structured error
+# envelope. ANY log line on stderr — DEBUG, INFO, WARNING, anything — corrupts the
+# error-envelope channel for downstream parsers (e.g. mthds-js's ``PipelexRunner``
+# doing ``JSON.parse(stderr)``). This is not a verbosity setting; it's the design.
+# There is no ``--log-level`` escape hatch on ``pipelex-agent``: when debugging is
+# needed, use the human ``pipelex`` CLI instead.
#
-# Pinning both targets to ``stderr`` therefore ensures that EVERYTHING ELSE Pipelex might
-# emit (setup-time ``log.debug`` from ``telemetry_factory.py``, a banner from
-# ``deck_notice.py``, any future ``get_console().print(...)`` on the agent CLI setup path)
-# lands on stderr regardless of what the user's ``~/.pipelex/pipelex.toml`` says — so the
-# JSON data channel on stdout stays clean for downstream consumers like ``mthds-js``'s
-# ``PipelexRunner`` that do ``JSON.parse(stdout)``.
+# The agent CLI's actual results are written by ``agent_success`` /
+# ``agent_success_formatted`` via the bare builtin ``print(...)`` to ``sys.stdout``;
+# error envelopes via ``print(..., file=sys.stderr)``. Both bypass Rich entirely, so
+# the OFF-level pin has no effect on the structured envelopes — only on free-floating
+# ``log.*`` calls scattered through the codebase.
#
# Wrapped in ``MappingProxyType`` so a stray ``AGENT_CLI_STDERR_LOG_FIELDS[...] = ...`` in
# a future contributor's hot-fix raises immediately instead of silently mutating the
-# shared canonical instance (which both consumers below alias).
+# shared canonical instance.
AGENT_CLI_STDERR_LOG_FIELDS: Mapping[str, Any] = MappingProxyType(
{
"console_log_target": ConsoleTarget.STDERR,
"console_print_target": ConsoleTarget.STDERR,
+ "default_log_level": LogLevel.OFF,
+ "package_log_levels": MappingProxyType({"pipelex": LogLevel.OFF}),
}
)
-# Direct alias: deep_update recurses into any ``Mapping`` and converts frozen leaves to
-# plain dicts at merge time, so referencing the canonical ``MappingProxyType`` here is
-# safe AND keeps mutation attempts on either reference loud (TypeError on the frozen
-# proxy) instead of silently diverging.
-_AGENT_CLI_STDERR_CONSOLE_OVERRIDES: dict[str, Any] = {
- "pipelex": {"log_config": AGENT_CLI_STDERR_LOG_FIELDS},
-}
+# Full ``config_overrides`` tree for ``Pipelex.make()``. ``deep_update`` recurses into
+# ``package_log_levels``, so the ``pipelex = OFF`` entry merges into the user's config
+# without wiping out third-party package levels. Frozen so callers can't mutate it.
+AGENT_CLI_CONFIG_OVERRIDES: Mapping[str, Any] = MappingProxyType(
+ {
+ "pipelex": MappingProxyType(
+ {
+ "log_config": AGENT_CLI_STDERR_LOG_FIELDS,
+ },
+ ),
+ }
+)
-def apply_agent_cli_output_discipline(log_level: LogLevel = LogLevel.WARNING) -> None:
- """Pin pipelex log level, pretty-print silence, and hub console target to stderr.
+def apply_agent_cli_output_discipline() -> None:
+ """Pin pipelex log level to OFF, silence pretty-print, and hub console target to stderr.
Called from two paths:
- ``make_pipelex_for_agent_cli`` (full-init): defense-in-depth. ``Pipelex.__init__``
already pinned the hub console via ``set_console_print_target`` from the loaded
log_config (whose ``console_print_target`` was overridden to STDERR by
- ``_AGENT_CLI_STDERR_CONSOLE_OVERRIDES``).
+ ``AGENT_CLI_CONFIG_OVERRIDES``, which also pinned the pipelex log level to OFF).
- ``agent_doctor_cmd`` (doctor-only): also defense-in-depth, since
``setup_doctor_runtime`` now mirrors ``Pipelex.__init__`` and applies
``set_console_print_target`` itself from the overridden log_config.
@@ -92,7 +106,7 @@ def apply_agent_cli_output_discipline(log_level: LogLevel = LogLevel.WARNING) ->
skipped: ``log.redirect_to_stderr`` no-ops when no rich_handler is registered, and
the hub print-target call is gated on a hub being installed.
"""
- log.set_level_for_package("pipelex", log_level)
+ log.set_level_for_package("pipelex", LogLevel.OFF)
log.redirect_to_stderr()
PrettyPrinter.mode = PrettyPrintMode.SILENT
hub = PipelexHub.get_optional_instance()
@@ -102,7 +116,6 @@ def apply_agent_cli_output_discipline(log_level: LogLevel = LogLevel.WARNING) ->
def make_pipelex_for_agent_cli(
library_dirs: list[str] | list[Path] | None = None,
- log_level: LogLevel = LogLevel.WARNING,
needs_inference: bool = True,
needs_model_specs: bool | None = None,
) -> Pipelex:
@@ -117,23 +130,26 @@ def make_pipelex_for_agent_cli(
human-readable markdown to stdout and exits 0, so the calling agent
can display setup guidance directly.
- Stdout contract: every ``pipelex-agent`` invocation reserves stdout exclusively
- for the structured success envelope (JSON via ``--format json``, or markdown via
- ``--format markdown``) emitted by ``agent_success`` / ``agent_success_formatted``.
- All other output channels — logs, ``get_console().print(...)`` output, Rich pretty
- prints, and ``agent_error`` envelopes — are pinned to stderr regardless of what the
- user's ``pipelex.toml`` says. The factory enforces this via three layers:
-
- 1. ``config_overrides`` injected into ``Pipelex.make()`` pins both
- ``console_log_target`` and ``console_print_target`` to ``stderr`` from the
- very first log/print fired during init.
+ Stdout / stderr contract: every ``pipelex-agent`` invocation reserves stdout
+ exclusively for the structured success envelope (JSON via ``--format json``, or
+ markdown via ``--format markdown``) emitted by ``agent_success`` /
+ ``agent_success_formatted``, and stderr exclusively for the structured error
+ envelope from ``agent_error``. NO free-floating logs are emitted on either channel,
+ regardless of what the user's ``pipelex.toml`` says. The factory enforces this via:
+
+ 1. ``AGENT_CLI_CONFIG_OVERRIDES`` injected into ``Pipelex.make()`` pins
+ ``console_log_target`` and ``console_print_target`` to ``stderr`` AND silences
+ pipelex's logs (``default_log_level = OFF``, ``package_log_levels.pipelex = OFF``)
+ from the very first ``log.configure`` call — so DEBUG/INFO/WARNING setup chatter
+ (e.g. ``telemetry_factory.py``'s ``log.debug``, ``validation_error_categorizer``'s
+ ``log.warning``) never reaches the handler, even when the user's
+ ``~/.pipelex/pipelex.toml`` sets ``pipelex = "DEBUG"``.
2. ``PrettyPrinter.mode = SILENT`` neutralizes ``pretty_print(...)`` entirely.
3. Post-init ``log.redirect_to_stderr()`` and
``get_pipelex_hub().set_console_print_target(STDERR)`` defense-in-depth.
Args:
library_dirs: Optional library directories to use for the Pipelex instance.
- log_level: Log verbosity level (default WARNING for silent agent output).
needs_inference: When False, skip inference setup (credentials, gateway, telemetry).
needs_model_specs: When True, load real model specs even without inference.
@@ -152,7 +168,7 @@ def make_pipelex_for_agent_cli(
library_dirs=library_dirs,
needs_inference=needs_inference,
needs_model_specs=needs_model_specs,
- config_overrides=_AGENT_CLI_STDERR_CONSOLE_OVERRIDES,
+ config_overrides=dict(AGENT_CLI_CONFIG_OVERRIDES),
)
# Surface a structured ``RemoteConfigStale`` entry so JSON consumers can react to
# stale-cache operation without parsing stderr.
@@ -209,7 +225,8 @@ def make_pipelex_for_agent_cli(
hint="Initialization failed. Run 'pipelex-agent doctor' to diagnose, or 'pipelex init config' to reset configuration",
)
- # Suppress Rich pretty-printing and INFO/DEV/DEBUG log noise so that agent
- # commands only emit structured JSON. Warnings and errors still reach stderr.
- apply_agent_cli_output_discipline(log_level=log_level)
+ # Silence pipelex logs and Rich pretty-printing so the agent CLI emits only the
+ # structured success/error envelope. Defense-in-depth on top of the init-time
+ # config_overrides.
+ apply_agent_cli_output_discipline()
return pipelex_instance
diff --git a/pipelex/cli/agent_cli/commands/check_model_cmd.py b/pipelex/cli/agent_cli/commands/check_model_cmd.py
index 774ae76ee..8a1ea9652 100644
--- a/pipelex/cli/agent_cli/commands/check_model_cmd.py
+++ b/pipelex/cli/agent_cli/commands/check_model_cmd.py
@@ -51,7 +51,6 @@ def _format_check_markdown(result: dict[str, Any]) -> str:
def agent_check_model_cmd(
- ctx: typer.Context,
name: Annotated[
str,
typer.Argument(help="Model reference to check (e.g. $writing-creative, @best-claude, gpt-4o)"),
@@ -76,7 +75,7 @@ def agent_check_model_cmd(
"""
set_agent_cli_error_format(error_format or output_format)
try:
- make_pipelex_for_agent_cli(log_level=ctx.obj["log_level"], needs_inference=False, needs_model_specs=True)
+ make_pipelex_for_agent_cli(needs_inference=False, needs_model_specs=True)
model_deck = get_model_deck()
ref = ModelReference.parse(name)
diff --git a/pipelex/cli/agent_cli/commands/inputs/bundle_cmd.py b/pipelex/cli/agent_cli/commands/inputs/bundle_cmd.py
index fe2e6c4b8..be6bd36d4 100644
--- a/pipelex/cli/agent_cli/commands/inputs/bundle_cmd.py
+++ b/pipelex/cli/agent_cli/commands/inputs/bundle_cmd.py
@@ -21,7 +21,6 @@ from pipelex.pipeline.validate_bundle import ValidateBundleError
def inputs_bundle_cmd(
- ctx: typer.Context,
path: Annotated[
str,
typer.Argument(help="Path to a .mthds bundle file or a pipeline directory"),
@@ -84,7 +83,7 @@ def inputs_bundle_cmd(
pipe_code: str | None = pipe
library_dirs = [Path(lib_dir) for lib_dir in library_dir] if library_dir else None
- make_pipelex_for_agent_cli(library_dirs=library_dirs, log_level=ctx.obj["log_level"], needs_inference=False, needs_model_specs=True)
+ make_pipelex_for_agent_cli(library_dirs=library_dirs, needs_inference=False, needs_model_specs=True)
try:
result = asyncio.run(inputs_core(pipe_code=pipe_code, bundle_path=Path(bundle_path), library_dirs=library_dirs)) # type: ignore[arg-type]
diff --git a/pipelex/cli/agent_cli/commands/inputs/method_cmd.py b/pipelex/cli/agent_cli/commands/inputs/method_cmd.py
index e1e0c2db6..acc808d0a 100644
--- a/pipelex/cli/agent_cli/commands/inputs/method_cmd.py
+++ b/pipelex/cli/agent_cli/commands/inputs/method_cmd.py
@@ -20,7 +20,6 @@ from pipelex.pipeline.validate_bundle import ValidateBundleError
def inputs_method_cmd(
- ctx: typer.Context,
name: Annotated[
str,
typer.Argument(help="Name of the installed method"),
@@ -56,7 +55,7 @@ def inputs_method_cmd(
if library_dir:
library_dirs_paths.extend(Path(lib_dir) for lib_dir in library_dir)
- make_pipelex_for_agent_cli(library_dirs=library_dirs_paths, log_level=ctx.obj["log_level"], needs_inference=False, needs_model_specs=True)
+ make_pipelex_for_agent_cli(library_dirs=library_dirs_paths, needs_inference=False, needs_model_specs=True)
try:
result = asyncio.run(inputs_core(pipe_code=pipe_code, bundle_path=bundle_path, library_dirs=library_dirs_paths))
diff --git a/pipelex/cli/agent_cli/commands/inputs/pipe_cmd.py b/pipelex/cli/agent_cli/commands/inputs/pipe_cmd.py
index 7906809df..531217333 100644
--- a/pipelex/cli/agent_cli/commands/inputs/pipe_cmd.py
+++ b/pipelex/cli/agent_cli/commands/inputs/pipe_cmd.py
@@ -21,7 +21,6 @@ from pipelex.pipeline.validate_bundle import ValidateBundleError
def inputs_pipe_cmd(
- ctx: typer.Context,
pipe_code: Annotated[
str,
typer.Argument(help="Pipe code to get inputs for"),
@@ -64,7 +63,7 @@ def inputs_pipe_cmd(
library_dir = [*export_dirs, *library_dir]
library_dirs = [Path(lib_dir) for lib_dir in library_dir] if library_dir else None
- make_pipelex_for_agent_cli(library_dirs=library_dirs, log_level=ctx.obj["log_level"], needs_inference=False, needs_model_specs=True)
+ make_pipelex_for_agent_cli(library_dirs=library_dirs, needs_inference=False, needs_model_specs=True)
try:
result = asyncio.run(inputs_core(pipe_code=pipe_code, bundle_path=None, library_dirs=library_dirs))
diff --git a/pipelex/cli/agent_cli/commands/models_cmd.py b/pipelex/cli/agent_cli/commands/models_cmd.py
index 2901f630f..e39285827 100644
--- a/pipelex/cli/agent_cli/commands/models_cmd.py
+++ b/pipelex/cli/agent_cli/commands/models_cmd.py
@@ -11,7 +11,6 @@ from pipelex.pipelex import Pipelex
def agent_models_cmd(
- ctx: typer.Context,
model_type: Annotated[
list[ModelCategory] | None,
typer.Option("--type", "-t", help="Filter by model category (repeatable): llm, extract, img_gen, search"),
@@ -36,7 +35,7 @@ def agent_models_cmd(
"""
set_agent_cli_error_format(error_format or output_format)
try:
- make_pipelex_for_agent_cli(log_level=ctx.obj["log_level"], needs_inference=False, needs_model_specs=backend is not None)
+ make_pipelex_for_agent_cli(needs_inference=False, needs_model_specs=backend is not None)
result = list_models(categories=model_type, backend=backend)
diff --git a/pipelex/cli/agent_cli/commands/run/bundle_cmd.py b/pipelex/cli/agent_cli/commands/run/bundle_cmd.py
index c5376d232..67666ac96 100644
--- a/pipelex/cli/agent_cli/commands/run/bundle_cmd.py
+++ b/pipelex/cli/agent_cli/commands/run/bundle_cmd.py
@@ -187,7 +187,7 @@ def run_bundle_cmd(
agent_error(str(exc), type(exc).__name__, cause=exc)
case RunnerType.PIPELEX:
- make_pipelex_for_agent_cli(log_level=ctx.obj["log_level"], needs_inference=not dry_run, needs_model_specs=True)
+ make_pipelex_for_agent_cli(needs_inference=not dry_run, needs_model_specs=True)
try:
result = asyncio.run(
diff --git a/pipelex/cli/agent_cli/commands/run/method_cmd.py b/pipelex/cli/agent_cli/commands/run/method_cmd.py
index b03a877b3..baf865654 100644
--- a/pipelex/cli/agent_cli/commands/run/method_cmd.py
+++ b/pipelex/cli/agent_cli/commands/run/method_cmd.py
@@ -144,7 +144,7 @@ def run_method_cmd(
agent_error(str(exc), type(exc).__name__, cause=exc)
case RunnerType.PIPELEX:
- make_pipelex_for_agent_cli(log_level=ctx.obj["log_level"], needs_inference=not dry_run, needs_model_specs=True)
+ make_pipelex_for_agent_cli(needs_inference=not dry_run, needs_model_specs=True)
try:
result = asyncio.run(
diff --git a/pipelex/cli/agent_cli/commands/run/pipe_cmd.py b/pipelex/cli/agent_cli/commands/run/pipe_cmd.py
index cd983b596..58ba84ae3 100644
--- a/pipelex/cli/agent_cli/commands/run/pipe_cmd.py
+++ b/pipelex/cli/agent_cli/commands/run/pipe_cmd.py
@@ -141,7 +141,7 @@ def run_pipe_cmd(
agent_error(str(exc), type(exc).__name__, cause=exc)
case RunnerType.PIPELEX:
- make_pipelex_for_agent_cli(log_level=ctx.obj["log_level"], needs_inference=not dry_run, needs_model_specs=True)
+ make_pipelex_for_agent_cli(needs_inference=not dry_run, needs_model_specs=True)
try:
result = asyncio.run(
diff --git a/pipelex/cli/agent_cli/commands/validate/bundle_cmd.py b/pipelex/cli/agent_cli/commands/validate/bundle_cmd.py
index 09986985e..5fe4fdf08 100644
--- a/pipelex/cli/agent_cli/commands/validate/bundle_cmd.py
+++ b/pipelex/cli/agent_cli/commands/validate/bundle_cmd.py
@@ -33,7 +33,6 @@ from pipelex.tools.misc.chart_utils import FlowchartDirection
def validate_bundle_cmd(
- ctx: typer.Context,
path: Annotated[
str,
typer.Argument(help="Path to a .mthds bundle file or a pipeline directory"),
@@ -127,7 +126,7 @@ def validate_bundle_cmd(
# Convert library_dirs to list[str] for graph helper
library_dir_strings = [str(lib_dir) for lib_dir in library_dirs] if library_dirs else None
- make_pipelex_for_agent_cli(library_dirs=library_dirs, log_level=ctx.obj["log_level"], needs_inference=False, needs_model_specs=True)
+ make_pipelex_for_agent_cli(library_dirs=library_dirs, needs_inference=False, needs_model_specs=True)
try:
if pipe:
diff --git a/pipelex/cli/agent_cli/commands/validate/method_cmd.py b/pipelex/cli/agent_cli/commands/validate/method_cmd.py
index c67d68362..3c188032c 100644
--- a/pipelex/cli/agent_cli/commands/validate/method_cmd.py
+++ b/pipelex/cli/agent_cli/commands/validate/method_cmd.py
@@ -29,7 +29,6 @@ from pipelex.pipeline.validate_bundle import ValidateBundleError
def validate_method_cmd(
- ctx: typer.Context,
name: Annotated[
str,
typer.Argument(help="Name of the installed method"),
@@ -78,7 +77,7 @@ def validate_method_cmd(
if library_dir:
library_dirs_paths.extend(Path(lib_dir) for lib_dir in library_dir)
- make_pipelex_for_agent_cli(library_dirs=library_dirs_paths, log_level=ctx.obj["log_level"], needs_inference=False, needs_model_specs=True)
+ make_pipelex_for_agent_cli(library_dirs=library_dirs_paths, needs_inference=False, needs_model_specs=True)
try:
if pipe:
diff --git a/pipelex/cli/agent_cli/commands/validate/pipe_cmd.py b/pipelex/cli/agent_cli/commands/validate/pipe_cmd.py
index 9c84ffa34..fdc13133f 100644
--- a/pipelex/cli/agent_cli/commands/validate/pipe_cmd.py
+++ b/pipelex/cli/agent_cli/commands/validate/pipe_cmd.py
@@ -29,7 +29,6 @@ from pipelex.pipeline.validate_bundle import ValidateBundleError
def validate_pipe_cmd(
- ctx: typer.Context,
pipe_code: Annotated[
str | None,
typer.Argument(help="Pipe code to validate"),
@@ -70,7 +69,7 @@ def validate_pipe_cmd(
if pipe_code:
agent_error("--all cannot be used with a pipe code", "ArgumentError")
- make_pipelex_for_agent_cli(library_dirs=library_dirs, log_level=ctx.obj["log_level"], needs_inference=False, needs_model_specs=True)
+ make_pipelex_for_agent_cli(library_dirs=library_dirs, needs_inference=False, needs_model_specs=True)
try:
result = asyncio.run(validate_all_core(library_dirs=library_dirs))
@@ -141,7 +140,7 @@ def validate_pipe_cmd(
else:
library_dirs = [*export_paths, *library_dirs]
- make_pipelex_for_agent_cli(library_dirs=library_dirs, log_level=ctx.obj["log_level"], needs_inference=False, needs_model_specs=True)
+ make_pipelex_for_agent_cli(library_dirs=library_dirs, needs_inference=False, needs_model_specs=True)
try:
result = asyncio.run(validate_pipe_core(pipe_code=pipe_code, library_dirs=library_dirs))
diff --git a/pipelex/cli/commands/doctor_cmd.py b/pipelex/cli/commands/doctor_cmd.py
index b38152298..babf5f813 100644
--- a/pipelex/cli/commands/doctor_cmd.py
+++ b/pipelex/cli/commands/doctor_cmd.py
@@ -58,6 +58,7 @@ from pipelex.system.telemetry.telemetry_config import TELEMETRY_CONFIG_FILE_NAME
from pipelex.tools.log.log_config import LogConfig
from pipelex.tools.misc.dict_utils import extract_vars_from_strings_recursive
from pipelex.tools.misc.file_utils import path_exists
+from pipelex.tools.misc.json_utils import deep_update
from pipelex.tools.misc.placeholder import value_is_placeholder
from pipelex.tools.misc.toml_utils import TomlError, load_toml_from_path
from pipelex.tools.secrets.env_secrets_provider import EnvSecretsProvider
@@ -752,8 +753,10 @@ def setup_doctor_runtime(
stdout stays clean for downstream consumers. The human doctor passes nothing and
inherits the user's configured log targets.
- Overrides are merged via ``LogConfig.model_validate`` (full re-validation) so that
- a wrong-typed override surfaces loudly instead of silently breaking downstream
+ Overrides are merged via ``deep_update`` so nested dicts (notably
+ ``package_log_levels``) merge into the loaded config instead of replacing it
+ wholesale, then passed through ``LogConfig.model_validate`` (full re-validation) so
+ that a wrong-typed override surfaces loudly instead of silently breaking downstream
match/case dispatch on ``ConsoleTarget`` etc.
``log.configure`` is invoked through ``configure_if_unset`` so that if a library
@@ -781,7 +784,9 @@ def setup_doctor_runtime(
log_config = get_config().pipelex.log_config
if log_config_overrides is not None:
- log_config = LogConfig.model_validate({**log_config.model_dump(), **log_config_overrides})
+ merged = log_config.model_dump()
+ deep_update(merged, log_config_overrides)
+ log_config = LogConfig.model_validate(merged)
pipelex_hub.set_console_print_target(target=log_config.console_print_target)
log.configure_if_unset(log_config=log_config)
diff --git a/pyproject.toml b/pyproject.toml
index 649f50a53..9c3d89646 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "pipelex"
-version = "0.30.0"
+version = "0.30.1"
description = "Execute composable AI methods declared in the MTHDS open standard"
authors = [{ name = "Evotis S.A.S.", email = "[email protected]" }]
maintainers = [{ name = "Pipelex staff", email = "[email protected]" }]
diff --git a/tests/e2e/agent_cli/test_stdout_is_clean_json.py b/tests/e2e/agent_cli/test_stdout_is_clean_json.py
index 285871a28..b6cfdfe97 100644
--- a/tests/e2e/agent_cli/test_stdout_is_clean_json.py
+++ b/tests/e2e/agent_cli/test_stdout_is_clean_json.py
@@ -117,16 +117,15 @@ class TestAgentCliStdoutIsCleanJson:
Bumps ``package_log_levels.pipelex`` to DEBUG (the exact knob a downstream user
would flip when debugging) so the latent ``console_log_target`` bug surfaces as
- DEBUG lines on stdout. Then ``json.loads`` on the entire stdout (with no slicing,
- no last-object walker) must succeed and return a dict envelope.
+ DEBUG lines on stdout. The agent CLI's ``config_overrides`` MUST win over the
+ user-TOML override (pinning pipelex to OFF), so ``json.loads`` on the entire
+ stdout must succeed and return a dict envelope.
"""
_set_pipelex_package_log_level_to_debug(hermetic_home / ".pipelex" / "pipelex.toml")
result = subprocess.run( # noqa: S603
[
str(PIPELEX_AGENT_BIN),
- "--log-level",
- "debug",
"models",
"--format",
"json",
@@ -177,8 +176,6 @@ class TestAgentCliStdoutIsCleanJson:
result = subprocess.run( # noqa: S603
[
str(PIPELEX_AGENT_BIN),
- "--log-level",
- "debug",
"models",
"--format",
"json",
diff --git a/tests/unit/pipelex/cli/agent_cli/test_error_format_independent.py b/tests/unit/pipelex/cli/agent_cli/test_error_format_independent.py
index b8061d30b..d57ce6d0c 100644
--- a/tests/unit/pipelex/cli/agent_cli/test_error_format_independent.py
+++ b/tests/unit/pipelex/cli/agent_cli/test_error_format_independent.py
@@ -9,7 +9,6 @@ from mthds.runners.types import RunnerType
from pipelex.cli.agent_cli.commands.agent_output import CliOutputFormat
from pipelex.cli.agent_cli.commands.run.pipe_cmd import run_pipe_cmd
-from pipelex.tools.log.log_levels import LogLevel
if TYPE_CHECKING:
from pytest_mock import MockerFixture
@@ -26,13 +25,13 @@ class TestErrorFormatIndependent:
mocker.patch(f"{RUN_PIPE_MODULE}.parse_cli_inputs", return_value=None)
mocker.patch(f"{RUN_PIPE_MODULE}.run_pipeline_core", new=mocker.AsyncMock(return_value=result))
ctx = mocker.MagicMock()
- ctx.obj = {"log_level": LogLevel.WARNING, "runner": RunnerType.PIPELEX}
+ ctx.obj = {"runner": RunnerType.PIPELEX}
return ctx
def _ctx_for_error_path(self, mocker: MockerFixture) -> Any:
"""Mock typer.Context shaped for the error path (no Pipelex init needed)."""
ctx = mocker.MagicMock()
- ctx.obj = {"log_level": LogLevel.WARNING, "runner": RunnerType.PIPELEX}
+ ctx.obj = {"runner": RunnerType.PIPELEX}
return ctx
@pytest.mark.parametrize(
diff --git a/tests/unit/pipelex/cli/agent_cli/test_run_format.py b/tests/unit/pipelex/cli/agent_cli/test_run_format.py
index 86e6f36f8..d865355ea 100644
--- a/tests/unit/pipelex/cli/agent_cli/test_run_format.py
+++ b/tests/unit/pipelex/cli/agent_cli/test_run_format.py
@@ -10,7 +10,6 @@ from mthds.runners.types import RunnerType
from pipelex.cli.agent_cli.commands.agent_output import CliOutputFormat
from pipelex.cli.agent_cli.commands.run.pipe_cmd import run_pipe_cmd
-from pipelex.tools.log.log_levels import LogLevel
if TYPE_CHECKING:
from pytest_mock import MockerFixture
@@ -29,7 +28,7 @@ class TestRunFormat:
mocker.patch(f"{RUN_PIPE_MODULE}.parse_cli_inputs", return_value=None)
mocker.patch(f"{RUN_PIPE_MODULE}.run_pipeline_core", new=mocker.AsyncMock(return_value=result))
ctx = mocker.MagicMock()
- ctx.obj = {"log_level": LogLevel.WARNING, "runner": RunnerType.PIPELEX}
+ ctx.obj = {"runner": RunnerType.PIPELEX}
return ctx
def test_run_pipe_markdown_is_default(self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
diff --git a/tests/unit/pipelex/cli/agent_cli/test_validate_format.py b/tests/unit/pipelex/cli/agent_cli/test_validate_format.py
index acdc314d4..6e3cfd545 100644
--- a/tests/unit/pipelex/cli/agent_cli/test_validate_format.py
+++ b/tests/unit/pipelex/cli/agent_cli/test_validate_format.py
@@ -9,7 +9,6 @@ import pytest
from pipelex.cli.agent_cli.commands.agent_output import CliOutputFormat
from pipelex.cli.agent_cli.commands.validate.pipe_cmd import validate_pipe_cmd
-from pipelex.tools.log.log_levels import LogLevel
if TYPE_CHECKING:
from pytest_mock import MockerFixture
@@ -20,8 +19,8 @@ VALIDATE_PIPE_MODULE = "pipelex.cli.agent_cli.commands.validate.pipe_cmd"
class TestValidateFormat:
"""validate pipe --all emits markdown by default and JSON with --format json."""
- def _patch_validate(self, mocker: MockerFixture) -> Any:
- """Patch the validate pipe command's dependencies and return a mock typer context."""
+ def _patch_validate(self, mocker: MockerFixture) -> None:
+ """Patch the validate pipe command's dependencies."""
result: dict[str, Any] = {
"success": True,
"validated_pipes": [{"pipe_code": "p1", "status": "SUCCESS"}],
@@ -30,15 +29,12 @@ class TestValidateFormat:
mocker.patch(f"{VALIDATE_PIPE_MODULE}.make_pipelex_for_agent_cli")
mocker.patch(f"{VALIDATE_PIPE_MODULE}.Pipelex.teardown_if_needed")
mocker.patch(f"{VALIDATE_PIPE_MODULE}.validate_all_core", new=mocker.AsyncMock(return_value=result))
- ctx = mocker.MagicMock()
- ctx.obj = {"log_level": LogLevel.WARNING}
- return ctx
def test_validate_markdown_is_default(self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
"""Validate pipe --all with no --format produces markdown to stdout."""
- ctx = self._patch_validate(mocker)
+ self._patch_validate(mocker)
- validate_pipe_cmd(ctx=ctx, validate_all=True, output_format=CliOutputFormat.MARKDOWN)
+ validate_pipe_cmd(validate_all=True, output_format=CliOutputFormat.MARKDOWN)
out = capsys.readouterr().out
assert out.startswith("# Validation passed")
@@ -48,9 +44,9 @@ class TestValidateFormat:
def test_validate_json_with_format_json(self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
"""Validate pipe --all --format json produces valid JSON to stdout."""
- ctx = self._patch_validate(mocker)
+ self._patch_validate(mocker)
- validate_pipe_cmd(ctx=ctx, validate_all=True, output_format=CliOutputFormat.JSON)
+ validate_pipe_cmd(validate_all=True, output_format=CliOutputFormat.JSON)
parsed = json.loads(capsys.readouterr().out)
assert parsed["success"] is True
diff --git a/tests/unit/pipelex/cli/conftest.py b/tests/unit/pipelex/cli/conftest.py
index 606c3826b..77b803a5b 100644
--- a/tests/unit/pipelex/cli/conftest.py
+++ b/tests/unit/pipelex/cli/conftest.py
@@ -2,18 +2,15 @@
from __future__ import annotations
-from typing import TYPE_CHECKING, Any
+from typing import TYPE_CHECKING
import pytest
from pipelex.cli.agent_cli.commands.agent_output import CliOutputFormat, set_agent_cli_error_format
-from pipelex.tools.log.log_levels import LogLevel
if TYPE_CHECKING:
from collections.abc import Iterator
- from pytest_mock import MockerFixture
-
@pytest.fixture(autouse=True)
def reset_agent_cli_error_format() -> Iterator[None]:
@@ -27,11 +24,3 @@ def reset_agent_cli_error_format() -> Iterator[None]:
set_agent_cli_error_format(CliOutputFormat.JSON)
yield
set_agent_cli_error_format(CliOutputFormat.JSON)
-
-
-def agent_ctx(mocker: MockerFixture) -> Any:
- """Create a mock typer.Context with log_level in obj, for direct command-function calls."""
- ctx = mocker.MagicMock()
- ctx.obj = {"log_level": LogLevel.WARNING}
- return ctx
diff --git a/tests/unit/pipelex/cli/test_agent_cli_factory_init_overrides.py b/tests/unit/pipelex/cli/test_agent_cli_factory_init_overrides.py
new file mode 100644
index 000000000..94fcd67cb
--- /dev/null
+++ b/tests/unit/pipelex/cli/test_agent_cli_factory_init_overrides.py
@@ -0,0 +1,60 @@
+"""Tests for init-time log suppression via config_overrides in the agent CLI factory.
+
+Regression guard: a user TOML with ``[pipelex.log_config.package_log_levels] pipelex =
+"DEBUG"`` used to leak setup-time logs (e.g. ``telemetry_factory.py``'s
+``log.debug("Telemetry is disabled...")``, ``validation_error_categorizer.py``'s
+``log.warning``) onto stderr — corrupting the JSON error envelope that downstream agent
+consumers parse. The fix pins ``package_log_levels.pipelex = OFF`` via
+``config_overrides`` so suppression takes effect from the very first ``log.configure``
+call inside ``Pipelex.make``, not post-init via ``apply_agent_cli_output_discipline``.
+
+The agent CLI has NO ``--log-level`` flag. Suppression is unconditional by design — the
+CLI is machine-consumed and stderr is reserved for the structured error envelope.
+"""
+
+from __future__ import annotations
+
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from pytest_mock import MockerFixture
+
+from pipelex.cli.agent_cli.commands.agent_cli_factory import (
+ AGENT_CLI_STDERR_LOG_FIELDS,
+ make_pipelex_for_agent_cli,
+)
+from pipelex.system.console_target import ConsoleTarget
+from pipelex.tools.log.log_levels import LogLevel
+
+
+class TestAgentCliFactoryInitOverrides:
+ """Pins the contract that init-time logs are suppressed via config_overrides."""
+
+ def test_static_leaf_pins_off_for_pipelex_package(self) -> None:
+ """The doctor path and the full-init path BOTH use ``AGENT_CLI_STDERR_LOG_FIELDS``,
+ so the leaf itself must silence pipelex logs at OFF.
+ """
+ assert AGENT_CLI_STDERR_LOG_FIELDS["default_log_level"] == LogLevel.OFF
+ assert AGENT_CLI_STDERR_LOG_FIELDS["package_log_levels"]["pipelex"] == LogLevel.OFF
+ assert AGENT_CLI_STDERR_LOG_FIELDS["console_log_target"] is ConsoleTarget.STDERR
+ assert AGENT_CLI_STDERR_LOG_FIELDS["console_print_target"] is ConsoleTarget.STDERR
+
+ def test_make_injects_off_overrides_into_pipelex_make(self, mocker: MockerFixture) -> None:
+ """``Pipelex.make`` must receive a ``config_overrides`` carrying the OFF pins so
+ suppression takes effect at ``log.configure`` time — before any setup-time
+ ``log.*`` call can fire on stderr.
+ """
+ mock_pipelex = mocker.MagicMock()
+ mock_make = mocker.patch(
+ "pipelex.cli.agent_cli.commands.agent_cli_factory.Pipelex.make",
+ return_value=mock_pipelex,
+ )
+
+ make_pipelex_for_agent_cli()
+
+ config_overrides = mock_make.call_args.kwargs["config_overrides"]
+ log_config_overrides = config_overrides["pipelex"]["log_config"]
+ assert log_config_overrides["default_log_level"] is LogLevel.OFF
+ assert log_config_overrides["package_log_levels"]["pipelex"] is LogLevel.OFF
+ assert log_config_overrides["console_log_target"] is ConsoleTarget.STDERR
+ assert log_config_overrides["console_print_target"] is ConsoleTarget.STDERR
diff --git a/tests/unit/pipelex/cli/test_agent_cli_factory_suppression.py b/tests/unit/pipelex/cli/test_agent_cli_factory_suppression.py
index 89a38eb90..72871e0c3 100644
--- a/tests/unit/pipelex/cli/test_agent_cli_factory_suppression.py
+++ b/tests/unit/pipelex/cli/test_agent_cli_factory_suppression.py
@@ -37,24 +37,15 @@ class TestAgentCliFactorySuppression:
assert PrettyPrinter.mode is PrettyPrintMode.SILENT
- def test_sets_warning_log_level(self, mocker: MockerFixture) -> None:
- """Log level should be WARNING by default after make_pipelex_for_agent_cli succeeds."""
+ def test_silences_pipelex_logger(self, mocker: MockerFixture) -> None:
+ """The pipelex package logger must be pinned at OFF (LOGGING_LEVEL_OFF=999) — the
+ agent CLI's contract is "no free-floating logs on stderr." There is no log_level
+ parameter; suppression is unconditional.
+ """
mock_pipelex = mocker.MagicMock()
mocker.patch("pipelex.cli.agent_cli.commands.agent_cli_factory.Pipelex.make", return_value=mock_pipelex)
make_pipelex_for_agent_cli()
pipelex_logger = logging.getLogger("pipelex")
- assert pipelex_logger.level == logging.WARNING
- assert pipelex_logger.level == LogLevel.WARNING.int_logging_level
-
- def test_sets_custom_log_level(self, mocker: MockerFixture) -> None:
- """Log level should match the provided log_level parameter."""
- mock_pipelex = mocker.MagicMock()
- mocker.patch("pipelex.cli.agent_cli.commands.agent_cli_factory.Pipelex.make", return_value=mock_pipelex)
-
- make_pipelex_for_agent_cli(log_level=LogLevel.DEBUG)
-
- pipelex_logger = logging.getLogger("pipelex")
- assert pipelex_logger.level == logging.DEBUG
- assert pipelex_logger.level == LogLevel.DEBUG.int_logging_level
+ assert pipelex_logger.level == LogLevel.OFF.int_logging_level
diff --git a/tests/unit/pipelex/cli/test_agent_cli_output_discipline.py b/tests/unit/pipelex/cli/test_agent_cli_output_discipline.py
index 99e076cbe..0f3334454 100644
--- a/tests/unit/pipelex/cli/test_agent_cli_output_discipline.py
+++ b/tests/unit/pipelex/cli/test_agent_cli_output_discipline.py
@@ -44,12 +44,12 @@ class TestApplyAgentCliOutputDiscipline:
return_value=mock_hub,
)
- apply_agent_cli_output_discipline(log_level=LogLevel.WARNING)
+ apply_agent_cli_output_discipline()
mock_redirect.assert_called_once()
mock_hub.set_console_print_target.assert_called_once_with(target=ConsoleTarget.STDERR)
assert PrettyPrinter.mode is PrettyPrintMode.SILENT
- assert logging.getLogger("pipelex").level == LogLevel.WARNING.int_logging_level
+ assert logging.getLogger("pipelex").level == LogLevel.OFF.int_logging_level
def test_no_hub_path_skips_hub_call_safely(self, mocker: MockerFixture) -> None:
"""When no hub is installed (broken-config doctor path), the helper must still pin
@@ -61,8 +61,8 @@ class TestApplyAgentCliOutputDiscipline:
return_value=None,
)
- apply_agent_cli_output_discipline(log_level=LogLevel.WARNING)
+ apply_agent_cli_output_discipline()
mock_redirect.assert_called_once()
assert PrettyPrinter.mode is PrettyPrintMode.SILENT
- assert logging.getLogger("pipelex").level == LogLevel.WARNING.int_logging_level
+ assert logging.getLogger("pipelex").level == LogLevel.OFF.int_logging_level
diff --git a/tests/unit/pipelex/cli/test_agent_models_cmd.py b/tests/unit/pipelex/cli/test_agent_models_cmd.py
index 61d724fdf..2b6ef5a98 100644
--- a/tests/unit/pipelex/cli/test_agent_models_cmd.py
+++ b/tests/unit/pipelex/cli/test_agent_models_cmd.py
@@ -105,11 +105,11 @@ def _setup_mocks(mocker: MockerFixture) -> None:
class TestAgentModelsCmd:
"""Tests for agent_models_cmd JSON output with --type and --backend filters."""
- def test_no_filters_returns_all_categories(self, agent_ctx: Any, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
+ def test_no_filters_returns_all_categories(self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
"""No filters should return all categories in every section."""
_setup_mocks(mocker)
- agent_models_cmd(ctx=agent_ctx, output_format=CliOutputFormat.JSON)
+ agent_models_cmd(output_format=CliOutputFormat.JSON)
parsed = json.loads(capsys.readouterr().out)
assert parsed["success"] is True
@@ -118,21 +118,21 @@ class TestAgentModelsCmd:
assert "img_gen" in parsed[section], f"img_gen missing from {section}"
assert "extract" in parsed[section], f"extract missing from {section}"
- def test_no_talent_mappings_in_output(self, agent_ctx: Any, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
+ def test_no_talent_mappings_in_output(self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
"""Output should not contain talent_mappings or usage hint."""
_setup_mocks(mocker)
- agent_models_cmd(ctx=agent_ctx, output_format=CliOutputFormat.JSON)
+ agent_models_cmd(output_format=CliOutputFormat.JSON)
parsed = json.loads(capsys.readouterr().out)
assert "talent_mappings" not in parsed
assert "talent_mappings_usage_hint" not in parsed
- def test_no_filters_preset_content(self, agent_ctx: Any, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
+ def test_no_filters_preset_content(self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
"""No filters should include all preset entries with correct data."""
_setup_mocks(mocker)
- agent_models_cmd(ctx=agent_ctx, output_format=CliOutputFormat.JSON)
+ agent_models_cmd(output_format=CliOutputFormat.JSON)
parsed = json.loads(capsys.readouterr().out)
llm_preset_names = [preset["name"] for preset in parsed["presets"]["llm"]]
@@ -141,11 +141,11 @@ class TestAgentModelsCmd:
fast_preset = next(preset for preset in parsed["presets"]["llm"] if preset["name"] == "fast")
assert fast_preset["description"] == "Fast LLM"
- def test_type_llm_only(self, agent_ctx: Any, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
+ def test_type_llm_only(self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
"""--type llm should return only llm keys in all sections."""
_setup_mocks(mocker)
- agent_models_cmd(ctx=agent_ctx, model_type=[ModelCategory.LLM], output_format=CliOutputFormat.JSON)
+ agent_models_cmd(model_type=[ModelCategory.LLM], output_format=CliOutputFormat.JSON)
parsed = json.loads(capsys.readouterr().out)
for section in ("presets", "aliases", "waterfalls"):
@@ -153,11 +153,11 @@ class TestAgentModelsCmd:
assert "img_gen" not in parsed[section], f"img_gen should not be in {section}"
assert "extract" not in parsed[section], f"extract should not be in {section}"
- def test_type_extract_only(self, agent_ctx: Any, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
+ def test_type_extract_only(self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
"""--type extract should return only extract keys in all sections."""
_setup_mocks(mocker)
- agent_models_cmd(ctx=agent_ctx, model_type=[ModelCategory.EXTRACT], output_format=CliOutputFormat.JSON)
+ agent_models_cmd(model_type=[ModelCategory.EXTRACT], output_format=CliOutputFormat.JSON)
parsed = json.loads(capsys.readouterr().out)
for section in ("presets", "aliases", "waterfalls"):
@@ -165,11 +165,11 @@ class TestAgentModelsCmd:
assert "llm" not in parsed[section], f"llm should not be in {section}"
assert "img_gen" not in parsed[section], f"img_gen should not be in {section}"
- def test_type_img_gen_only(self, agent_ctx: Any, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
+ def test_type_img_gen_only(self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
"""--type img_gen should return only img_gen keys in all sections."""
_setup_mocks(mocker)
- agent_models_cmd(ctx=agent_ctx, model_type=[ModelCategory.IMG_GEN], output_format=CliOutputFormat.JSON)
+ agent_models_cmd(model_type=[ModelCategory.IMG_GEN], output_format=CliOutputFormat.JSON)
parsed = json.loads(capsys.readouterr().out)
for section in ("presets", "aliases", "waterfalls"):
@@ -177,11 +177,11 @@ class TestAgentModelsCmd:
assert "llm" not in parsed[section], f"llm should not be in {section}"
assert "extract" not in parsed[section], f"extract should not be in {section}"
- def test_type_llm_and_img_gen(self, agent_ctx: Any, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
+ def test_type_llm_and_img_gen(self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
"""--type llm --type img_gen should return both llm and img_gen, but not extract."""
_setup_mocks(mocker)
- agent_models_cmd(ctx=agent_ctx, model_type=[ModelCategory.LLM, ModelCategory.IMG_GEN], output_format=CliOutputFormat.JSON)
+ agent_models_cmd(model_type=[ModelCategory.LLM, ModelCategory.IMG_GEN], output_format=CliOutputFormat.JSON)
parsed = json.loads(capsys.readouterr().out)
for section in ("presets", "aliases", "waterfalls"):
@@ -189,11 +189,11 @@ class TestAgentModelsCmd:
assert "img_gen" in parsed[section], f"img_gen missing from {section}"
assert "extract" not in parsed[section], f"extract should not be in {section}"
- def test_backend_filter_openai(self, agent_ctx: Any, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
+ def test_backend_filter_openai(self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
"""--backend openai should filter presets/aliases/waterfalls to only openai-backed models."""
_setup_mocks(mocker)
- agent_models_cmd(ctx=agent_ctx, backend="openai", output_format=CliOutputFormat.JSON)
+ agent_models_cmd(backend="openai", output_format=CliOutputFormat.JSON)
parsed = json.loads(capsys.readouterr().out)
llm_preset_names = [preset["name"] for preset in parsed["presets"]["llm"]]
@@ -204,11 +204,11 @@ class TestAgentModelsCmd:
assert "hd-image" in img_gen_preset_names
assert len(parsed["presets"]["extract"]) == 0
- def test_backend_filter_anthropic(self, agent_ctx: Any, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
+ def test_backend_filter_anthropic(self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
"""--backend anthropic should include only anthropic-backed models."""
_setup_mocks(mocker)
- agent_models_cmd(ctx=agent_ctx, backend="anthropic", output_format=CliOutputFormat.JSON)
+ agent_models_cmd(backend="anthropic", output_format=CliOutputFormat.JSON)
parsed = json.loads(capsys.readouterr().out)
llm_preset_names = [preset["name"] for preset in parsed["presets"]["llm"]]
@@ -216,11 +216,11 @@ class TestAgentModelsCmd:
assert "fast" not in llm_preset_names
assert "best-llm" in parsed["aliases"]["llm"]
- def test_type_and_backend_combined(self, agent_ctx: Any, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
+ def test_type_and_backend_combined(self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
"""--type llm --backend openai should combine both filters."""
_setup_mocks(mocker)
- agent_models_cmd(ctx=agent_ctx, model_type=[ModelCategory.LLM], backend="openai", output_format=CliOutputFormat.JSON)
+ agent_models_cmd(model_type=[ModelCategory.LLM], backend="openai", output_format=CliOutputFormat.JSON)
parsed = json.loads(capsys.readouterr().out)
assert "llm" in parsed["presets"]
@@ -230,11 +230,11 @@ class TestAgentModelsCmd:
assert "fast" in llm_preset_names
assert "smart" not in llm_preset_names
- def test_backend_nonexistent(self, agent_ctx: Any, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
+ def test_backend_nonexistent(self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
"""--backend nonexistent should produce empty presets/aliases/waterfalls."""
_setup_mocks(mocker)
- agent_models_cmd(ctx=agent_ctx, backend="nonexistent", output_format=CliOutputFormat.JSON)
+ agent_models_cmd(backend="nonexistent", output_format=CliOutputFormat.JSON)
parsed = json.loads(capsys.readouterr().out)
assert parsed["success"] is True
@@ -242,11 +242,11 @@ class TestAgentModelsCmd:
for category in ("llm", "img_gen", "extract"):
assert len(parsed[section][category]) == 0, f"{section}.{category} should be empty"
- def test_waterfalls_backend_filter(self, agent_ctx: Any, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
+ def test_waterfalls_backend_filter(self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
"""--backend anthropic should include llm waterfall (has claude-sonnet) but not img waterfall."""
_setup_mocks(mocker)
- agent_models_cmd(ctx=agent_ctx, backend="anthropic", output_format=CliOutputFormat.JSON)
+ agent_models_cmd(backend="anthropic", output_format=CliOutputFormat.JSON)
parsed = json.loads(capsys.readouterr().out)
assert "llm-wf" in parsed["waterfalls"]["llm"]
diff --git a/tests/unit/pipelex/cli/test_agent_validate_cmd.py b/tests/unit/pipelex/cli/test_agent_validate_cmd.py
index 48f0a2f66..54f773127 100644
--- a/tests/unit/pipelex/cli/test_agent_validate_cmd.py
+++ b/tests/unit/pipelex/cli/test_agent_validate_cmd.py
@@ -26,7 +26,6 @@ class TestValidateBundleCmd:
def test_graph_generation_failure_emits_single_json_error(
self,
- agent_ctx: Any,
mocker: MockerFixture,
capsys: pytest.CaptureFixture[str],
tmp_path: Path,
@@ -71,7 +70,6 @@ class TestValidateBundleCmd:
with pytest.raises(typer.Exit) as exc_info:
validate_bundle_cmd(
- ctx=agent_ctx,
path=str(mthds_file),
graph=True,
output_format=CliOutputFormat.JSON,
diff --git a/tests/unit/pipelex/cli/test_check_model_cmd.py b/tests/unit/pipelex/cli/test_check_model_cmd.py
index b09bd6254..897adb24d 100644
--- a/tests/unit/pipelex/cli/test_check_model_cmd.py
+++ b/tests/unit/pipelex/cli/test_check_model_cmd.py
@@ -97,7 +97,6 @@ def _setup_mocks(mocker: MockerFixture) -> None:
def _run_check(
- agent_ctx: Any,
mocker: MockerFixture,
capsys: pytest.CaptureFixture[str],
name: str,
@@ -106,7 +105,7 @@ def _run_check(
) -> dict[str, Any]:
"""Run check-model and return parsed JSON output."""
_setup_mocks(mocker)
- agent_check_model_cmd(ctx=agent_ctx, name=name, model_type=model_type, output_format=output_format)
+ agent_check_model_cmd(name=name, model_type=model_type, output_format=output_format)
parsed: dict[str, Any] = json.loads(capsys.readouterr().out)
return parsed
@@ -114,57 +113,57 @@ def _run_check(
class TestCheckModelCmd:
"""Tests for agent_check_model_cmd validation and fuzzy matching."""
- def test_valid_preset(self, agent_ctx: Any, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
+ def test_valid_preset(self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
"""A known preset name with $ sigil should be valid."""
- result = _run_check(agent_ctx, mocker, capsys, "$writing-creative")
+ result = _run_check(mocker, capsys, "$writing-creative")
assert result["valid"] is True
assert result["kind"] == "preset"
- def test_valid_alias(self, agent_ctx: Any, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
+ def test_valid_alias(self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
"""A known alias name with @ sigil should be valid."""
- result = _run_check(agent_ctx, mocker, capsys, "@best-claude")
+ result = _run_check(mocker, capsys, "@best-claude")
assert result["valid"] is True
assert result["kind"] == "alias"
- def test_valid_handle(self, agent_ctx: Any, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
+ def test_valid_handle(self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
"""A known bare model handle should be valid."""
- result = _run_check(agent_ctx, mocker, capsys, "claude-4.5-sonnet")
+ result = _run_check(mocker, capsys, "claude-4.5-sonnet")
assert result["valid"] is True
assert result["kind"] == "handle"
- def test_invalid_preset_with_fuzzy_suggestions(self, agent_ctx: Any, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
+ def test_invalid_preset_with_fuzzy_suggestions(self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
"""A typo in a preset name should return fuzzy suggestions with $ prefix."""
- result = _run_check(agent_ctx, mocker, capsys, "$writting-creative")
+ result = _run_check(mocker, capsys, "$writting-creative")
assert result["valid"] is False
assert any("$writing-creative" in suggestion for suggestion in result["suggestions"])
- def test_wrong_sigil_detected(self, agent_ctx: Any, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
+ def test_wrong_sigil_detected(self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
"""Using $ for a name that exists as an alias should produce a wrong-sigil hint."""
- result = _run_check(agent_ctx, mocker, capsys, "$best-claude")
+ result = _run_check(mocker, capsys, "$best-claude")
assert result["valid"] is False
assert any("@best-claude" in hint for hint in result["wrong_sigil_hints"])
- def test_invalid_handle_cross_collection_suggestions(self, agent_ctx: Any, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
+ def test_invalid_handle_cross_collection_suggestions(self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
"""A bare name matching a preset should suggest the prefixed version."""
- result = _run_check(agent_ctx, mocker, capsys, "writing-creative")
+ result = _run_check(mocker, capsys, "writing-creative")
assert result["valid"] is False
assert any("$writing-creative" in hint for hint in result["wrong_sigil_hints"])
- def test_invalid_handle_fuzzy_suggestions(self, agent_ctx: Any, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
+ def test_invalid_handle_fuzzy_suggestions(self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
"""A typo in a handle should return fuzzy suggestions without sigil prefix."""
- result = _run_check(agent_ctx, mocker, capsys, "claude-4.5-sonet")
+ result = _run_check(mocker, capsys, "claude-4.5-sonet")
assert result["valid"] is False
assert "claude-4.5-sonnet" in result["suggestions"]
- def test_completely_unknown_name(self, agent_ctx: Any, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
+ def test_completely_unknown_name(self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
"""A completely unknown name should return no suggestions."""
- result = _run_check(agent_ctx, mocker, capsys, "$zzz-nonexistent-xyz")
+ result = _run_check(mocker, capsys, "$zzz-nonexistent-xyz")
assert result["valid"] is False
assert len(result["suggestions"]) == 0
- def test_json_output_structure(self, agent_ctx: Any, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
+ def test_json_output_structure(self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
"""JSON output should contain all expected keys on failure."""
- result = _run_check(agent_ctx, mocker, capsys, "$nonexistent")
+ result = _run_check(mocker, capsys, "$nonexistent")
assert result["success"] is True
assert result["valid"] is False
assert "suggestions" in result
@@ -172,23 +171,23 @@ class TestCheckModelCmd:
assert "cross_collection_suggestions" in result
assert result["model_type"] == "llm"
- def test_markdown_valid_output(self, agent_ctx: Any, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
+ def test_markdown_valid_output(self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
"""Markdown output for a valid reference should be a single confirmation line."""
_setup_mocks(mocker)
- agent_check_model_cmd(ctx=agent_ctx, name="$writing-creative", model_type=ModelCategory.LLM, output_format=CliOutputFormat.MARKDOWN)
+ agent_check_model_cmd(name="$writing-creative", model_type=ModelCategory.LLM, output_format=CliOutputFormat.MARKDOWN)
output = capsys.readouterr().out.strip()
assert output == "$writing-creative is a valid llm preset."
- def test_markdown_invalid_output_has_suggestions(self, agent_ctx: Any, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
+ def test_markdown_invalid_output_has_suggestions(self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
"""Markdown output for an invalid reference should include 'Did you mean' suggestions."""
_setup_mocks(mocker)
- agent_check_model_cmd(ctx=agent_ctx, name="$writting-creative", model_type=ModelCategory.LLM, output_format=CliOutputFormat.MARKDOWN)
+ agent_check_model_cmd(name="$writting-creative", model_type=ModelCategory.LLM, output_format=CliOutputFormat.MARKDOWN)
output = capsys.readouterr().out
assert "is not a valid" in output
assert "Did you mean:" in output
- def test_valid_waterfall(self, agent_ctx: Any, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
+ def test_valid_waterfall(self, mocker: MockerFixture, capsys: pytest.CaptureFixture[str]) -> None:
"""A known waterfall name with ~ sigil should be valid."""
- result = _run_check(agent_ctx, mocker, capsys, "~robust-llm")
+ result = _run_check(mocker, capsys, "~robust-llm")
assert result["valid"] is True
assert result["kind"] == "waterfall"
diff --git a/uv.lock b/uv.lock
index 5ba1cf25b..579c09783 100644
--- a/uv.lock
+++ b/uv.lock
@@ -3644,7 +3644,7 @@ wheels = [
[[package]]
name = "pipelex"
-version = "0.30.0"
+version = "0.30.1"
source = { editable = "." }
dependencies = [
{ name = "aiofiles" },