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.

Add needs_model_specs to Pipelex init and update changelog

Louis Choquel6ed67948194f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index daa2642f2..80beaf14c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,10 @@
## [v0.20.6] - 2026-03-12
+### Added
+
+- **`needs_model_specs` parameter**: New option on `Pipelex.make()` and CLI factories to load real gateway model specs without enabling full inference. Validation commands (`pipelex validate`, `pipelex-agent validate`) now fetch live model specs, improving accuracy of pipe/method/bundle validation.
+
### Removed
- **Deprecated `pipelex_inference` backend**: Removed all traces of the legacy backend — config files, enum values, migration logic, deprecation warnings, and documentation admonitions. The transition to `pipelex_gateway` is complete.
diff --git a/pipelex/cli/agent_cli/commands/agent_cli_factory.py b/pipelex/cli/agent_cli/commands/agent_cli_factory.py
index a4211bc65..f7f4f4811 100644
--- a/pipelex/cli/agent_cli/commands/agent_cli_factory.py
+++ b/pipelex/cli/agent_cli/commands/agent_cli_factory.py
@@ -23,6 +23,7 @@ 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:
"""Initialize Pipelex for agent CLI commands with JSON error output.
@@ -35,6 +36,7 @@ def make_pipelex_for_agent_cli(
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.
Returns:
Initialized Pipelex instance.
@@ -43,7 +45,9 @@ def make_pipelex_for_agent_cli(
typer.Exit: If initialization fails (after printing JSON error to stderr).
"""
try:
- pipelex_instance = Pipelex.make(integration_mode=IntegrationMode.CLI, library_dirs=library_dirs, needs_inference=needs_inference)
+ pipelex_instance = Pipelex.make(
+ integration_mode=IntegrationMode.CLI, library_dirs=library_dirs, needs_inference=needs_inference, needs_model_specs=needs_model_specs
+ )
except TelemetryConfigValidationError as exc:
agent_error(exc.message, "TelemetryConfigValidationError", cause=exc)
except GatewayTermsNotAcceptedError as exc:
diff --git a/pipelex/cli/agent_cli/commands/validate/bundle_cmd.py b/pipelex/cli/agent_cli/commands/validate/bundle_cmd.py
index dd6da0939..3bd63556e 100644
--- a/pipelex/cli/agent_cli/commands/validate/bundle_cmd.py
+++ b/pipelex/cli/agent_cli/commands/validate/bundle_cmd.py
@@ -109,7 +109,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)
+ make_pipelex_for_agent_cli(library_dirs=library_dirs, log_level=ctx.obj["log_level"], 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 373eacfb1..d7b4629ef 100644
--- a/pipelex/cli/agent_cli/commands/validate/method_cmd.py
+++ b/pipelex/cli/agent_cli/commands/validate/method_cmd.py
@@ -60,7 +60,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)
+ make_pipelex_for_agent_cli(library_dirs=library_dirs_paths, log_level=ctx.obj["log_level"], 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 76ae21689..5e0102139 100644
--- a/pipelex/cli/agent_cli/commands/validate/pipe_cmd.py
+++ b/pipelex/cli/agent_cli/commands/validate/pipe_cmd.py
@@ -52,7 +52,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)
+ make_pipelex_for_agent_cli(library_dirs=library_dirs, log_level=ctx.obj["log_level"], needs_inference=False, needs_model_specs=True)
try:
result = asyncio.run(validate_all_core(library_dirs=library_dirs))
@@ -122,7 +122,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)
+ make_pipelex_for_agent_cli(library_dirs=library_dirs, log_level=ctx.obj["log_level"], 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/cli_factory.py b/pipelex/cli/cli_factory.py
index 892e68942..1dd111186 100644
--- a/pipelex/cli/cli_factory.py
+++ b/pipelex/cli/cli_factory.py
@@ -29,6 +29,7 @@ def make_pipelex_for_cli(
context: ErrorContext,
library_dirs: list[str] | list[Path] | None = None,
needs_inference: bool = True,
+ needs_model_specs: bool | None = None,
) -> Pipelex:
"""Initialize Pipelex for CLI commands with proper error handling.
@@ -39,6 +40,7 @@ def make_pipelex_for_cli(
context: The CLI context for error messages.
library_dirs: The library directories to use for the Pipelex instance.
needs_inference: When False, skip inference setup (credentials, gateway, telemetry).
+ needs_model_specs: When True, load real model specs even without inference.
Returns:
Initialized Pipelex instance.
@@ -47,7 +49,9 @@ def make_pipelex_for_cli(
typer.Exit: If initialization fails with a handled error.
"""
try:
- return Pipelex.make(integration_mode=IntegrationMode.CLI, library_dirs=library_dirs, needs_inference=needs_inference)
+ return Pipelex.make(
+ integration_mode=IntegrationMode.CLI, library_dirs=library_dirs, needs_inference=needs_inference, needs_model_specs=needs_model_specs
+ )
except TelemetryConfigValidationError as exc:
handle_telemetry_config_validation_error(exc)
except GatewayTermsNotAcceptedError as exc:
diff --git a/pipelex/cli/commands/validate/_validate_core.py b/pipelex/cli/commands/validate/_validate_core.py
index feab3776b..9feb6236b 100644
--- a/pipelex/cli/commands/validate/_validate_core.py
+++ b/pipelex/cli/commands/validate/_validate_core.py
@@ -130,7 +130,7 @@ def execute_validate(
telemetry_command_label: str = COMMAND,
) -> None:
"""Synchronous entry point wrapping the async validation with Pipelex setup/teardown."""
- make_pipelex_for_cli(context=ErrorContext.VALIDATION, needs_inference=False)
+ make_pipelex_for_cli(context=ErrorContext.VALIDATION, needs_inference=False, needs_model_specs=True)
try:
with get_telemetry_manager().telemetry_context():
diff --git a/pipelex/cli/commands/validate/pipe_cmd.py b/pipelex/cli/commands/validate/pipe_cmd.py
index ef8349756..5969b4d71 100644
--- a/pipelex/cli/commands/validate/pipe_cmd.py
+++ b/pipelex/cli/commands/validate/pipe_cmd.py
@@ -56,6 +56,7 @@ def validate_pipe_cmd(
context=ErrorContext.VALIDATION,
library_dirs=library_dirs_paths,
needs_inference=False,
+ needs_model_specs=True,
)
do_validate_all_libraries_and_dry_run(library_dirs=library_dirs_paths)
finally:
diff --git a/pipelex/pipelex.py b/pipelex/pipelex.py
index e8652c7b4..0d245dc00 100644
--- a/pipelex/pipelex.py
+++ b/pipelex/pipelex.py
@@ -157,6 +157,7 @@ If you need help, drop by our Discord: we're happy to assist: {URLs.discord}.
self,
integration_mode: IntegrationMode,
needs_inference: bool = True,
+ needs_model_specs: bool | None = None,
class_registry: ClassRegistryAbstract | None = None,
secrets_provider: SecretsProviderAbstract | None = None,
storage_provider: StorageProviderAbstract | None = None,
@@ -186,10 +187,12 @@ If you need help, drop by our Discord: we're happy to assist: {URLs.discord}.
# for now the only servic is the Pipelex Gateway
is_pipelex_service_enabled = is_pipelex_gateway_enabled()
+ effective_needs_model_specs = needs_model_specs if needs_model_specs is not None else needs_inference
+
remote_config: RemoteConfig | None = None
gateway_model_specs: BackendModelSpecs | None = None
if is_pipelex_service_enabled:
- if not needs_inference:
+ if not effective_needs_model_specs:
# Use dummy config when inference is not needed (for testing without network access)
remote_config = RemoteConfigFetcher.make_dummy_remote_config()
gateway_model_specs = remote_config.backend_model_specs
@@ -395,6 +398,7 @@ If you need help, drop by our Discord: we're happy to assist: {URLs.discord}.
cls,
integration_mode: IntegrationMode = IntegrationMode.PYTHON,
needs_inference: bool = True,
+ needs_model_specs: bool | None = None,
class_registry: ClassRegistryAbstract | None = None,
secrets_provider: SecretsProviderAbstract | None = None,
storage_provider: StorageProviderAbstract | None = None,
@@ -422,6 +426,9 @@ If you need help, drop by our Discord: we're happy to assist: {URLs.discord}.
content generator and loading backends leniently (skipping those with missing
credentials). This skips gateway terms check and model deck validation.
Useful for commands like validate/show that don't call inference APIs.
+ needs_model_specs: When True, load real model specs even if needs_inference
+ is False. When None (default), follows needs_inference. Useful for validate
+ commands that need gateway-provided model specs without enabling full inference.
class_registry: Custom class registry for dynamic loading
secrets_provider: Custom secrets/credentials provider
storage_provider: Custom storage backend
@@ -455,6 +462,7 @@ If you need help, drop by our Discord: we're happy to assist: {URLs.discord}.
pipelex_instance.setup(
integration_mode=integration_mode,
needs_inference=needs_inference,
+ needs_model_specs=needs_model_specs,
class_registry=class_registry,
secrets_provider=secrets_provider,
storage_provider=storage_provider,