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.
Refactor/cleaning (#558)
Louis Choquel9b217b11ad33
diff --git a/.blackboxrules b/.blackboxrulesindex b34c89a60..df84a2fb8 100644--- a/.blackboxrules+++ b/.blackboxrules@@ -261,7 +261,8 @@ This document outlines the core coding standards, best practices, and quality co### Unit test generalities-NEVER USE unittest.mock. YOU MUST USE pytest-mock instead.+NEVER USE unittest.mock. Instead YOU MUST USE pytest-mock: `from pytest_mock import MockerFixture`.+NEVER EVER put more than one TestClass into a test module.#### Test file structure@@ -274,7 +275,9 @@ NEVER USE unittest.mock. YOU MUST USE pytest-mock instead.- Do NOT add `__init__.py` files to test directories. Test directories do not need to be Python packages.- Fixtures are defined in conftest.py modules at different levels of the hierarchy, their scope is handled by pytest- Test data is placed inside test_data.py at different levels of the hierarchy, they must be imported with package paths from the root like `from tests.integration.pipelex.cogt.test_data`. Their content is all constants, regrouped inside classes to keep things tidy.-- Always put test inside Test classes: 1 TestClass per module.+- Always put tests inside Test classes: 1 TestClass per module.+- NEVER EVER put more than one TestClass into a test module.+- Put fixtures into conftest.py files for easy sharing.#### Markers@@ -333,7 +336,7 @@ class TestFooBar:- Verify working memory state- Check output structure and content- Use meaningful test case names-- Include docstrings explaining test purpose but not on top of the file and not on top of the class.+- Include concise docstrings explaining test purpose but not on top of the file and not on top of the class.- Log outputs for debugging## Writing Docsdiff --git a/.cursor/commands/changelog.md b/.cursor/commands/changelog.mdnew file mode 100644index 000000000..b48bb7f1b--- /dev/null+++ b/.cursor/commands/changelog.md@@ -0,0 +1,33 @@+# Update CHANGELOG.md (Unreleased)++You will be given a block of “changes” immediately after this message (pasted by the user).+Your job: update the repository changelog.++## Target file+- Prefer `CHANGELOG.md` at the repo root.+- If not found, search the repo for a changelog file (common names: CHANGELOG.md, Changelog.md, changelog.md) and use the main one.++## Rules (must follow)+1) Keep existing formatting and conventions of the file.+2) Update ONLY the `Unreleased` section:+ - If a `## [Unreleased]` (or `## Unreleased`) section exists, merge the pasted changes into it.+ - If it does not exist, create it near the top of the changelog:+ - After the main title/introduction+ - Before the first released version section+3) Merge behavior:+ - If the pasted changes already contain subsection headings like `### Added`, `### Changed`, `### Fixed`, etc., merge bullets under matching subsections in Unreleased.+ - If a needed subsection doesn’t exist under Unreleased, create it.+ - If the pasted changes do NOT include headings, classify each line into one of:+ - Added / Changed / Deprecated / Removed / Fixed / Security+ - Use best-effort classification by wording (add/introduce -> Added, fix/bug -> Fixed, remove/delete -> Removed, security/vuln -> Security, deprecate -> Deprecated, otherwise -> Changed)+ - If onf of the pasted changes seems worthy of highlighting, propose to the user to do so and get their approval.+4) De-duplicate:+ - If a very similar bullet already exists in Unreleased, do not add it again.+5) Preserve order:+ - Keep the pasted changes in the order provided within each subsection.++## Output+- Make the minimal necessary edits to the changelog file.+- When done, reply with:+ - A brief summary of what you added (by subsection)+ - The exact diff or the updated Unreleased section (whichever is shorter).diff --git a/.cursor/rules/pytest_standards.mdc b/.cursor/rules/pytest_standards.mdcindex c597b959b..6ef2b1d99 100644--- a/.cursor/rules/pytest_standards.mdc+++ b/.cursor/rules/pytest_standards.mdc@@ -8,7 +8,8 @@ globs:## Unit test generalities-NEVER USE unittest.mock. YOU MUST USE pytest-mock instead.+NEVER USE unittest.mock. Instead YOU MUST USE pytest-mock: `from pytest_mock import MockerFixture`.+NEVER EVER put more than one TestClass into a test module.### Test file structure@@ -21,7 +22,9 @@ NEVER USE unittest.mock. YOU MUST USE pytest-mock instead.- Do NOT add `__init__.py` files to test directories. Test directories do not need to be Python packages.- Fixtures are defined in conftest.py modules at different levels of the hierarchy, their scope is handled by pytest- Test data is placed inside test_data.py at different levels of the hierarchy, they must be imported with package paths from the root like `from tests.integration.pipelex.cogt.test_data`. Their content is all constants, regrouped inside classes to keep things tidy.-- Always put test inside Test classes: 1 TestClass per module.+- Always put tests inside Test classes: 1 TestClass per module.+- NEVER EVER put more than one TestClass into a test module.+- Put fixtures into conftest.py files for easy sharing.### Markers@@ -80,5 +83,5 @@ class TestFooBar:- Verify working memory state- Check output structure and content- Use meaningful test case names-- Include docstrings explaining test purpose but not on top of the file and not on top of the class.+- Include concise docstrings explaining test purpose but not on top of the file and not on top of the class.- Log outputs for debuggingdiff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.mdindex b34c89a60..df84a2fb8 100644--- a/.github/copilot-instructions.md+++ b/.github/copilot-instructions.md@@ -261,7 +261,8 @@ This document outlines the core coding standards, best practices, and quality co### Unit test generalities-NEVER USE unittest.mock. YOU MUST USE pytest-mock instead.+NEVER USE unittest.mock. Instead YOU MUST USE pytest-mock: `from pytest_mock import MockerFixture`.+NEVER EVER put more than one TestClass into a test module.#### Test file structure@@ -274,7 +275,9 @@ NEVER USE unittest.mock. YOU MUST USE pytest-mock instead.- Do NOT add `__init__.py` files to test directories. Test directories do not need to be Python packages.- Fixtures are defined in conftest.py modules at different levels of the hierarchy, their scope is handled by pytest- Test data is placed inside test_data.py at different levels of the hierarchy, they must be imported with package paths from the root like `from tests.integration.pipelex.cogt.test_data`. Their content is all constants, regrouped inside classes to keep things tidy.-- Always put test inside Test classes: 1 TestClass per module.+- Always put tests inside Test classes: 1 TestClass per module.+- NEVER EVER put more than one TestClass into a test module.+- Put fixtures into conftest.py files for easy sharing.#### Markers@@ -333,7 +336,7 @@ class TestFooBar:- Verify working memory state- Check output structure and content- Use meaningful test case names-- Include docstrings explaining test purpose but not on top of the file and not on top of the class.+- Include concise docstrings explaining test purpose but not on top of the file and not on top of the class.- Log outputs for debugging## Writing Docsdiff --git a/.pipelex/inference/backends/anthropic.toml b/.pipelex/inference/backends/anthropic.tomlindex 729e2d107..0f04f4d76 100644--- a/.pipelex/inference/backends/anthropic.toml+++ b/.pipelex/inference/backends/anthropic.toml@@ -39,14 +39,6 @@ outputs = ["text", "structured"]max_prompt_images = 100costs = { input = 0.25, output = 1.25 }-[claude-3-opus]-model_id = "claude-3-opus-20240229"-max_tokens = 4096-inputs = ["text", "images"]-outputs = ["text", "structured"]-max_prompt_images = 100-costs = { input = 15.0, output = 75.0 }-# --- Claude 3.7 Series --------------------------------------------------------["claude-3.7-sonnet"]model_id = "claude-3-7-sonnet-20250219"diff --git a/.pipelex/inference/backends/pipelex_gateway_models.md b/.pipelex/inference/backends/pipelex_gateway_models.mdnew file mode 100644index 000000000..22f9ba7a6--- /dev/null+++ b/.pipelex/inference/backends/pipelex_gateway_models.md@@ -0,0 +1,75 @@+# Pipelex Gateway - Available Models++> **AUTO-GENERATED FILE** - Do not edit manually.+> Last updated: 2026-01-06T15:33:39Z+>+> Run `pipelex-dev update-gateway-models` or `make ugm` to regenerate.++This file documents models available through Pipelex Gateway.+For configuration details, see the [documentation](https://docs.pipelex.com/home/5-setup/configure-ai-providers/#option-1-pipelex-gateway-easiest-for-getting-started).++## Language Models (LLM)++| Model | Inputs | Outputs | SDK | Structure Method |+|-------|--------|---------|-----|------------------|+| claude-3.7-sonnet | text, images | text, structured | gateway_completions | instructor/openai_tools |+| claude-4-opus | text, images | text, structured | gateway_completions | instructor/openai_tools |+| claude-4-sonnet | text, images | text, structured | gateway_completions | instructor/openai_tools |+| claude-4.1-opus | text, images | text, structured | gateway_completions | instructor/openai_tools |+| claude-4.5-haiku | text, images | text, structured | gateway_completions | instructor/openai_tools |+| claude-4.5-opus | text, images | text, structured | gateway_completions | instructor/openai_tools |+| claude-4.5-sonnet | text, images | text, structured | gateway_completions | instructor/openai_tools |+| deepseek-v3.1 | text | text, structured | gateway_completions | instructor/json |+| gemini-2.0-flash | text, images | text, structured | gateway_completions | instructor/openai_tools |+| gemini-2.5-flash | text, images | text, structured | gateway_completions | instructor/openai_tools |+| gemini-2.5-flash-lite | text, images | text, structured | gateway_completions | instructor/openai_tools |+| gemini-2.5-pro | text, images | text, structured | gateway_completions | instructor/openai_tools |+| gemini-3.0-flash-preview | text, images | text, structured | gateway_completions | instructor/openai_tools |+| gemini-3.0-pro | text, images | text, structured | gateway_completions | instructor/openai_tools |+| gpt-4.1 | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| gpt-4.1-mini | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| gpt-4.1-nano | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| gpt-4o | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| gpt-4o-mini | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| gpt-5 | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| gpt-5-chat | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| gpt-5-mini | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| gpt-5-nano | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| gpt-5.1 | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| gpt-5.1-chat | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| gpt-5.1-codex | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| gpt-5.2 | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| gpt-5.2-chat | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| gpt-oss-120b | text | text, structured | gateway_completions | instructor/openai_tools |+| gpt-oss-20b | text | text, structured | gateway_completions | instructor/openai_tools |+| grok-3 | text | text, structured | gateway_completions | instructor/openai_tools |+| grok-3-mini | text | text, structured | gateway_completions | instructor/openai_tools |+| grok-4-fast-non-reasoning | text, images | text, structured | gateway_completions | instructor/openai_tools |+| o1 | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| o1-mini | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| o3 | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| o3-mini | text | text, structured | gateway_responses | instructor/openai_responses_tools |+| o4-mini | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| qwen3-vl-235b-a22b | text, images | text, structured | gateway_completions | instructor/json |++## Document Extraction Models++| Model | Inputs | Outputs | SDK | Structure Method |+|-------|--------|---------|-----|------------------|+| azure-document-intelligence | pdf | pages | gateway_extract | instructor/openai_tools |+| mistral-document-ai-2505 | pdf, image | pages | gateway_extract | instructor/openai_tools |++## Image Generation Models++| Model | Inputs | Outputs | SDK |+|-------|--------|---------|-----|+| fast-lightning-sdxl | text | image | gateway_img_gen |+| flux-2 | text | image | gateway_img_gen |+| flux-pro | text | image | gateway_img_gen |+| flux-pro/v1.1 | text | image | gateway_img_gen |+| flux-pro/v1.1-ultra | text | image | gateway_img_gen |+| gpt-image-1 | text | image | gateway_img_gen |+| gpt-image-1-mini | text | image | gateway_img_gen |+| gpt-image-1.5 | text | image | gateway_img_gen |+| nano-banana | text | image | gateway_completions |+| nano-banana-pro | text | image | gateway_completions |diff --git a/.pipelex/inference/backends/portkey.toml b/.pipelex/inference/backends/portkey.tomlindex 2080d0e14..75e2574e2 100644--- a/.pipelex/inference/backends/portkey.toml+++ b/.pipelex/inference/backends/portkey.toml@@ -161,15 +161,6 @@ max_prompt_images = 100costs = { input = 0.25, output = 1.25 }x-portkey-provider = "@anthropic"-[claude-3-opus]-model_id = "claude-3-opus-20240229"-max_tokens = 4096-inputs = ["text", "images"]-outputs = ["text", "structured"]-max_prompt_images = 100-costs = { input = 15.0, output = 75.0 }-x-portkey-provider = "@anthropic"-["claude-3.7-sonnet"]model_id = "claude-3-7-sonnet-20250219"max_tokens = 8192diff --git a/.pipelex/inference/routing_profiles.toml b/.pipelex/inference/routing_profiles.tomlindex d27e659ac..fb0140cab 100644--- a/.pipelex/inference/routing_profiles.toml+++ b/.pipelex/inference/routing_profiles.toml@@ -138,7 +138,7 @@ default = "internal"# =========================================================================================[profiles.example_routing_using_patterns]description = "Example routing profile using patterns"-default = "pipelex_inference"+default = "pipelex_gateway"[profiles.example_routing_using_patterns.routes]# Pattern matching: "model-pattern" = "backend-name"@@ -158,17 +158,17 @@ default = "pipelex_inference"description = "Example routing profile using specific models"[profiles.example_routing_using_specific_models.routes]-"gpt-5-nano" = "pipelex_inference"+"gpt-5-nano" = "pipelex_gateway""gpt-4o-mini" = "blackboxai""gpt-5-mini" = "openai""gpt-5-chat" = "azure_openai"-"claude-4-sonnet" = "pipelex_inference"+"claude-4-sonnet" = "pipelex_gateway""claude-3.7-sonnet" = "blackboxai"-"gemini-2.5-flash-lite" = "pipelex_inference"+"gemini-2.5-flash-lite" = "pipelex_gateway""gemini-2.5-flash" = "blackboxai""gemini-2.5-pro" = "vertexai"-"grok-3" = "pipelex_inference"+"grok-3" = "pipelex_gateway""grok-3-mini" = "xai"diff --git a/.pipelex/pipelex.toml b/.pipelex/pipelex.tomlindex 2032e08cc..62f9e95ef 100644--- a/.pipelex/pipelex.toml+++ b/.pipelex/pipelex.toml@@ -101,7 +101,6 @@[pipelex.feature_config]# WIP/Experimental feature flags:-# is_pipeline_tracking_enabled = false# is_reporting_enabled = true[pipelex.reporting_config]diff --git a/.windsurfrules.md b/.windsurfrules.mdindex b34c89a60..df84a2fb8 100644--- a/.windsurfrules.md+++ b/.windsurfrules.md@@ -261,7 +261,8 @@ This document outlines the core coding standards, best practices, and quality co### Unit test generalities-NEVER USE unittest.mock. YOU MUST USE pytest-mock instead.+NEVER USE unittest.mock. Instead YOU MUST USE pytest-mock: `from pytest_mock import MockerFixture`.+NEVER EVER put more than one TestClass into a test module.#### Test file structure@@ -274,7 +275,9 @@ NEVER USE unittest.mock. YOU MUST USE pytest-mock instead.- Do NOT add `__init__.py` files to test directories. Test directories do not need to be Python packages.- Fixtures are defined in conftest.py modules at different levels of the hierarchy, their scope is handled by pytest- Test data is placed inside test_data.py at different levels of the hierarchy, they must be imported with package paths from the root like `from tests.integration.pipelex.cogt.test_data`. Their content is all constants, regrouped inside classes to keep things tidy.-- Always put test inside Test classes: 1 TestClass per module.+- Always put tests inside Test classes: 1 TestClass per module.+- NEVER EVER put more than one TestClass into a test module.+- Put fixtures into conftest.py files for easy sharing.#### Markers@@ -333,7 +336,7 @@ class TestFooBar:- Verify working memory state- Check output structure and content- Use meaningful test case names-- Include docstrings explaining test purpose but not on top of the file and not on top of the class.+- Include concise docstrings explaining test purpose but not on top of the file and not on top of the class.- Log outputs for debugging## Writing Docsdiff --git a/AGENTS.md b/AGENTS.mdindex dbdeb9260..9b2956dca 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -218,7 +218,8 @@ This document outlines the core coding standards, best practices, and quality co### Unit test generalities-NEVER USE unittest.mock. YOU MUST USE pytest-mock instead.+NEVER USE unittest.mock. Instead YOU MUST USE pytest-mock: `from pytest_mock import MockerFixture`.+NEVER EVER put more than one TestClass into a test module.#### Test file structure@@ -231,7 +232,9 @@ NEVER USE unittest.mock. YOU MUST USE pytest-mock instead.- Do NOT add `__init__.py` files to test directories. Test directories do not need to be Python packages.- Fixtures are defined in conftest.py modules at different levels of the hierarchy, their scope is handled by pytest- Test data is placed inside test_data.py at different levels of the hierarchy, they must be imported with package paths from the root like `from tests.integration.pipelex.cogt.test_data`. Their content is all constants, regrouped inside classes to keep things tidy.-- Always put test inside Test classes: 1 TestClass per module.+- Always put tests inside Test classes: 1 TestClass per module.+- NEVER EVER put more than one TestClass into a test module.+- Put fixtures into conftest.py files for easy sharing.#### Markers@@ -290,7 +293,7 @@ class TestFooBar:- Verify working memory state- Check output structure and content- Use meaningful test case names-- Include docstrings explaining test purpose but not on top of the file and not on top of the class.+- Include concise docstrings explaining test purpose but not on top of the file and not on top of the class.- Log outputs for debugging## Writing Docsdiff --git a/CHANGELOG.md b/CHANGELOG.mdindex 9ed023b0e..a4d55f4dd 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -55,6 +55,10 @@- Validation for Pipelex Bundle concept keys: cannot create a native concept- Validation for `PipeSequence`: The multiplicity of the output of the sequence must be the same as the multiplicity of the output of the last step.- Validation for `PipeFunc`: The multiplicity of the output of the pipe must be the same as the multiplicity of the output of the function: If the multiplicity is true, the return type of the function must be a subclass of `ListContent`. If the multiplicity is false, the return type of the function must not be a subclass of `ListContent`.+- **Pipelex Gateway Model Management**: New CLI commands (`pipelex-dev update-gateway-models`, `pipelex-dev check-gateway-models`) and corresponding `make` targets (`ugm`, `cgm`) to generate and verify gateway model catalog. CI now validates this documentation is up-to-date.+- `pipelex init agreement` command: Allows accepting Gateway terms of service without resetting entire configuration.+- Test suite pre-flight check: Verifies Gateway terms acceptance before running tests, providing clear error messages.+- "Gateway Available Models" documentation page: Auto-generated reference of all LLM, Document Extraction, and Image Generation models available through the Gateway.### Fixed- Fixed a bug with the validation of the multiplicity of the output of the `PipeCondition`.@@ -99,6 +103,7 @@### Removed- **`openai_utils` Module**: Removed `pipelex.plugins.openai.openai_utils`; logic now in centralized image preparation utilities.+- **Pipeline Tracking feature**: Removed entirely, including the `pipelex/pipeline/track` module, `PipelineTracker` components, related configuration, tracker calls in pipe controllers, and associated documentation.### Deprecateddiff --git a/CLAUDE.md b/CLAUDE.mdindex b34c89a60..df84a2fb8 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -261,7 +261,8 @@ This document outlines the core coding standards, best practices, and quality co### Unit test generalities-NEVER USE unittest.mock. YOU MUST USE pytest-mock instead.+NEVER USE unittest.mock. Instead YOU MUST USE pytest-mock: `from pytest_mock import MockerFixture`.+NEVER EVER put more than one TestClass into a test module.#### Test file structure@@ -274,7 +275,9 @@ NEVER USE unittest.mock. YOU MUST USE pytest-mock instead.- Do NOT add `__init__.py` files to test directories. Test directories do not need to be Python packages.- Fixtures are defined in conftest.py modules at different levels of the hierarchy, their scope is handled by pytest- Test data is placed inside test_data.py at different levels of the hierarchy, they must be imported with package paths from the root like `from tests.integration.pipelex.cogt.test_data`. Their content is all constants, regrouped inside classes to keep things tidy.-- Always put test inside Test classes: 1 TestClass per module.+- Always put tests inside Test classes: 1 TestClass per module.+- NEVER EVER put more than one TestClass into a test module.+- Put fixtures into conftest.py files for easy sharing.#### Markers@@ -333,7 +336,7 @@ class TestFooBar:- Verify working memory state- Check output structure and content- Use meaningful test case names-- Include docstrings explaining test purpose but not on top of the file and not on top of the class.+- Include concise docstrings explaining test purpose but not on top of the file and not on top of the class.- Log outputs for debugging## Writing Docsdiff --git a/Makefile b/Makefileindex 891ed8c63..ceb32ae7b 100644--- a/Makefile+++ b/Makefile@@ -62,7 +62,12 @@ make ccs - Shorthand -> check-config-syncmake check-rules - Verify installed agent rules match kit templatesmake check-urls - Check all URLs in pipelex/urls.py for broken links (quiet)make cu - Check URLs with verbose output (shows details)+make update-gateway-models - Update gateway models reference+make ugm - Shorthand -> update-gateway-models+make check-gateway-models - Check gateway models reference is up-to-date+make cgm - Shorthand -> check-gateway-models+make up - Shorthand -> update-gateway-models up-kit-configs rulesmake cleanenv - Remove virtual env and lock filesmake cleanderived - Remove extraneous compiled files, caches, logs, etc.make cleanall - Remove all -> cleanenv + cleanderived@@ -124,7 +129,7 @@ export HELPvalidate v check c cc agent-check \merge-check-ruff-lint merge-check-ruff-format merge-check-mypy merge-check-pyright \li check-unused-imports fix-unused-imports check-TODOs docs docs-check docs-deploy \- test-count check-test-badge+ test-count check-test-badge update-gateway-models ugm check-gateway-models cgm upall help:@echo "$$HELP"@@ -235,6 +240,20 @@ check-config-sync: envccs: check-config-sync@echo "> done: ccs = check-config-sync"+update-gateway-models: env+ $(call PRINT_TITLE,"Updating gateway models reference")+ $(VENV_PIPELEX_DEV) update-gateway-models++ugm: update-gateway-models+ @echo "> done: ugm = update-gateway-models"++check-gateway-models: env+ $(call PRINT_TITLE,"Checking gateway models reference is up-to-date")+ $(VENV_PIPELEX_DEV) check-gateway-models --quiet++cgm: check-gateway-models+ @echo "> done: cgm = check-gateway-models"+########################################################################################################################## Cleaning ##########################################################################################################################@@ -587,7 +606,10 @@ c: format lint pyright mypycc: cleanderived c@echo "> done: cc = cleanderived format lint pyright pylint mypy"-check: cc check-unused-imports check-config-sync check-rules check-urls pylint+up: update-gateway-models up-kit-configs rules+ @echo "> done: up = update-gateway-models up-kit-configs rules"++check: cc check-unused-imports check-config-sync check-rules check-urls check-gateway-models pylint@echo "> done: check"agent-check: fix-unused-imports format lint pyright mypydiff --git a/docs/home/10-advanced-customizations/index.md b/docs/home/10-advanced-customizations/index.mdindex 18440174f..84cc48580 100644--- a/docs/home/10-advanced-customizations/index.md+++ b/docs/home/10-advanced-customizations/index.md@@ -15,7 +15,6 @@ from pipelex import Pipelexpipelex = Pipelex.make(template_provider=MyTemplateProvider(),- pipeline_tracker=MyPipelineTracker(),reporting_delegate=MyReportingDelegate(),secrets_provider=MySecretsProvider(),content_generator=MyContentGenerator(),@@ -38,7 +37,6 @@ hub.set_template_provider(MyTemplateProvider())Some components have "NoOp" (No Operation) implementations that are used when the feature is disabled:- `ReportingNoOp`: Used when reporting is disabled-- `PipelineTrackerNoOp`: Used when pipeline tracking is disabled- `ActivityManagerNoOp`: Used when activity tracking is disabledThese NoOp implementations implement the same protocol but do nothing, allowing the system to function without the specific feature.@@ -58,7 +56,6 @@ All custom implementations MUST:Some components are controlled by feature flags in the configuration:- `is_reporting_enabled`: Controls Reporting system-- `is_pipeline_tracking_enabled`: Controls Pipeline TrackingWhen a feature is disabled, the corresponding NoOp implementation is used automatically.@@ -68,36 +65,30 @@ Pipelex supports injection of the following components:**Template Provider** (`TemplateLibrary`)- - Protocol: `TemplateProviderAbstract`- - Default: `TemplateLibrary`- - [Details](template-provider-injection.md)+- Protocol: `TemplateProviderAbstract`+- Default: `TemplateLibrary`+- [Details](template-provider-injection.md)**Reporting Delegate** (`ReportingManager`)- - Protocol: `ReportingProtocol`- - Default: `ReportingManager` or `ReportingNoOp` if disabled- - [Details](reporting-delegate-injection.md)--**Pipeline Tracker** (`PipelineTracker`)-- - Protocol: `PipelineTrackerProtocol`- - Default: `PipelineTracker` or `PipelineTrackerNoOp` if disabled- - [Details](pipeline-tracker-injection.md)+- Protocol: `ReportingProtocol`+- Default: `ReportingManager` or `ReportingNoOp` if disabled+- [Details](reporting-delegate-injection.md)**Secrets Provider** (`EnvSecretsProvider`)- - Protocol: `SecretsProviderAbstract`- - Default: `EnvSecretsProvider`- - [Details](secrets-provider-injection.md)+- Protocol: `SecretsProviderAbstract`+- Default: `EnvSecretsProvider`+- [Details](secrets-provider-injection.md)**Content Generator** (`ContentGenerator`)- - Protocol: `ContentGeneratorProtocol`- - Default: `ContentGenerator`- - [Details](content-generator-injection.md)--**Pipe Router** (`PipeRouter`)- - Protocol: `PipeRouterProtocol`- - Default: `PipeRouter`- - [Details](pipe-router-injection.md)+- Protocol: `ContentGeneratorProtocol`+- Default: `ContentGenerator`+- [Details](content-generator-injection.md)++**Pipe Router** (`PipeRouter`)+- Protocol: `PipeRouterProtocol`+- Default: `PipeRouter`+- [Details](pipe-router-injection.md)diff --git a/docs/home/10-advanced-customizations/pipeline-tracker-injection.md b/docs/home/10-advanced-customizations/pipeline-tracker-injection.mddeleted file mode 100644index 928ccb004..000000000--- a/docs/home/10-advanced-customizations/pipeline-tracker-injection.md+++ /dev/null@@ -1,4 +0,0 @@-# Pipeline Tracker Injection--!!! warning "Under Construction"- This section is currently under development.diff --git a/docs/home/4-cookbook-examples/invoice-extractor.md b/docs/home/4-cookbook-examples/invoice-extractor.mdindex 233e2c687..d5353ac83 100644--- a/docs/home/4-cookbook-examples/invoice-extractor.md+++ b/docs/home/4-cookbook-examples/invoice-extractor.md@@ -22,16 +22,14 @@ async def process_invoice(pdf_url: str) -> ListContent[Invoice]:return pipe_output.main_stuff_as_list(item_type=Invoice)```-This example also showcases some of the powerful observer features of Pipelex. After the pipeline runs, it generates a cost report and a flowchart of the execution.+This example also showcases some of the powerful observer features of Pipelex. After the pipeline runs, it generates a cost report.```python# Print the cost reportingget_report_delegate().generate_report()--# Print the flowchart url of the pipeline.-get_pipeline_tracker().output_flowchart()```-This is invaluable for understanding the cost and the execution flow of your pipelines.++This is invaluable for understanding the cost of your pipelines.## The Data Structure: `Invoice` Modeldiff --git a/docs/home/5-setup/configure-ai-providers.md b/docs/home/5-setup/configure-ai-providers.mdindex 4dace4584..9022f62b1 100644--- a/docs/home/5-setup/configure-ai-providers.md+++ b/docs/home/5-setup/configure-ai-providers.md@@ -31,7 +31,7 @@ Get **free credits** for testing and development with a single API key that work3. Run `pipelex init` and accept the Gateway terms of service when prompted.-That's it! Your pipelines can now access any supported LLM.+That's it! Your pipelines can now access any supported LLM. See [Gateway Available Models](./gateway-models.md) for the full list.!!! info "Terms of Service & Telemetry"When using Pipelex Gateway, you'll be prompted to accept our terms of service. By using the Gateway, identified telemetry is automatically enabled (tied to your hashed API key) to help us monitor service quality and enforce fair usage.diff --git a/docs/home/5-setup/gateway-models.md b/docs/home/5-setup/gateway-models.mdnew file mode 100644index 000000000..d9081b667--- /dev/null+++ b/docs/home/5-setup/gateway-models.md@@ -0,0 +1,6 @@+---+title: Gateway Available Models+---++--8<-- ".pipelex/inference/backends/pipelex_gateway_models.md"+diff --git a/docs/home/7-configuration/config-advanced/feature-config.md b/docs/home/7-configuration/config-advanced/feature-config.mdindex 9f4b3b594..d36f27045 100644--- a/docs/home/7-configuration/config-advanced/feature-config.md+++ b/docs/home/7-configuration/config-advanced/feature-config.md@@ -6,13 +6,11 @@ The `FeatureConfig` class controls which features are enabled in Pipelex.```pythonclass FeatureConfig(ConfigModel):- is_pipeline_tracking_enabled: boolis_reporting_enabled: bool```### Fields-- `is_pipeline_tracking_enabled`: When true, enables pipeline tracking functionality- `is_reporting_enabled`: When true, enables the reporting system## Impact on Dependency Injection@@ -21,23 +19,10 @@ The feature flags directly affect which implementation is used for certain compo| Feature Flag | When True | When False ||--------------|-----------|------------|-| `is_pipeline_tracking_enabled` | `PipelineTracker` | `PipelineTrackerNoOp` || `is_reporting_enabled` | `ReportingManager` | `ReportingNoOp` |## Feature Details-### Pipeline Tracking--```toml-is_pipeline_tracking_enabled = true-```--- Controls whether pipeline execution tracking is enabled-- When enabled, tracks the flow and execution of pipelines using by default mermaid chart:- - View and edit charts at [Mermaid Live Editor](https://mermaid.live)-- Useful for debugging and monitoring pipeline behavior-- Default: `true`-### Reporting```toml@@ -52,9 +37,6 @@ is_reporting_enabled = true```toml[pipelex.feature_config]-# Enable pipeline tracking for debugging-is_pipeline_tracking_enabled = true-# Enable reporting for cost monitoringis_reporting_enabled = true```diff --git a/docs/home/7-configuration/config-practical/tracker-config.md b/docs/home/7-configuration/config-practical/tracker-config.mddeleted file mode 100644index ecd9e0039..000000000--- a/docs/home/7-configuration/config-practical/tracker-config.md+++ /dev/null@@ -1,130 +0,0 @@-# Tracker Configuration--The Tracker Configuration allows you to customize how your pipeline execution is tracked and visualized. The tracker creates a Mermaid flowchart visualization of your pipeline's execution, showing how data flows through different pipes and transformations.--## Overview--The pipeline tracker visualizes:--- Stuff nodes (data objects) and their transformations-- Pipe execution steps-- Batch processing branches-- Condition nodes and choices-- Aggregation steps--## Configuration Options--### Basic Settings--- `is_debug_mode` (bool): Enable or disable debug mode for tracking- - When enabled, shows additional information like:- - Node codes and internal identifiers- - Extended comments for repeated nodes- - Pipe codes in edge captions with comments--- `is_include_text_preview` (bool): Whether to include text previews in the tracking interface- - When enabled, shows first 100 characters of text content in stuff nodes- - Only applies to text-based stuff objects--- `is_include_interactivity` (bool): Enable or disable interactive features in the tracking interface--### Visual Settings--- `theme` (str | "auto"): The visual theme to use for the Mermaid flowchart-- - Use "auto" for automatic theme selection based on context- - Or specify a custom theme name--- `layout` (str | "auto"): The layout algorithm to use for graph visualization-- - Use "auto" for automatic layout selection- - Or specify a custom layout algorithm- - Affects how nodes and edges are arranged in the flowchart--- `wrapping_width` (int | "auto"): Text wrapping width for node labels-- - Use "auto" for automatic width adjustment- - Or specify a fixed width in characters- - Helps control the visual width of node content--- `nb_items_limit` (int | "unlimited"): Maximum number of items to display-- - Use "unlimited" for no limit- - Or specify a maximum number of items- - Helps manage visualization of large pipelines--### Graph Styling--- `sub_graph_colors` (List[str]): List of colors to use for sub-graphs-- - Colors are used to visually distinguish different pipeline layers- - Example: `["#1f77b4", "#ff7f0e", "#2ca02c"]`--- Edge Styles (all str type):-- - `pipe_edge_style`: Style for regular pipe transformation edges- - `branch_edge_style`: Style for batch processing branch edges- - `aggregate_edge_style`: Style for aggregation step edges- - `condition_edge_style`: Style for condition evaluation edges- - `choice_edge_style`: Style for condition choice result edges--## Example Configuration--```toml-[tracker]-is_debug_mode = false-is_include_text_preview = false-is_include_interactivity = false-theme = "base"-layout = "dagre"-wrapping_width = "auto"-nb_items_limit = "unlimited"-sub_graph_colors = ["#1f77b4", "#ff7f0e", "#2ca02c"]-pipe_edge_style = "---->"-branch_edge_style = "-...-"-aggregate_edge_style = "-...-"-condition_edge_style = "-----"-choice_edge_style = "-----"-```--## Property Accessors--The TrackerConfig class provides convenient property accessors that handle the "auto" and "unlimited" special values:--- `applied_theme`: Returns None for "auto", otherwise returns the theme name-- `applied_layout`: Returns None for "auto", otherwise returns the layout name-- `applied_wrapping_width`: Returns None for "auto", otherwise returns the width as an integer-- `applied_nb_items_limit`: Returns None for "unlimited", otherwise returns the limit as an integer--These properties make it easy to work with the configuration values in your code while maintaining the flexibility of automatic settings.--## Visualization Features--The tracker generates Mermaid flowcharts with the following features:--1. Node Types:-- - Start node (special)- - Stuff nodes (data objects)- - Condition nodes (for pipeline branching)--2. Edge Types:-- - Pipe edges (regular transformations)- - Branch edges (batch processing)- - Aggregate edges (combining results)- - Condition edges (with expressions)- - Choice edges (condition results)--3. Node Content:-- - Concept type and name- - Content preview (for text)- - Debug information (when debug mode is enabled)- - Comments and descriptions--4. Visual Organization:-- - Sub-graphs for different pipeline layers- - Color coding for visual distinction- - Different edge styles for different types of connectionsdiff --git a/docs/home/7-configuration/index.md b/docs/home/7-configuration/index.mdindex 0c4eab764..17b89de64 100644--- a/docs/home/7-configuration/index.md+++ b/docs/home/7-configuration/index.md@@ -23,7 +23,7 @@ For a complete list of all possible configuration options, refer to the configurThe main project configuration files are:-- `.pipelex/pipelex.toml`: project customization (logging, reporting, tracker, feature flags, etc.)+- `.pipelex/pipelex.toml`: project customization (logging, reporting, feature flags, etc.)- `.pipelex/telemetry.toml`: custom telemetry destinations- `.pipelex/inference/…`: inference backends, routing profiles, and model presetsdiff --git a/docs/home/9-tools/cli/init.md b/docs/home/9-tools/cli/init.mdindex d8eb8bf27..8f713e357 100644--- a/docs/home/9-tools/cli/init.md+++ b/docs/home/9-tools/cli/init.md@@ -42,7 +42,7 @@ pipelex init telemetryThis command creates the `.pipelex/` directory with:-- **pipelex.toml** - Main configuration file for logging, reporting, tracking, etc.+- **pipelex.toml** - Main configuration file for logging, reporting, etc.- **inference/** - AI backend and routing configuration- `backends.toml` - Backend provider settings- `routing_profiles.toml` - Model routing rulesdiff --git a/mkdocs.yml b/mkdocs.ymlindex ccd3e752f..40baecf37 100644--- a/mkdocs.yml+++ b/mkdocs.yml@@ -114,6 +114,7 @@ nav:- Setup (first run):- Overview: home/5-setup/index.md- Configure AI Providers: home/5-setup/configure-ai-providers.md+ - Gateway Available Models: home/5-setup/gateway-models.md- Project Organization: home/5-setup/project-organization.md- Telemetry: home/5-setup/telemetry.md- Build Reliable AI Workflows:@@ -161,7 +162,6 @@ nav:- Pipe Run: home/7-configuration/config-practical/pipe-run-config.md- Reporting: home/7-configuration/config-practical/reporting-config.md- Telemetry: home/7-configuration/config-practical/telemetry-config.md- - Tracker: home/7-configuration/config-practical/tracker-config.md- Technical Configuration:- AWS: home/7-configuration/config-technical/aws-config.md- Cogt: home/7-configuration/config-technical/cogt-config.md@@ -189,7 +189,6 @@ nav:- Overview: home/10-advanced-customizations/index.md- Secrets Provider: home/10-advanced-customizations/secrets-provider-injection.md- Reporting Delegate: home/10-advanced-customizations/reporting-delegate-injection.md- - Pipeline Tracker: home/10-advanced-customizations/pipeline-tracker-injection.md- Storage Provider: home/10-advanced-customizations/storage-provider-injection.md- Template Provider: home/10-advanced-customizations/template-provider-injection.md- Observer Provider: home/10-advanced-customizations/observer-provider-injection.mddiff --git a/pipelex/cli/commands/init/command.py b/pipelex/cli/commands/init/command.pyindex 64ad3e3a4..cf6407311 100644--- a/pipelex/cli/commands/init/command.py+++ b/pipelex/cli/commands/init/command.py@@ -16,6 +16,7 @@ from pipelex.cli.commands.init.config_files import init_configfrom pipelex.cli.commands.init.routing import customize_routing_profilefrom pipelex.cli.commands.init.telemetry import setup_telemetryfrom pipelex.cli.commands.init.ui.gateway_ui import (+ build_gateway_terms_panel,display_gateway_accepted_message,display_gateway_declined_message,prompt_gateway_acceptance,@@ -27,7 +28,10 @@ from pipelex.hub import get_consolefrom pipelex.kit.paths import get_kit_configs_dirfrom pipelex.system.configuration.config_loader import config_managerfrom pipelex.system.pipelex_service.pipelex_service_agreement import update_service_terms_acceptance-from pipelex.system.pipelex_service.pipelex_service_config import load_pipelex_service_config_if_exists+from pipelex.system.pipelex_service.pipelex_service_config import (+ is_pipelex_gateway_enabled,+ load_pipelex_service_config_if_exists,+)from pipelex.system.telemetry.telemetry_config import TELEMETRY_CONFIG_FILE_NAMEfrom pipelex.tools.misc.file_utils import path_exists@@ -136,6 +140,8 @@ def confirm_initialization(console.print("\n[yellow]Initialization cancelled.[/yellow]")if needs_config or needs_inference or needs_routing or needs_telemetry:match focus:+ case InitFocus.AGREEMENT:+ init_cmd_str = "pipelex init agreement"case InitFocus.ALL:init_cmd_str = "pipelex init"case InitFocus.CONFIG | InitFocus.INFERENCE | InitFocus.ROUTING | InitFocus.TELEMETRY:@@ -279,6 +285,57 @@ def execute_initialization(console.print()+def _init_agreement(console: Console) -> None:+ """Handle the agreement-only initialization flow.++ This prompts the user to accept Pipelex Gateway terms without resetting any configuration.+ If gateway is not enabled, it informs the user that no action is needed.++ Args:+ console: Rich Console instance for user interaction.+ """+ # Check if gateway is even enabled+ if not is_pipelex_gateway_enabled():+ console.print()+ console.print("[green]✓ Pipelex Gateway is not enabled.[/green]")+ console.print("[dim]No terms acceptance is required.[/dim]")+ console.print()+ return++ # Check current terms acceptance status+ pipelex_service_config = load_pipelex_service_config_if_exists(config_dir=config_manager.pipelex_config_dir)++ if pipelex_service_config is not None and pipelex_service_config.agreement.terms_accepted:+ console.print()+ console.print("[green]✓ Pipelex Gateway terms have already been accepted.[/green]")+ console.print()+ return++ # Show the terms panel and prompt for acceptance+ console.print()+ console.print(build_gateway_terms_panel())+ console.print()++ accepted = Confirm.ask(+ "[bold]Do you accept the Pipelex Gateway terms of service?[/bold]",+ console=console,+ default=True,+ )++ if accepted:+ display_gateway_accepted_message(console)+ update_service_terms_acceptance(accepted=True)+ else:+ display_gateway_declined_message(console)+ update_service_terms_acceptance(accepted=False)+ # Disable the gateway since terms were declined+ backends_toml_path = os.path.join(config_manager.pipelex_config_dir, "inference", "backends.toml")+ if path_exists(backends_toml_path):+ disable_gateway_backend(backends_toml_path)++ console.print()++def init_cmd(focus: InitFocus = InitFocus.ALL,skip_confirmation: bool = False,@@ -289,13 +346,18 @@ def init_cmd(of the configuration, overwriting any existing files.Args:- focus: What to initialize - 'config', 'inference', 'routing', 'telemetry', or 'all' (default)+ focus: What to initialize - 'agreement', 'config', 'inference', 'routing', 'telemetry', or 'all' (default)skip_confirmation: If True, skip the confirmation prompt (used when called from doctor --fix)"""+ console = get_console()++ # Handle agreement-only flow separately (no reset needed)+ if focus == InitFocus.AGREEMENT:+ _init_agreement(console)+ return+# Config updates are not yet supported - always resetreset = True-- console = get_console()pipelex_config_dir = config_manager.pipelex_config_dirtelemetry_config_path = os.path.join(pipelex_config_dir, TELEMETRY_CONFIG_FILE_NAME)backends_toml_path = os.path.join(pipelex_config_dir, "inference", "backends.toml")diff --git a/pipelex/cli/commands/init/ui/types.py b/pipelex/cli/commands/init/ui/types.pyindex 274ce2115..be03f89fa 100644--- a/pipelex/cli/commands/init/ui/types.py+++ b/pipelex/cli/commands/init/ui/types.py@@ -7,6 +7,7 @@ class InitFocus(StrEnum):"""Focus options for initialization."""ALL = "all"+ AGREEMENT = "agreement"CONFIG = "config"INFERENCE = "inference"ROUTING = "routing"diff --git a/pipelex/cli/dev_cli/_dev_cli.py b/pipelex/cli/dev_cli/_dev_cli.pyindex 6e643e197..0a9625a04 100644--- a/pipelex/cli/dev_cli/_dev_cli.py+++ b/pipelex/cli/dev_cli/_dev_cli.py@@ -9,8 +9,10 @@ from typer.core import TyperGroupfrom typing_extensions import overridefrom pipelex.cli.dev_cli.commands.check_config_sync_cmd import LeadingConfig, check_config_sync_cmd+from pipelex.cli.dev_cli.commands.check_gateway_models_cmd import check_gateway_models_cmdfrom pipelex.cli.dev_cli.commands.check_rules_sync_cmd import check_rules_sync_cmdfrom pipelex.cli.dev_cli.commands.check_urls_cmd import DEFAULT_TIMEOUT, check_urls_cmd+from pipelex.cli.dev_cli.commands.update_gateway_models_cmd import update_gateway_models_cmdfrom pipelex.hub import get_consolefrom pipelex.tools.misc.package_utils import get_package_version@@ -21,7 +23,7 @@ class PipelexDevCLI(TyperGroup):@overridedef list_commands(self, ctx: Context) -> list[str]:"""List commands in proper order."""- return ["check-config-sync", "check-rules", "check-urls"]+ return ["check-config-sync", "check-gateway-models", "check-rules", "check-urls", "update-gateway-models"]@overridedef get_command(self, ctx: Context, cmd_name: str) -> Command | None:@@ -94,3 +96,20 @@ def check_urls_command() -> None:"""Check all URLs in pipelex/urls.py for broken links."""check_urls_cmd(quiet=quiet, timeout=timeout)++[email protected](name="check-gateway-models", help="Verify that gateway models reference is up-to-date")+def check_gateway_models_command(+ show_diff: Annotated[bool, typer.Option("--show-diff/--no-diff", help="Show differences if found")] = True,+ quiet: Annotated[bool, typer.Option("--quiet", "-q", help="Output only a single validation line")] = False,+) -> None:+ """Verify that the Pipelex Gateway models reference file is up-to-date."""+ check_gateway_models_cmd(show_diff=show_diff, quiet=quiet)++[email protected](name="update-gateway-models", help="Update the gateway models reference file")+def update_gateway_models_command(+ quiet: Annotated[bool, typer.Option("--quiet", "-q", help="Output only a single validation line")] = False,+) -> None:+ """Update the Pipelex Gateway models reference file from remote config."""+ update_gateway_models_cmd(quiet=quiet)diff --git a/pipelex/cli/dev_cli/commands/check_gateway_models_cmd.py b/pipelex/cli/dev_cli/commands/check_gateway_models_cmd.pynew file mode 100644index 000000000..638a1c722--- /dev/null+++ b/pipelex/cli/dev_cli/commands/check_gateway_models_cmd.py@@ -0,0 +1,176 @@+"""Command to verify the Pipelex Gateway models reference file is up-to-date."""++from __future__ import annotations++import sys+from difflib import unified_diff+from typing import TYPE_CHECKING++from rich.panel import Panel++from pipelex.cli.dev_cli.commands.gateway_models_generator import (+ fetch_gateway_model_specs,+ generate_reference_markdown,+)+from pipelex.cli.dev_cli.commands.update_gateway_models_cmd import GATEWAY_MODELS_REFERENCE_PATH+from pipelex.hub import get_console+from pipelex.system.pipelex_service.exceptions import RemoteConfigFetchError, RemoteConfigValidationError++if TYPE_CHECKING:+ from rich.console import Console+++def check_gateway_models_cmd(show_diff: bool = True, quiet: bool = False) -> None:+ """Verify that the Pipelex Gateway models reference file is up-to-date.++ Compares the existing reference file against the current remote config.++ Args:+ show_diff: If True, display the differences when found.+ quiet: If True, output only a single validation line (for use in Make targets).+ """+ console = get_console()++ if not quiet:+ console.print()+ console.print("[bold]Checking Pipelex Gateway models reference...[/bold]")+ console.print()++ # Check if reference file exists+ if not GATEWAY_MODELS_REFERENCE_PATH.exists():+ if quiet:+ console.print("[red]✗ Gateway models check: FAILED[/red] - Reference file does not exist")+ else:+ error_panel = Panel(+ f"[red]✗[/red] Reference file does not exist\n\n[dim]{GATEWAY_MODELS_REFERENCE_PATH}[/dim]",+ title="[bold red]Gateway Models Check: FAILED[/bold red]",+ border_style="red",+ padding=(1, 2),+ )+ console.print(error_panel)+ console.print()+ console.print("[bold yellow]Recommended Action:[/bold yellow]")+ console.print(" Run: [cyan]make update-gateway-models[/cyan] or [cyan]make ugm[/cyan]")+ console.print()+ sys.exit(1)++ # Fetch remote config+ try:+ model_specs = fetch_gateway_model_specs()+ except RemoteConfigFetchError as exc:+ if quiet:+ console.print(f"[red]✗ Gateway models check: FAILED[/red] - {exc}")+ else:+ error_panel = Panel(+ f"[red]✗[/red] Failed to fetch remote configuration\n\n[dim]{exc}[/dim]",+ title="[bold red]Gateway Models Check: FAILED[/bold red]",+ border_style="red",+ padding=(1, 2),+ )+ console.print(error_panel)+ console.print()+ sys.exit(1)+ except RemoteConfigValidationError as exc:+ if quiet:+ console.print(f"[red]✗ Gateway models check: FAILED[/red] - {exc}")+ else:+ error_panel = Panel(+ f"[red]✗[/red] Invalid remote configuration\n\n[dim]{exc}[/dim]",+ title="[bold red]Gateway Models Check: FAILED[/bold red]",+ border_style="red",+ padding=(1, 2),+ )+ console.print(error_panel)+ console.print()+ sys.exit(1)++ # Generate expected content+ expected_content = generate_reference_markdown(model_specs)++ # Read existing content+ existing_content = GATEWAY_MODELS_REFERENCE_PATH.read_text(encoding="utf-8")++ # Compare content (ignoring timestamp line for comparison)+ def normalize_for_comparison(content: str) -> str:+ """Remove timestamp line for comparison since it changes every generation."""+ lines = content.split("\n")+ return "\n".join(line for line in lines if not line.startswith("> Last updated:"))++ existing_normalized = normalize_for_comparison(existing_content)+ expected_normalized = normalize_for_comparison(expected_content)++ if existing_normalized == expected_normalized:+ # No differences found+ if quiet:+ console.print("[green]✓ Gateway models check: PASSED[/green]")+ else:+ success_panel = Panel(+ f"[green]✓[/green] Reference file is up-to-date!\n\n[dim]File: {GATEWAY_MODELS_REFERENCE_PATH}[/dim]",+ title="[bold green]Gateway Models Check: PASSED[/bold green]",+ border_style="green",+ padding=(1, 2),+ )+ console.print(success_panel)+ console.print()+ else:+ # Differences found+ if quiet:+ console.print("[red]✗ Gateway models check: FAILED[/red] - Reference file is out of date")+ else:+ error_panel = Panel(+ "[red]✗[/red] Reference file is [bold]OUT OF DATE[/bold]!\n\n"+ f"[dim]The models in {GATEWAY_MODELS_REFERENCE_PATH} do not match the remote configuration.[/dim]",+ title="[bold red]Gateway Models Check: FAILED[/bold red]",+ border_style="red",+ padding=(1, 2),+ )+ console.print(error_panel)+ console.print()++ if show_diff:+ _display_diff(existing_content, expected_content, console)++ console.print("[bold yellow]Recommended Action:[/bold yellow]")+ console.print(" Run: [cyan]make update-gateway-models[/cyan] or [cyan]make ugm[/cyan]")+ console.print()++ sys.exit(1)+++def _display_diff(existing: str, expected: str, console: Console) -> None:+ """Display a simplified diff between existing and expected content.++ Args:+ existing: Current file content.+ expected: Expected file content.+ console: Rich console for output.+ """+ existing_lines = existing.splitlines(keepends=True)+ expected_lines = expected.splitlines(keepends=True)++ diff = list(+ unified_diff(+ existing_lines,+ expected_lines,+ fromfile="existing (on disk)",+ tofile="expected (from remote)",+ lineterm="",+ )+ )++ if diff:+ console.print("[bold]Differences:[/bold]")+ console.print()+ for line in diff[:50]: # Limit output to first 50 lines+ line = line.rstrip("\n")+ if line.startswith("+") and not line.startswith("+++"):+ console.print(f"[green]{line}[/green]")+ elif line.startswith("-") and not line.startswith("---"):+ console.print(f"[red]{line}[/red]")+ elif line.startswith("@@"):+ console.print(f"[cyan]{line}[/cyan]")+ else:+ console.print(line)+ if len(diff) > 50:+ console.print(f"[dim]... and {len(diff) - 50} more lines[/dim]")+ console.print()diff --git a/pipelex/cli/dev_cli/commands/gateway_models_generator.py b/pipelex/cli/dev_cli/commands/gateway_models_generator.pynew file mode 100644index 000000000..93281dc03--- /dev/null+++ b/pipelex/cli/dev_cli/commands/gateway_models_generator.py@@ -0,0 +1,178 @@+"""Generator for Pipelex Gateway models reference file."""++from __future__ import annotations++from datetime import datetime, timezone+from operator import itemgetter+from typing import TYPE_CHECKING, Any, cast++from pipelex.system.pipelex_service.remote_config_fetcher import RemoteConfigFetcher+from pipelex.urls import URLs++if TYPE_CHECKING:+ from pipelex.cogt.model_backends.model_spec_factory import BackendModelSpecs++# Fields to include in the reference (excluding sensitive/internal details)+REFERENCE_FIELDS = frozenset({"model_type", "inputs", "outputs", "sdk", "structure_method"})++# Model type display names and order+MODEL_TYPE_SECTIONS = {+ "llm": "Language Models (LLM)",+ "text_extractor": "Document Extraction Models",+ "img_gen": "Image Generation Models",+}+++def fetch_gateway_model_specs() -> BackendModelSpecs:+ """Fetch model specifications from Pipelex Gateway remote config.++ Returns:+ Dictionary of model specifications.++ Raises:+ RemoteConfigFetchError: If the remote config cannot be fetched.+ RemoteConfigValidationError: If the remote config is invalid.+ """+ remote_config = RemoteConfigFetcher.fetch_remote_config()+ return dict(remote_config.backend_model_specs)+++def extract_reference_data(model_specs: BackendModelSpecs) -> dict[str, list[dict[str, Any]]]:+ """Extract and organize model data for the reference file.++ Args:+ model_specs: Raw model specifications from remote config.++ Returns:+ Dictionary mapping model_type to list of model info dicts.+ """+ # Get defaults for fallback values+ defaults = model_specs.get("defaults", {})+ default_model_type = defaults.get("model_type", "llm")+ default_sdk = defaults.get("sdk", "")+ default_structure_method = defaults.get("structure_method", "")++ # Group models by type+ models_by_type: dict[str, list[dict[str, Any]]] = {+ "llm": [],+ "text_extractor": [],+ "img_gen": [],+ }++ for model_name, spec in model_specs.items():+ # Skip defaults and non-dict entries+ if model_name == "defaults" or not isinstance(spec, dict):+ continue++ # Skip .rules sub-sections (e.g., "flux-pro.rules")+ if ".rules" in model_name:+ continue++ # Cast spec for type checking (we verified it's a dict above)+ spec_dict = cast("dict[str, Any]", spec)++ # Determine model type+ model_type: str = spec_dict.get("model_type", default_model_type)++ # Extract reference fields+ model_info: dict[str, Any] = {+ "name": model_name,+ "inputs": spec_dict.get("inputs", []),+ "outputs": spec_dict.get("outputs", []),+ "sdk": spec_dict.get("sdk", default_sdk),+ }++ # Only include structure_method for LLMs (not relevant for img_gen)+ if model_type in {"llm", "text_extractor"}:+ model_info["structure_method"] = spec_dict.get("structure_method", default_structure_method)++ # Add to appropriate group+ if model_type in models_by_type:+ models_by_type[model_type].append(model_info)++ # Sort models alphabetically within each type+ for model_list in models_by_type.values():+ model_list.sort(key=itemgetter("name"))++ return models_by_type+++def generate_markdown_table(models: list[dict[str, Any]], include_structure_method: bool = True) -> str:+ """Generate a Markdown table for a list of models.++ Args:+ models: List of model info dictionaries.+ include_structure_method: Whether to include the structure_method column.++ Returns:+ Markdown table string.+ """+ if not models:+ return "_No models available in this category._\n"++ # Build header+ if include_structure_method:+ header = "| Model | Inputs | Outputs | SDK | Structure Method |"+ separator = "|-------|--------|---------|-----|------------------|"+ else:+ header = "| Model | Inputs | Outputs | SDK |"+ separator = "|-------|--------|---------|-----|"++ lines = [header, separator]++ for model in models:+ inputs = ", ".join(model.get("inputs", []))+ outputs = ", ".join(model.get("outputs", []))+ sdk = model.get("sdk", "")+ name = model.get("name", "")++ if include_structure_method:+ structure_method = model.get("structure_method", "")+ lines.append(f"| {name} | {inputs} | {outputs} | {sdk} | {structure_method} |")+ else:+ lines.append(f"| {name} | {inputs} | {outputs} | {sdk} |")++ return "\n".join(lines) + "\n"+++def generate_reference_markdown(model_specs: BackendModelSpecs) -> str:+ """Generate the complete Markdown reference file content.++ Args:+ model_specs: Raw model specifications from remote config.++ Returns:+ Complete Markdown content for the reference file.+ """+ models_by_type = extract_reference_data(model_specs)+ timestamp = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ") # noqa: UP017++ sections = [+ "# Pipelex Gateway - Available Models",+ "",+ "> **AUTO-GENERATED FILE** - Do not edit manually.",+ f"> Last updated: {timestamp}",+ ">",+ "> Run `pipelex-dev update-gateway-models` or `make ugm` to regenerate.",+ "",+ "This file documents models available through Pipelex Gateway.",+ f"For configuration details, see the [documentation]({URLs.gateway_docs}).",+ "",+ ]++ # Add LLM section+ sections.append("## Language Models (LLM)")+ sections.append("")+ sections.append(generate_markdown_table(models_by_type["llm"], include_structure_method=True))++ # Add document extractor section+ sections.append("## Document Extraction Models")+ sections.append("")+ sections.append(generate_markdown_table(models_by_type["text_extractor"], include_structure_method=True))++ # Add image generation section+ sections.append("## Image Generation Models")+ sections.append("")+ sections.append(generate_markdown_table(models_by_type["img_gen"], include_structure_method=False))++ return "\n".join(sections)diff --git a/pipelex/cli/dev_cli/commands/update_gateway_models_cmd.py b/pipelex/cli/dev_cli/commands/update_gateway_models_cmd.pynew file mode 100644index 000000000..dca717777--- /dev/null+++ b/pipelex/cli/dev_cli/commands/update_gateway_models_cmd.py@@ -0,0 +1,91 @@+"""Command to update the Pipelex Gateway models reference file."""++from __future__ import annotations++import sys+from pathlib import Path++from rich.panel import Panel++from pipelex.cli.dev_cli.commands.gateway_models_generator import (+ fetch_gateway_model_specs,+ generate_reference_markdown,+)+from pipelex.hub import get_console+from pipelex.system.pipelex_service.exceptions import RemoteConfigFetchError, RemoteConfigValidationError++# Path to the reference file+GATEWAY_MODELS_REFERENCE_PATH = Path(".pipelex/inference/backends/pipelex_gateway_models.md")+++def update_gateway_models_cmd(quiet: bool = False) -> None:+ """Update the Pipelex Gateway models reference file.++ Fetches the current model specifications from the remote config and+ generates an updated Markdown reference file.++ Args:+ quiet: If True, output only a single validation line (for use in Make targets).+ """+ console = get_console()++ if not quiet:+ console.print()+ console.print("[bold]Updating Pipelex Gateway models reference...[/bold]")+ console.print()++ # Fetch remote config+ try:+ model_specs = fetch_gateway_model_specs()+ except RemoteConfigFetchError as exc:+ if quiet:+ console.print(f"[red]✗ Gateway models update: FAILED[/red] - {exc}")+ else:+ error_panel = Panel(+ f"[red]✗[/red] Failed to fetch remote configuration\n\n[dim]{exc}[/dim]",+ title="[bold red]Gateway Models Update: FAILED[/bold red]",+ border_style="red",+ padding=(1, 2),+ )+ console.print(error_panel)+ console.print()+ sys.exit(1)+ except RemoteConfigValidationError as exc:+ if quiet:+ console.print(f"[red]✗ Gateway models update: FAILED[/red] - {exc}")+ else:+ error_panel = Panel(+ f"[red]✗[/red] Invalid remote configuration\n\n[dim]{exc}[/dim]",+ title="[bold red]Gateway Models Update: FAILED[/bold red]",+ border_style="red",+ padding=(1, 2),+ )+ console.print(error_panel)+ console.print()+ sys.exit(1)++ # Generate markdown content+ markdown_content = generate_reference_markdown(model_specs)++ # Ensure parent directory exists+ GATEWAY_MODELS_REFERENCE_PATH.parent.mkdir(parents=True, exist_ok=True)++ # Write the reference file+ GATEWAY_MODELS_REFERENCE_PATH.write_text(markdown_content, encoding="utf-8")++ # Count models for reporting+ model_count = sum(1 for key in model_specs if key != "defaults" and ".rules" not in key and isinstance(model_specs[key], dict))++ if quiet:+ console.print(f"[green]✓ Gateway models update: PASSED[/green] ({model_count} models)")+ else:+ success_panel = Panel(+ f"[green]✓[/green] Reference file updated successfully!\n\n"+ f"[dim]File: {GATEWAY_MODELS_REFERENCE_PATH}[/dim]\n"+ f"[dim]Models: {model_count}[/dim]",+ title="[bold green]Gateway Models Update: PASSED[/bold green]",+ border_style="green",+ padding=(1, 2),+ )+ console.print(success_panel)+ console.print()diff --git a/pipelex/exceptions.py b/pipelex/exceptions.pyindex 99dadd92d..c23a72e00 100644--- a/pipelex/exceptions.py+++ b/pipelex/exceptions.py@@ -46,7 +46,6 @@ from pipelex.pipeline.exceptions import (PipelineExecutionError,PipeStackOverflowError,)-from pipelex.pipeline.track.exceptions import JobHistoryErrorfrom pipelex.system.exceptions import (ConfigModelError,ConfigValidationError,@@ -113,8 +112,6 @@ __all__ = ["PipeStackOverflowError","PipelineExecutionError","PipeExecutionError",- # from pipelex.pipeline.track.exceptions- "JobHistoryError",# from pipelex.system.exceptions"ToolError","NestedKeyConflictError",diff --git a/pipelex/hub.py b/pipelex/hub.pyindex d5c08a22e..f4c00409a 100644--- a/pipelex/hub.py+++ b/pipelex/hub.py@@ -29,7 +29,6 @@ from pipelex.observer.observer_protocol import ObserverProtocolfrom pipelex.pipe_run.pipe_router_protocol import PipeRouterProtocolfrom pipelex.pipeline.pipeline import Pipelinefrom pipelex.pipeline.pipeline_manager_abstract import PipelineManagerAbstract-from pipelex.pipeline.track.pipeline_tracker_protocol import PipelineTrackerProtocolfrom pipelex.plugins.plugin_manager import PluginManagerfrom pipelex.reporting.reporting_protocol import ReportingProtocolfrom pipelex.system.configuration.config_loader import config_manager@@ -72,7 +71,6 @@ class PipelexHub:self._pipe_router: PipeRouterProtocol | None = None# pipeline- self._pipeline_tracker: PipelineTrackerProtocol | None = Noneself._pipeline_manager: PipelineManagerAbstract | None = Noneself._observer: ObserverProtocol | None = None@@ -177,9 +175,6 @@ class PipelexHub:def set_pipe_router(self, pipe_router: PipeRouterProtocol):self._pipe_router = pipe_router- def set_pipeline_tracker(self, pipeline_tracker: PipelineTrackerProtocol):- self._pipeline_tracker = pipeline_tracker-def set_pipeline_manager(self, pipeline_manager: PipelineManagerAbstract):self._pipeline_manager = pipeline_manager@@ -297,12 +292,6 @@ class PipelexHub:raise RuntimeError(msg)return self._pipe_router- def get_pipeline_tracker(self) -> PipelineTrackerProtocol:- if self._pipeline_tracker is None:- msg = "PipelineTracker is not initialized"- raise RuntimeError(msg)- return self._pipeline_tracker-def get_required_pipeline_manager(self) -> PipelineManagerAbstract:if self._pipeline_manager is None:msg = "PipelineManager is not initialized"@@ -478,10 +467,6 @@ def get_pipe_router() -> PipeRouterProtocol:return get_pipelex_hub().get_required_pipe_router()-def get_pipeline_tracker() -> PipelineTrackerProtocol:- return get_pipelex_hub().get_pipeline_tracker()--def get_pipeline_manager() -> PipelineManagerAbstract:return get_pipelex_hub().get_required_pipeline_manager()diff --git a/pipelex/kit/agent_rules/pytest_standards.md b/pipelex/kit/agent_rules/pytest_standards.mdindex 7e1ff93c8..93f916dc3 100644--- a/pipelex/kit/agent_rules/pytest_standards.md+++ b/pipelex/kit/agent_rules/pytest_standards.md@@ -2,7 +2,8 @@## Unit test generalities-NEVER USE unittest.mock. YOU MUST USE pytest-mock instead.+NEVER USE unittest.mock. Instead YOU MUST USE pytest-mock: `from pytest_mock import MockerFixture`.+NEVER EVER put more than one TestClass into a test module.### Test file structure@@ -15,7 +16,9 @@ NEVER USE unittest.mock. YOU MUST USE pytest-mock instead.- Do NOT add `__init__.py` files to test directories. Test directories do not need to be Python packages.- Fixtures are defined in conftest.py modules at different levels of the hierarchy, their scope is handled by pytest- Test data is placed inside test_data.py at different levels of the hierarchy, they must be imported with package paths from the root like `from tests.integration.pipelex.cogt.test_data`. Their content is all constants, regrouped inside classes to keep things tidy.-- Always put test inside Test classes: 1 TestClass per module.+- Always put tests inside Test classes: 1 TestClass per module.+- NEVER EVER put more than one TestClass into a test module.+- Put fixtures into conftest.py files for easy sharing.### Markers@@ -74,5 +77,5 @@ class TestFooBar:- Verify working memory state- Check output structure and content- Use meaningful test case names-- Include docstrings explaining test purpose but not on top of the file and not on top of the class.+- Include concise docstrings explaining test purpose but not on top of the file and not on top of the class.- Log outputs for debuggingdiff --git a/pipelex/kit/configs/inference/backends/anthropic.toml b/pipelex/kit/configs/inference/backends/anthropic.tomlindex 729e2d107..0f04f4d76 100644--- a/pipelex/kit/configs/inference/backends/anthropic.toml+++ b/pipelex/kit/configs/inference/backends/anthropic.toml@@ -39,14 +39,6 @@ outputs = ["text", "structured"]max_prompt_images = 100costs = { input = 0.25, output = 1.25 }-[claude-3-opus]-model_id = "claude-3-opus-20240229"-max_tokens = 4096-inputs = ["text", "images"]-outputs = ["text", "structured"]-max_prompt_images = 100-costs = { input = 15.0, output = 75.0 }-# --- Claude 3.7 Series --------------------------------------------------------["claude-3.7-sonnet"]model_id = "claude-3-7-sonnet-20250219"diff --git a/pipelex/kit/configs/inference/backends/pipelex_gateway_models.md b/pipelex/kit/configs/inference/backends/pipelex_gateway_models.mdnew file mode 100644index 000000000..22f9ba7a6--- /dev/null+++ b/pipelex/kit/configs/inference/backends/pipelex_gateway_models.md@@ -0,0 +1,75 @@+# Pipelex Gateway - Available Models++> **AUTO-GENERATED FILE** - Do not edit manually.+> Last updated: 2026-01-06T15:33:39Z+>+> Run `pipelex-dev update-gateway-models` or `make ugm` to regenerate.++This file documents models available through Pipelex Gateway.+For configuration details, see the [documentation](https://docs.pipelex.com/home/5-setup/configure-ai-providers/#option-1-pipelex-gateway-easiest-for-getting-started).++## Language Models (LLM)++| Model | Inputs | Outputs | SDK | Structure Method |+|-------|--------|---------|-----|------------------|+| claude-3.7-sonnet | text, images | text, structured | gateway_completions | instructor/openai_tools |+| claude-4-opus | text, images | text, structured | gateway_completions | instructor/openai_tools |+| claude-4-sonnet | text, images | text, structured | gateway_completions | instructor/openai_tools |+| claude-4.1-opus | text, images | text, structured | gateway_completions | instructor/openai_tools |+| claude-4.5-haiku | text, images | text, structured | gateway_completions | instructor/openai_tools |+| claude-4.5-opus | text, images | text, structured | gateway_completions | instructor/openai_tools |+| claude-4.5-sonnet | text, images | text, structured | gateway_completions | instructor/openai_tools |+| deepseek-v3.1 | text | text, structured | gateway_completions | instructor/json |+| gemini-2.0-flash | text, images | text, structured | gateway_completions | instructor/openai_tools |+| gemini-2.5-flash | text, images | text, structured | gateway_completions | instructor/openai_tools |+| gemini-2.5-flash-lite | text, images | text, structured | gateway_completions | instructor/openai_tools |+| gemini-2.5-pro | text, images | text, structured | gateway_completions | instructor/openai_tools |+| gemini-3.0-flash-preview | text, images | text, structured | gateway_completions | instructor/openai_tools |+| gemini-3.0-pro | text, images | text, structured | gateway_completions | instructor/openai_tools |+| gpt-4.1 | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| gpt-4.1-mini | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| gpt-4.1-nano | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| gpt-4o | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| gpt-4o-mini | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| gpt-5 | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| gpt-5-chat | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| gpt-5-mini | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| gpt-5-nano | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| gpt-5.1 | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| gpt-5.1-chat | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| gpt-5.1-codex | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| gpt-5.2 | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| gpt-5.2-chat | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| gpt-oss-120b | text | text, structured | gateway_completions | instructor/openai_tools |+| gpt-oss-20b | text | text, structured | gateway_completions | instructor/openai_tools |+| grok-3 | text | text, structured | gateway_completions | instructor/openai_tools |+| grok-3-mini | text | text, structured | gateway_completions | instructor/openai_tools |+| grok-4-fast-non-reasoning | text, images | text, structured | gateway_completions | instructor/openai_tools |+| o1 | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| o1-mini | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| o3 | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| o3-mini | text | text, structured | gateway_responses | instructor/openai_responses_tools |+| o4-mini | text, images | text, structured | gateway_responses | instructor/openai_responses_tools |+| qwen3-vl-235b-a22b | text, images | text, structured | gateway_completions | instructor/json |++## Document Extraction Models++| Model | Inputs | Outputs | SDK | Structure Method |+|-------|--------|---------|-----|------------------|+| azure-document-intelligence | pdf | pages | gateway_extract | instructor/openai_tools |+| mistral-document-ai-2505 | pdf, image | pages | gateway_extract | instructor/openai_tools |++## Image Generation Models++| Model | Inputs | Outputs | SDK |+|-------|--------|---------|-----|+| fast-lightning-sdxl | text | image | gateway_img_gen |+| flux-2 | text | image | gateway_img_gen |+| flux-pro | text | image | gateway_img_gen |+| flux-pro/v1.1 | text | image | gateway_img_gen |+| flux-pro/v1.1-ultra | text | image | gateway_img_gen |+| gpt-image-1 | text | image | gateway_img_gen |+| gpt-image-1-mini | text | image | gateway_img_gen |+| gpt-image-1.5 | text | image | gateway_img_gen |+| nano-banana | text | image | gateway_completions |+| nano-banana-pro | text | image | gateway_completions |diff --git a/pipelex/kit/configs/inference/backends/portkey.toml b/pipelex/kit/configs/inference/backends/portkey.tomlindex 2080d0e14..75e2574e2 100644--- a/pipelex/kit/configs/inference/backends/portkey.toml+++ b/pipelex/kit/configs/inference/backends/portkey.toml@@ -161,15 +161,6 @@ max_prompt_images = 100costs = { input = 0.25, output = 1.25 }x-portkey-provider = "@anthropic"-[claude-3-opus]-model_id = "claude-3-opus-20240229"-max_tokens = 4096-inputs = ["text", "images"]-outputs = ["text", "structured"]-max_prompt_images = 100-costs = { input = 15.0, output = 75.0 }-x-portkey-provider = "@anthropic"-["claude-3.7-sonnet"]model_id = "claude-3-7-sonnet-20250219"max_tokens = 8192diff --git a/pipelex/kit/configs/inference/routing_profiles.toml b/pipelex/kit/configs/inference/routing_profiles.tomlindex d27e659ac..fb0140cab 100644--- a/pipelex/kit/configs/inference/routing_profiles.toml+++ b/pipelex/kit/configs/inference/routing_profiles.toml@@ -138,7 +138,7 @@ default = "internal"# =========================================================================================[profiles.example_routing_using_patterns]description = "Example routing profile using patterns"-default = "pipelex_inference"+default = "pipelex_gateway"[profiles.example_routing_using_patterns.routes]# Pattern matching: "model-pattern" = "backend-name"@@ -158,17 +158,17 @@ default = "pipelex_inference"description = "Example routing profile using specific models"[profiles.example_routing_using_specific_models.routes]-"gpt-5-nano" = "pipelex_inference"+"gpt-5-nano" = "pipelex_gateway""gpt-4o-mini" = "blackboxai""gpt-5-mini" = "openai""gpt-5-chat" = "azure_openai"-"claude-4-sonnet" = "pipelex_inference"+"claude-4-sonnet" = "pipelex_gateway""claude-3.7-sonnet" = "blackboxai"-"gemini-2.5-flash-lite" = "pipelex_inference"+"gemini-2.5-flash-lite" = "pipelex_gateway""gemini-2.5-flash" = "blackboxai""gemini-2.5-pro" = "vertexai"-"grok-3" = "pipelex_inference"+"grok-3" = "pipelex_gateway""grok-3-mini" = "xai"diff --git a/pipelex/kit/configs/pipelex.toml b/pipelex/kit/configs/pipelex.tomlindex 2032e08cc..62f9e95ef 100644--- a/pipelex/kit/configs/pipelex.toml+++ b/pipelex/kit/configs/pipelex.toml@@ -101,7 +101,6 @@[pipelex.feature_config]# WIP/Experimental feature flags:-# is_pipeline_tracking_enabled = false# is_reporting_enabled = true[pipelex.reporting_config]diff --git a/pipelex/kit/paths.py b/pipelex/kit/paths.pyindex 165806442..35985accf 100644--- a/pipelex/kit/paths.py+++ b/pipelex/kit/paths.py@@ -12,6 +12,7 @@ GIT_IGNORED_CONFIG_FILES: frozenset[str] = frozenset("pipelex_service.toml","pipelex_override.toml","telemetry_override.toml",+ "pipelex_gateway_models.md", # Auto-generated from remote config})diff --git a/pipelex/pipe_controllers/batch/pipe_batch.py b/pipelex/pipe_controllers/batch/pipe_batch.pyindex 3501e17d3..20dbe9bd8 100644--- a/pipelex/pipe_controllers/batch/pipe_batch.py+++ b/pipelex/pipe_controllers/batch/pipe_batch.py@@ -3,23 +3,20 @@ from typing import TYPE_CHECKING, Any, Literal, castfrom typing_extensions import override-from pipelex.config import get_config-from pipelex.core.memory.working_memory import MAIN_STUFF_NAME, WorkingMemory+from pipelex.core.memory.working_memory import WorkingMemoryfrom pipelex.core.pipes.inputs.input_stuff_specs import InputStuffSpecsfrom pipelex.core.pipes.pipe_output import PipeOutputfrom pipelex.core.stuffs.list_content import ListContentfrom pipelex.core.stuffs.stuff_factory import StuffFactory-from pipelex.hub import get_pipeline_tracker, get_required_pipe+from pipelex.hub import get_required_pipefrom pipelex.pipe_controllers.pipe_controller import PipeControllerfrom pipelex.pipe_run.exceptions import PipeRunError-from pipelex.pipe_run.pipe_run_params import BatchParams, PipeRunMode, PipeRunParams+from pipelex.pipe_run.pipe_run_params import BatchParams, PipeRunParamsfrom pipelex.pipeline.job_metadata import JobMetadata-from pipelex.tools.misc.string_utils import get_root_from_dotted_pathif TYPE_CHECKING:from collections.abc import Coroutine- from pipelex.core.stuffs.stuff import Stufffrom pipelex.core.stuffs.stuff_content import StuffContent@@ -115,18 +112,11 @@ class PipeBatch(PipeController):# TODO: Make commented code work when inputing images named "a.b.c"sub_pipe = get_required_pipe(pipe_code=self.branch_pipe_code)- nb_history_items_limit = get_config().pipelex.tracker_config.applied_nb_items_limitbatch_output_stuff_code = StuffFactory.make_stuff_code()tasks: list[Coroutine[Any, Any, PipeOutput]] = []- item_stuffs: list[Stuff] = []- required_stuff_lists: list[list[Stuff]] = []- branch_output_item_codes: list[str] = []for branch_index, item in enumerate(input_content.items):branch_output_item_code = f"{batch_output_stuff_code}-branch-{branch_index}"- branch_output_item_codes.append(branch_output_item_code)- if nb_history_items_limit and branch_index >= nb_history_items_limit:- breakbranch_input_item_code = f"{input_stuff.stuff_code}-branch-{branch_index}"item_input_stuff = StuffFactory.make_stuff(code=branch_input_item_code,@@ -134,16 +124,9 @@ class PipeBatch(PipeController):content=item,name=input_item_stuff_name,)- item_stuffs.append(item_input_stuff)branch_memory = working_memory.make_deep_copy()branch_memory.set_new_main_stuff(stuff=item_input_stuff, name=input_item_stuff_name)- required_variables = sub_pipe.required_variables()- # Extract root names from full paths for looking up stuffs in working memory- required_stuff_names = {get_root_from_dotted_path(req_var) for req_var in required_variables}- required_stuffs = branch_memory.get_existing_stuffs(names=required_stuff_names)- required_stuffs = [required_stuff for required_stuff in required_stuffs if required_stuff.stuff_code != input_stuff.stuff_code]- required_stuff_lists.append(required_stuffs)# We create a deep copy of the run params to avoid modifying the original run params,# and we set the final stuff code to use the one provided fro the branch pipe.# Note: the batching will yield a list by aggregating the outputs of each run of the branch pipe,@@ -168,8 +151,6 @@ class PipeBatch(PipeController):output_items: list[StuffContent] = []- output_stuffs: list[Stuff] = []-for pipe_output in pipe_outputs:branch_output_stuff = pipe_output.main_stuffoutput_items.append(branch_output_stuff.content)@@ -180,38 +161,6 @@ class PipeBatch(PipeController):content=list_content,name=output_name,)- method_name = "dry_run_pipe" if pipe_run_params.run_mode == PipeRunMode.DRY else "run_pipe"- for branch_index, (- required_stuff_list,- item_input_stuff,- item_output_stuff,- ) in enumerate(zip(required_stuff_lists, item_stuffs, output_stuffs, strict=False)):- get_pipeline_tracker().add_batch_step(- from_stuff=input_stuff,- to_stuff=item_input_stuff,- to_branch_index=branch_index,- pipe_layer=pipe_run_params.pipe_layers,- comment=f"PipeBatch.{method_name}() in zip",- )- for required_stuff in required_stuff_list:- get_pipeline_tracker().add_pipe_step(- from_stuff=required_stuff,- to_stuff=item_output_stuff,- pipe_code=self.branch_pipe_code,- pipe_layer=pipe_run_params.pipe_layers,- comment=f"PipeBatch.{method_name}() on required_stuff_list",- as_item_index=branch_index,- is_with_edge=(required_stuff.stuff_name != MAIN_STUFF_NAME),- )-- for branch_index, branch_output_stuff in enumerate(output_stuffs):- branch_output_item_code = branch_output_item_codes[branch_index]- get_pipeline_tracker().add_aggregate_step(- from_stuff=branch_output_stuff,- to_stuff=output_stuff,- pipe_layer=pipe_run_params.pipe_layers,- comment=f"PipeBatch.{method_name}() on branch_index of batch",- )working_memory.set_new_main_stuff(stuff=output_stuff,diff --git a/pipelex/pipe_controllers/condition/pipe_condition.py b/pipelex/pipe_controllers/condition/pipe_condition.pyindex c3a033629..6fbc0d958 100644--- a/pipelex/pipe_controllers/condition/pipe_condition.py+++ b/pipelex/pipe_controllers/condition/pipe_condition.py@@ -1,6 +1,5 @@from typing import Literal-import shortuuidfrom typing_extensions import overridefrom pipelex import log@@ -12,8 +11,7 @@ from pipelex.core.pipes.exceptions import PipeValidationError, PipeValidationErrfrom pipelex.core.pipes.inputs.input_stuff_specs import InputStuffSpecsfrom pipelex.core.pipes.inputs.input_stuff_specs_factory import InputStuffSpecsFactoryfrom pipelex.core.pipes.pipe_output import PipeOutput-from pipelex.hub import get_content_generator, get_optional_pipe, get_pipe_router, get_pipeline_tracker, get_required_pipe-from pipelex.pipe_controllers.condition.pipe_condition_details import PipeConditionDetails+from pipelex.hub import get_content_generator, get_optional_pipe, get_pipe_router, get_required_pipefrom pipelex.pipe_controllers.condition.special_outcome import SpecialOutcomefrom pipelex.pipe_controllers.pipe_controller import PipeControllerfrom pipelex.pipe_run.exceptions import PipeRunError@@ -41,16 +39,6 @@ class PipeCondition(PipeController):codes.add(self.default_outcome)return codes - set(SpecialOutcome.value_list())- def _make_pipe_condition_details(self, evaluated_expression: str, chosen_pipe_code: str) -> PipeConditionDetails:- return PipeConditionDetails(- code=shortuuid.uuid()[:5],- test_expression=self.expression,- outcomes=self.outcome_map,- default_pipe_code=self.default_outcome,- evaluated_expression=evaluated_expression,- chosen_pipe_code=chosen_pipe_code,- )-@overridedef pipe_dependencies(self) -> set[str]:return self.mapped_pipe_codes@@ -221,18 +209,13 @@ class PipeCondition(PipeController):chosen_pipe = get_required_pipe(pipe_code=outcome)- condition_details = self._make_pipe_condition_details(- evaluated_expression=self.expression,- chosen_pipe_code=chosen_pipe.code,- )-# Get required variables and validate they exist in working memory# Extract root names from full paths for looking up stuffs in working memoryrequired_variables = chosen_pipe.required_variables()# TODO: Merge `needed_inputs` and `required_variables` methods for cleaner code.required_stuff_names = {get_root_from_dotted_path(req_var) for req_var in required_variables if not req_var.startswith("_")}try:- required_stuffs = working_memory.get_stuffs(names=required_stuff_names)+ working_memory.get_stuffs(names=required_stuff_names)except WorkingMemoryStuffNotFoundError as exc:pipe_condition_path = [*pipe_run_params.pipe_layers, self.code]pipe_condition_path_str = ".".join(pipe_condition_path)@@ -240,16 +223,7 @@ class PipeCondition(PipeController):msg = f"Some required stuff(s) not found: {error_details}"raise PipeRunError(message=msg, run_mode=pipe_run_params.run_mode, pipe_code=self.code) from exc- for required_stuff in required_stuffs:- get_pipeline_tracker().add_condition_step(- from_stuff=required_stuff,- to_condition=condition_details,- condition_expression=self.expression,- pipe_layer=pipe_run_params.pipe_layers,- comment="PipeCondition required for condition",- )-- pipe_output = await get_pipe_router().run(+ return await get_pipe_router().run(pipe_job=PipeJobFactory.make_pipe_job(pipe=get_required_pipe(pipe_code=outcome),job_metadata=job_metadata,@@ -258,13 +232,6 @@ class PipeCondition(PipeController):output_name=output_name,),)- get_pipeline_tracker().add_choice_step(- from_condition=condition_details,- to_stuff=pipe_output.main_stuff,- pipe_layer=pipe_run_params.pipe_layers,- comment="PipeCondition chosen pipe",- )- return pipe_output@overrideasync def _dry_run_controller_pipe(diff --git a/pipelex/pipe_controllers/parallel/pipe_parallel.py b/pipelex/pipe_controllers/parallel/pipe_parallel.pyindex dfe6409aa..90d5453e6 100644--- a/pipelex/pipe_controllers/parallel/pipe_parallel.py+++ b/pipelex/pipe_controllers/parallel/pipe_parallel.py@@ -13,7 +13,7 @@ from pipelex.core.pipes.inputs.input_stuff_specs import InputStuffSpecsfrom pipelex.core.pipes.inputs.input_stuff_specs_factory import InputStuffSpecsFactoryfrom pipelex.core.pipes.pipe_output import PipeOutputfrom pipelex.core.stuffs.stuff_factory import StuffFactory-from pipelex.hub import get_pipeline_tracker, get_required_pipe+from pipelex.hub import get_required_pipefrom pipelex.libraries.pipe.exceptions import PipeNotFoundErrorfrom pipelex.pipe_controllers.pipe_controller import PipeControllerfrom pipelex.pipe_controllers.sub_pipe import SubPipe@@ -189,14 +189,6 @@ class PipeParallel(PipeController):name=output_name,)- for stuff in output_stuffs.values():- get_pipeline_tracker().add_aggregate_step(- from_stuff=stuff,- to_stuff=combined_output_stuff,- pipe_layer=pipe_run_params.pipe_layers,- comment="PipeParallel on output_stuffs",- )-return PipeOutput(working_memory=working_memory,pipeline_run_id=job_metadata.pipeline_run_id,diff --git a/pipelex/pipe_controllers/sub_pipe.py b/pipelex/pipe_controllers/sub_pipe.pyindex e6c622724..ba9dc4b29 100644--- a/pipelex/pipe_controllers/sub_pipe.py+++ b/pipelex/pipe_controllers/sub_pipe.py@@ -8,7 +8,7 @@ from pipelex.core.pipes.pipe_factory import PipeFactoryfrom pipelex.core.pipes.pipe_output import PipeOutputfrom pipelex.core.pipes.variable_multiplicity import VariableMultiplicityfrom pipelex.core.stuffs.list_content import ListContent-from pipelex.hub import get_pipeline_tracker, get_required_pipe+from pipelex.hub import get_required_pipefrom pipelex.pipe_controllers.batch.pipe_batch import PipeBatchfrom pipelex.pipe_controllers.batch.pipe_batch_blueprint import PipeBatchBlueprintfrom pipelex.pipe_controllers.condition.pipe_condition import PipeCondition@@ -130,14 +130,4 @@ class SubPipe(BaseModel):output_name=self.output_name,)- if new_output_stuff := pipe_output.working_memory.get_optional_main_stuff():- for stuff in required_stuffs:- get_pipeline_tracker().add_pipe_step(- from_stuff=stuff,- to_stuff=new_output_stuff,- pipe_code=self.pipe_code,- pipe_layer=sub_pipe_run_params.pipe_layers,- comment="SubPipe on required_stuff",- )-return pipe_outputdiff --git a/pipelex/pipelex.py b/pipelex/pipelex.pyindex dfa8a6ed6..0d10ae932 100644--- a/pipelex/pipelex.py+++ b/pipelex/pipelex.py@@ -41,11 +41,6 @@ from pipelex.observer.observer_protocol import ObserverProtocolfrom pipelex.pipe_run.pipe_router import PipeRouterfrom pipelex.pipe_run.pipe_router_protocol import PipeRouterProtocolfrom pipelex.pipeline.pipeline_manager import PipelineManager-from pipelex.pipeline.track.pipeline_tracker import PipelineTracker-from pipelex.pipeline.track.pipeline_tracker_protocol import (- PipelineTrackerNoOp,- PipelineTrackerProtocol,-)from pipelex.plugins.plugin_manager import PluginManagerfrom pipelex.reporting.reporting_manager import ReportingManagerfrom pipelex.reporting.reporting_protocol import ReportingNoOp, ReportingProtocol@@ -122,7 +117,6 @@ class Pipelex(metaclass=MetaSingleton):self.reporting_delegate: ReportingProtocol | None = Noneself.telemetry_manager: TelemetryManagerAbstract | None = None# pipeline- self.pipeline_tracker: PipelineTrackerProtocol | None = Noneself.library_manager: LibraryManagerAbstract | None = Nonelog.verbose(f"{PACKAGE_NAME} version {PACKAGE_VERSION} init done")@@ -163,7 +157,6 @@ If you need help, drop by our Discord: we're happy to assist: {URLs.discord}.inference_manager: InferenceManager | None = None,content_generator: ContentGeneratorProtocol | None = None,pipeline_manager: PipelineManager | None = None,- pipeline_tracker: PipelineTracker | None = None,pipe_router: PipeRouterProtocol | None = None,reporting_delegate: ReportingProtocol | None = None,telemetry_config: TelemetryConfig | None = None,@@ -280,17 +273,6 @@ If you need help, drop by our Discord: we're happy to assist: {URLs.discord}.self.inference_manager = inference_manager or InferenceManager()self.pipelex_hub.set_inference_manager(self.inference_manager)- # --- Pipeline Tracking (deprecated) ------------------------------------------------------ if pipeline_tracker:- self.pipeline_tracker = pipeline_tracker- elif get_config().pipelex.feature_config.is_pipeline_tracking_enabled:- self.pipeline_tracker = PipelineTracker(tracker_config=get_config().pipelex.tracker_config)- else:- self.pipeline_tracker = PipelineTrackerNoOp()- self.pipelex_hub.set_pipeline_tracker(pipeline_tracker=self.pipeline_tracker)- self.pipeline_tracker.setup()-# --- Libraries & Registries -------------------------------------------------------------if get_config().pipelex.feature_config.is_reporting_enabled:@@ -330,8 +312,6 @@ If you need help, drop by our Discord: we're happy to assist: {URLs.discord}.def teardown(self):# pipelexself.pipeline_manager.teardown()- if self.pipeline_tracker:- self.pipeline_tracker.teardown()if self.telemetry_manager:self.telemetry_manager.teardown()@@ -370,7 +350,6 @@ If you need help, drop by our Discord: we're happy to assist: {URLs.discord}.inference_manager: InferenceManager | None = None,content_generator: ContentGeneratorProtocol | None = None,pipeline_manager: PipelineManager | None = None,- pipeline_tracker: PipelineTracker | None = None,pipe_router: PipeRouterProtocol | None = None,reporting_delegate: ReportingProtocol | None = None,telemetry_config: TelemetryConfig | None = None,@@ -393,7 +372,6 @@ If you need help, drop by our Discord: we're happy to assist: {URLs.discord}.inference_manager: Custom inference routing managercontent_generator: Custom content generation implementationpipeline_manager: Custom pipeline management- pipeline_tracker: Custom pipeline tracking/loggingpipe_router: Custom pipe routing logicreporting_delegate: Custom reporting handlertelemetry_config: Custom telemetry configuration@@ -423,7 +401,6 @@ If you need help, drop by our Discord: we're happy to assist: {URLs.discord}.inference_manager=inference_manager,content_generator=content_generator,pipeline_manager=pipeline_manager,- pipeline_tracker=pipeline_tracker,pipe_router=pipe_router,reporting_delegate=reporting_delegate,telemetry_config=telemetry_config,diff --git a/pipelex/pipelex.toml b/pipelex/pipelex.tomlindex 60e2c7f04..3bcbf0f33 100644--- a/pipelex/pipelex.toml+++ b/pipelex/pipelex.toml@@ -36,7 +36,6 @@ default_directory_base_name = "pipeline"[pipelex.feature_config]# WIP/Experimental feature flags-is_pipeline_tracking_enabled = falseis_reporting_enabled = true[pipelex.reporting_config]@@ -236,27 +235,6 @@ default_reaction = "raise"# extraneous_input_variable = "log"# inadequate_input_concept = "log"-####################################################################################################-# History graph config-####################################################################################################--[pipelex.tracker_config]-is_debug_mode = false-is_include_text_preview = false-is_include_interactivity = false-nb_items_limit = "unlimited"-theme = "base"-layout = "dagre" # "elk", "dagre", "fixed"-sub_graph_colors = ["#e6f5ff", "#fff5f7", "#f0fff0"]-wrapping_width = "auto"--# TODO: adapt the length of the edges to different cases?-pipe_edge_style = "---->"-branch_edge_style = "-...-"-aggregate_edge_style = "-...-"-condition_edge_style = "-----"-choice_edge_style = "-----"-##################################################################################################### Pipelex run config####################################################################################################diff --git a/pipelex/pipeline/track/__init__.py b/pipelex/pipeline/track/__init__.pydeleted file mode 100644index 8b1378917..000000000--- a/pipelex/pipeline/track/__init__.py+++ /dev/null@@ -1 +0,0 @@-diff --git a/pipelex/pipeline/track/exceptions.py b/pipelex/pipeline/track/exceptions.pydeleted file mode 100644index 73732cba3..000000000--- a/pipelex/pipeline/track/exceptions.py+++ /dev/null@@ -1,5 +0,0 @@-from pipelex.base_exceptions import PipelexError---class JobHistoryError(PipelexError):- passdiff --git a/pipelex/pipeline/track/flow_chart.py b/pipelex/pipeline/track/flow_chart.pydeleted file mode 100644index a70102907..000000000--- a/pipelex/pipeline/track/flow_chart.py+++ /dev/null@@ -1,210 +0,0 @@-# pyright: reportUnknownVariableType=false-# pyright: reportUnknownArgumentType=false-# pyright: reportUnknownMemberType=false-# pyright: reportUnknownParameterType=false-# pyright: reportMissingTypeArgument=false-from typing import Any--import networkx as nx-import yaml--from pipelex import log-from pipelex.pipeline.track.exceptions import JobHistoryError-from pipelex.pipeline.track.tracker_config import TrackerConfig-from pipelex.pipeline.track.tracker_models import (- EdgeAttributeKey,- EdgeCategory,- GraphTree,- NodeAttributeKey,- NodeCategory,- SubGraphClassDef,-)-from pipelex.tools.misc.mermaid_utils import clean_str_for_mermaid_node_title, make_mermaid_url-from pipelex.tools.misc.string_utils import snake_to_capitalize_first_letter---def nice_edge_tag(edge_tag: str) -> str:- return f'"{snake_to_capitalize_first_letter(edge_tag)}"'---def _indent_line(line: str, indent: int) -> str:- return f"{' ' * indent}{line}"---class PipelineFlowChart:- def __init__(self, nx_graph: nx.DiGraph, start_node: str, tracker_config: TrackerConfig):- self.nx_graph = nx_graph- self._tracker_config = tracker_config- self.is_debug_mode = tracker_config.is_debug_mode- self.start_node = start_node- self.sub_graph_class_defs: list[SubGraphClassDef] = []- for sub_graph_index, sub_graph_color in enumerate(self._tracker_config.sub_graph_colors):- class_def_letter = chr(ord("a") + sub_graph_index)- class_def_name = f"sub_{class_def_letter}"- self.sub_graph_class_defs.append(SubGraphClassDef(name=class_def_name, color=sub_graph_color))-- def generate_mermaid_flowchart(- self,- title: str | None = None,- subtitle: str | None = None,- ) -> tuple[str, str]:- nb_nodes = len(self.nx_graph.nodes)- if nb_nodes == 0:- msg = "Graph has no nodes"- raise JobHistoryError(msg)- log.verbose(f"Generating mermaid flowchart for the whole graph which holds {nb_nodes} nodes")- mermaid_settings: dict[str, Any] = {}- if title:- mermaid_settings["title"] = title- mermaid_settings["config"] = {}- if self._tracker_config.applied_theme:- mermaid_settings["config"]["theme"] = self._tracker_config.applied_theme- if self._tracker_config.applied_layout:- mermaid_settings["config"]["layout"] = self._tracker_config.applied_layout- if self._tracker_config.applied_wrapping_width:- mermaid_settings["config"]["flowchart"] = {"wrappingWidth": self._tracker_config.applied_wrapping_width}- mermaid_code = "---\n"- mermaid_code += yaml.dump(mermaid_settings)- mermaid_code += "---\n"- mermaid_code += "flowchart LR\n"-- graph_tree: GraphTree = GraphTree(nodes_by_subgraph={})-- # First pass: Collect nodes into their respective subgraphs- for node in self.nx_graph.nodes:- node_attributes = self.nx_graph.nodes[node]- if not node_attributes:- msg = f"Node attributes are empty for node '{node}'"- raise JobHistoryError(msg)- node_pipe_layer = node_attributes.get(NodeAttributeKey.SUBGRAPH)- if not node_pipe_layer:- node_pipe_layer = "Unknown"- elif not isinstance(node_pipe_layer, str):- msg = f"Node '{node}' has no pipe stack: {node_attributes}"- raise JobHistoryError(msg)-- sub_graph = node_pipe_layer or "root"- # Split sub_graph by "-" and keep the last token- if "-" in sub_graph:- sub_graph = sub_graph.split("-")[-1]- if sub_graph not in graph_tree.nodes_by_subgraph:- graph_tree.nodes_by_subgraph[sub_graph] = []- graph_tree.nodes_by_subgraph[sub_graph].append(node)-- log.verbose(graph_tree, title="Graph tree")-- subgraph_lines = self.generate_subgraph_lines(graph_tree)- mermaid_code += "\n".join(subgraph_lines)- mermaid_code += "\n"-- # Generate subtitle- if subtitle:- # this is a hack to add something that looks like a subtitle, but it's actually a node with no stroke and no visible link- # if self.start_node is None:- # msg = "Start node is not set"- # raise JobHistoryError(msg)- mermaid_code += f"""- classDef subtitleNodeClass fill:transparent,stroke:#333,stroke-width:0px;- __subtitle__["{subtitle}"]- class __subtitle__ subtitleNodeClass;- __subtitle__ --> {self.start_node}- linkStyle 0 stroke:transparent,stroke-width:0px-"""-- for sub_graph_class_def in self.sub_graph_class_defs:- mermaid_code += f"""- classDef {sub_graph_class_def.name} fill:{sub_graph_class_def.color},color:#333,stroke:#333;-"""-- # Generate edges- for edge in self.nx_graph.edges(data=True):- source, target, edge_data = edge- edge_tag: str- edge_type = EdgeCategory(edge_data[EdgeAttributeKey.EDGE_CATEGORY])- match edge_type:- case EdgeCategory.PIPE:- if pipe_code := edge_data.get(EdgeAttributeKey.PIPE_CODE):- edge_tag = nice_edge_tag(pipe_code)- mermaid_code += f" {source} -- {edge_tag} {self._tracker_config.pipe_edge_style} {target}\n"- else:- msg = f"Pipe edge missing pipe code: {edge_data}"- raise JobHistoryError(msg)- case EdgeCategory.BATCH:- mermaid_code += f" {source} {self._tracker_config.branch_edge_style} {target}\n"- case EdgeCategory.AGGREGATE:- mermaid_code += f" {source} {self._tracker_config.aggregate_edge_style} {target}\n"- case EdgeCategory.CONDITION:- condition_expression = edge_data.get(EdgeAttributeKey.CONDITION_EXPRESSION)- if not condition_expression:- msg = f"Condition edge missing condition expression: {edge_data}"- raise JobHistoryError(msg)- edge_tag = nice_edge_tag(condition_expression)- mermaid_code += f" {source} {self._tracker_config.condition_edge_style} {target}\n"- case EdgeCategory.CHOICE:- chosen_pipe_code = edge_data.get(EdgeAttributeKey.CHOSEN_PIPE)- if not chosen_pipe_code:- msg = f"No chosen pipe code set for edge {source} --- {target}"- raise JobHistoryError(msg)- edge_tag = nice_edge_tag(chosen_pipe_code)- mermaid_code += f" {source} -- {edge_tag} {self._tracker_config.choice_edge_style} {target}\n"-- url = make_mermaid_url(mermaid_code)- return mermaid_code, url-- def generate_subgraph_lines(self, graph_tree: GraphTree) -> list[str]:- subgraph_lines: list[str] = []- subgraph_class_lines: list[str] = []-- for cycle, (subgraph_name, nodes) in enumerate(graph_tree.nodes_by_subgraph.items()):- node_lines: list[str] = []- for node in nodes:- # log.verbose(f"generate_subgraph_lines for node '{node}'")- node_attributes = self.nx_graph.nodes[node]- if not node_attributes:- msg = f"Node attributes are empty for node '{node}'"- raise JobHistoryError(msg)- node_category = NodeCategory(node_attributes[NodeAttributeKey.CATEGORY])- node_tag = node_attributes[NodeAttributeKey.TAG]- if not node_tag:- msg = f"Node tag is empty for node '{node}'"- raise JobHistoryError(msg)- node_text = node_tag- if self.is_debug_mode:- if node_comment := node_attributes.get(NodeAttributeKey.COMMENT):- node_text += f"\n\n{node_comment}"- else:- node_text += "\n\nNo comment"- if node_debug_info := node_attributes.get(NodeAttributeKey.DEBUG_INFO):- node_text += f"\n\n{node_debug_info}"- match node_category:- case NodeCategory.SPECIAL:- node_lines.append(f'{node}(["{node_text}"])')- case NodeCategory.STUFF:- node_lines.append(f'{node}["{node_text}"]')- case NodeCategory.CONDITION:- node_lines.append(f'{node}{{"{node_text}"}}')- if node_description := node_attributes.get(NodeAttributeKey.DESCRIPTION) and self._tracker_config.is_include_interactivity:- if not isinstance(node_description, str):- msg = f"Node description is not a string: {node_description}"- raise JobHistoryError(msg)- node_description = clean_str_for_mermaid_node_title(node_description)- node_lines.append(f'click {node} stuff_node_callback "{node_description}"')-- if not node_lines:- msg = f"No node lines found for subgraph '{subgraph_name}'"- raise JobHistoryError(msg)-- if subgraph_name == "root":- subgraph_lines.extend(_indent_line(mermaid_line, 2) for mermaid_line in node_lines)- else:- subgraph_lines.append(_indent_line(f'subgraph "{subgraph_name}"', 1))- subgraph_lines.append(_indent_line("direction LR", 1))- subgraph_lines.extend(_indent_line(mermaid_line, 2) for mermaid_line in node_lines)- subgraph_lines.append(_indent_line("end", 1))-- class_def = self.sub_graph_class_defs[cycle % len(self.sub_graph_class_defs)]- subgraph_class_lines.append(f"class {subgraph_name} {class_def.name};")-- subgraph_lines.extend(subgraph_class_lines)-- return subgraph_linesdiff --git a/pipelex/pipeline/track/pipeline_tracker.py b/pipelex/pipeline/track/pipeline_tracker.pydeleted file mode 100644index d4f20d464..000000000--- a/pipelex/pipeline/track/pipeline_tracker.py+++ /dev/null@@ -1,371 +0,0 @@-# pyright: reportUnknownVariableType=false-# pyright: reportUnknownArgumentType=false-# pyright: reportUnknownMemberType=false-# pyright: reportMissingTypeArgument=false-from typing import Any--import networkx as nx-from typing_extensions import override--from pipelex import log-from pipelex.core.concepts.concept import Concept-from pipelex.core.stuffs.stuff import Stuff-from pipelex.pipe_controllers.condition.pipe_condition_details import PipeConditionDetails-from pipelex.pipeline.track.exceptions import JobHistoryError-from pipelex.pipeline.track.flow_chart import PipelineFlowChart-from pipelex.pipeline.track.pipeline_tracker_protocol import PipelineTrackerProtocol-from pipelex.pipeline.track.tracker_config import TrackerConfig-from pipelex.pipeline.track.tracker_models import (- EdgeAttributeKey,- EdgeCategory,- NodeAttributeKey,- NodeCategory,- SpecialNodeName,-)-from pipelex.tools.misc.mermaid_utils import print_mermaid_url-from pipelex.tools.misc.terminal_utils import print_to_stderr---# TODO: manage a separate graph for each pipeline_run_id-# TODO: restore disabled tracking functionality in PipeBatch-class PipelineTracker(PipelineTrackerProtocol):- def __init__(self, tracker_config: TrackerConfig):- self._tracker_config = tracker_config- self._is_debug_mode = tracker_config.is_debug_mode- self.is_active: bool = False- self.nx_graph: nx.DiGraph = nx.DiGraph()- self.start_node: str | None = None-- @override- def setup(self):- self.is_active = True-- @override- def teardown(self):- self.is_active = False- self.nx_graph = nx.DiGraph()- self.start_node = None-- @override- def reset(self):- self.teardown()- self.setup()-- def _get_node_name(self, node: str) -> str | None:- node_attributes = self.nx_graph.nodes[node]- node_name = node_attributes[NodeAttributeKey.NAME]- if isinstance(node_name, str):- return node_name- msg = f"Node name is not a string: {node_name}"- raise JobHistoryError(msg)-- def _pipe_layer_to_subgraph_name(self, pipe_layer: list[str]) -> str:- return "-".join(pipe_layer)-- def _add_start_node(self) -> str:- node = SpecialNodeName.START- node_attributes: dict[str, Any] = {- NodeAttributeKey.CATEGORY: NodeCategory.SPECIAL,- NodeAttributeKey.TAG: "Start",- NodeAttributeKey.NAME: "Start",- }- self.nx_graph.add_node(node, **node_attributes)- return node-- def _make_stuff_node_tag(- self,- stuff: Stuff,- as_item_index: int | None = None,- ) -> str:- concept_display = Concept.sentence_from_concept(concept=stuff.concept)- log.verbose(f"Concept display: {stuff.concept.code} -> {concept_display}")- if stuff.is_list:- concept_display = f"List of [{concept_display}]"- if as_item_index is not None:- return f"**{concept_display}** #{as_item_index + 1}"- name = stuff.stuff_name- if not name:- msg = f"Stuff name is empty for stuff {stuff}"- raise JobHistoryError(msg)- return f"{name}:<br>**{concept_display}**"-- def _add_stuff_node(- self,- stuff: Stuff,- pipe_layer: list[str],- comment: str,- as_item_index: int | None = None,- ) -> str:- node = stuff.stuff_code- is_existing = self.nx_graph.has_node(node)- if is_existing:- if self._is_debug_mode:- existing_comment = self.nx_graph.nodes[node][NodeAttributeKey.COMMENT]- comment = f"{existing_comment}<br/>+ {comment}"- self.nx_graph.nodes[node][NodeAttributeKey.COMMENT] = comment- return node-- stuff_content_rendered = stuff.content.rendered_plain()[:250]- stuff_content_type = type(stuff.content).__name__- stuff_description = f"{stuff_content_type}"- stuff_description += f"<br/><br/>{stuff_content_rendered}…"-- node_tag = self._make_stuff_node_tag(- stuff=stuff,- as_item_index=as_item_index,- )- if stuff.is_text and self._tracker_config.is_include_text_preview:- node_tag += f"<br/>{stuff_content_rendered[:100]}"- pipe_layer_str = self._pipe_layer_to_subgraph_name(pipe_layer)- node_attributes: dict[str, Any] = {- NodeAttributeKey.CATEGORY: NodeCategory.STUFF,- NodeAttributeKey.TAG: node_tag,- NodeAttributeKey.NAME: stuff.stuff_name,- NodeAttributeKey.DESCRIPTION: stuff_description,- NodeAttributeKey.DEBUG_INFO: stuff.stuff_code,- NodeAttributeKey.COMMENT: comment,- NodeAttributeKey.SUBGRAPH: pipe_layer_str,- }- self.nx_graph.add_node(node, **node_attributes)- return node-- def _add_edge(- self,- from_node: str,- to_node: str,- edge_category: EdgeCategory,- attributes: dict[str, Any] | None = None,- ):- # Ensure both nodes exist with attributes- if not self.nx_graph.has_node(from_node):- msg = f"Source node '{from_node}' does not exist"- raise JobHistoryError(msg)- if not self.nx_graph.has_node(to_node):- msg = f"Target node '{to_node}' does not exist"- raise JobHistoryError(msg)- if not self.nx_graph.nodes[from_node]:- msg = f"Source node '{from_node}' exists but has no attributes"- raise JobHistoryError(msg)- if not self.nx_graph.nodes[to_node]:- msg = f"Target node '{to_node}' exists but has no attributes"- raise JobHistoryError(msg)-- edge_attributes: dict[str, Any] = {- EdgeAttributeKey.EDGE_CATEGORY: edge_category,- }- if attributes:- edge_attributes.update(attributes)- self.nx_graph.add_edge(from_node, to_node, **edge_attributes)-- @override- def add_pipe_step(- self,- from_stuff: Stuff | None,- to_stuff: Stuff,- pipe_code: str,- comment: str,- pipe_layer: list[str],- as_item_index: int | None = None,- is_with_edge: bool = True,- ):- if not self.is_active:- return- from_node: str- if from_stuff:- from_node = self._add_stuff_node(- stuff=from_stuff,- as_item_index=as_item_index,- pipe_layer=pipe_layer,- comment=comment,- )- else:- from_node = self._add_start_node()- if self.start_node is None:- self.start_node = from_node- to_node = self._add_stuff_node(- stuff=to_stuff,- as_item_index=as_item_index,- pipe_layer=pipe_layer,- comment=comment,- )- edge_caption = pipe_code- if self._is_debug_mode:- edge_caption += f" ({comment})"- edge_attributes: dict[str, Any] = {- EdgeAttributeKey.PIPE_CODE: edge_caption,- }- if is_with_edge:- self._add_edge(- from_node=from_node,- to_node=to_node,- edge_category=EdgeCategory.PIPE,- attributes=edge_attributes,- )-- @override- def add_batch_step(- self,- from_stuff: Stuff | None,- to_stuff: Stuff,- to_branch_index: int,- pipe_layer: list[str],- comment: str,- ):- if not self.is_active:- return- from_node: str- if from_stuff:- from_node = self._add_stuff_node(- stuff=from_stuff,- pipe_layer=pipe_layer,- comment=comment,- )- else:- from_node = self._add_start_node()- if self.start_node is None:- self.start_node = from_node- to_node = self._add_stuff_node(- stuff=to_stuff,- as_item_index=to_branch_index,- pipe_layer=pipe_layer,- comment=comment,- )- self._add_edge(- from_node=from_node,- to_node=to_node,- edge_category=EdgeCategory.BATCH,- )-- @override- def add_aggregate_step(- self,- from_stuff: Stuff,- to_stuff: Stuff,- pipe_layer: list[str],- comment: str,- ):- if not self.is_active:- return- from_node = self._add_stuff_node(- stuff=from_stuff,- pipe_layer=pipe_layer,- comment=comment,- )- to_node = self._add_stuff_node(- stuff=to_stuff,- pipe_layer=pipe_layer,- comment=comment,- )- self._add_edge(- from_node=from_node,- to_node=to_node,- edge_category=EdgeCategory.AGGREGATE,- )-- def _add_condition_node(self, condition: PipeConditionDetails, pipe_layer: list[str]) -> str:- node = condition.code- condition_node_tag = f"Condition:<br>**{condition.test_expression}<br>= {condition.evaluated_expression}**"- pipe_layer_str = self._pipe_layer_to_subgraph_name(pipe_layer)- node_attributes: dict[str, Any] = {- NodeAttributeKey.CATEGORY: NodeCategory.CONDITION,- NodeAttributeKey.TAG: condition_node_tag,- NodeAttributeKey.NAME: condition.code,- NodeAttributeKey.SUBGRAPH: pipe_layer_str,- }- self.nx_graph.add_node(node, **node_attributes)- return node-- @override- def add_condition_step(- self,- from_stuff: Stuff,- to_condition: PipeConditionDetails,- condition_expression: str,- pipe_layer: list[str],- comment: str,- ):- if not self.is_active:- return- from_node = self._add_stuff_node(- stuff=from_stuff,- pipe_layer=pipe_layer,- comment=comment,- )- to_node = self._add_condition_node(condition=to_condition, pipe_layer=pipe_layer)- edge_attributes: dict[str, Any] = {- EdgeAttributeKey.CONDITION_EXPRESSION: condition_expression,- }- self._add_edge(- from_node=from_node,- to_node=to_node,- edge_category=EdgeCategory.CONDITION,- attributes=edge_attributes,- )-- @override- def add_choice_step(- self,- from_condition: PipeConditionDetails,- to_stuff: Stuff,- pipe_layer: list[str],- comment: str,- ):- if not self.is_active:- return- to_node = self._add_stuff_node(- stuff=to_stuff,- pipe_layer=pipe_layer,- comment=comment,- )- edge_attributes: dict[str, Any] = {- EdgeAttributeKey.CHOSEN_PIPE: from_condition.chosen_pipe_code,- }- self._add_edge(- from_node=from_condition.code,- to_node=to_node,- edge_category=EdgeCategory.CHOICE,- attributes=edge_attributes,- )-- def _print_mermaid_flowchart_code_and_url(self, title: str | None = None, subtitle: str | None = None):- if not self.nx_graph.nodes:- log.verbose("No nodes in the pipeline tracker")- return- if self.start_node is None:- msg = "Start node is not set"- raise JobHistoryError(msg)- flowchart = PipelineFlowChart(nx_graph=self.nx_graph, start_node=self.start_node, tracker_config=self._tracker_config)- mermaid_code, url = flowchart.generate_mermaid_flowchart(title=title, subtitle=subtitle)- print_to_stderr(mermaid_code)- title_to_print = "Mermaid flowchart URL"- if title:- title_to_print += f" for {title}"- print_mermaid_url(url=url, title=title_to_print)-- def _print_mermaid_flowchart_url(self, title: str | None = None, subtitle: str | None = None) -> str | None:- if not self.nx_graph.nodes:- log.verbose("No nodes in the pipeline tracker")- return None- if self.start_node is None:- msg = "Start node is not set"- raise JobHistoryError(msg)- flowchart = PipelineFlowChart(nx_graph=self.nx_graph, start_node=self.start_node, tracker_config=self._tracker_config)- _, url = flowchart.generate_mermaid_flowchart(title=title, subtitle=subtitle)- title_to_print = "Mermaid flowchart URL"- if title:- title_to_print += f" for {title}"- print_mermaid_url(url=url, title=title_to_print)- return url-- @override- def output_flowchart(- self,- title: str | None = None,- subtitle: str | None = None,- is_detailed: bool = False,- ) -> str | None:- if is_detailed:- self._print_mermaid_flowchart_code_and_url(title=title, subtitle=subtitle)- else:- return self._print_mermaid_flowchart_url(title=title, subtitle=subtitle)- return Nonediff --git a/pipelex/pipeline/track/pipeline_tracker_protocol.py b/pipelex/pipeline/track/pipeline_tracker_protocol.pydeleted file mode 100644index 55bfbfc98..000000000--- a/pipelex/pipeline/track/pipeline_tracker_protocol.py+++ /dev/null@@ -1,152 +0,0 @@-# pyright: reportUnknownVariableType=false-# pyright: reportUnknownArgumentType=false-# pyright: reportUnknownMemberType=false-# pyright: reportMissingTypeArgument=false-from typing import Protocol--from typing_extensions import override--from pipelex.core.stuffs.stuff import Stuff-from pipelex.pipe_controllers.condition.pipe_condition_details import PipeConditionDetails---class PipelineTrackerProtocol(Protocol):- def setup(self): ...-- def teardown(self): ...-- def reset(self): ...-- def add_pipe_step(- self,- from_stuff: Stuff | None,- to_stuff: Stuff,- pipe_code: str,- comment: str,- pipe_layer: list[str],- as_item_index: int | None = None,- is_with_edge: bool = True,- ): ...-- def add_batch_step(- self,- from_stuff: Stuff | None,- to_stuff: Stuff,- to_branch_index: int,- pipe_layer: list[str],- comment: str,- ): ...-- def add_aggregate_step(- self,- from_stuff: Stuff,- to_stuff: Stuff,- pipe_layer: list[str],- comment: str,- ): ...-- def add_condition_step(- self,- from_stuff: Stuff,- to_condition: PipeConditionDetails,- condition_expression: str,- pipe_layer: list[str],- comment: str,- ): ...-- def add_choice_step(- self,- from_condition: PipeConditionDetails,- to_stuff: Stuff,- pipe_layer: list[str],- comment: str,- ): ...-- def output_flowchart(- self,- title: str | None = None,- subtitle: str | None = None,- is_detailed: bool = False,- ) -> str | None: ...---class PipelineTrackerNoOp(PipelineTrackerProtocol):- """A no-operation implementation of PipelineTrackerProtocol that does nothing.- This is useful when pipeline tracking needs to be disabled.- """-- @override- def setup(self) -> None:- pass-- @override- def teardown(self) -> None:- pass-- @override- def reset(self) -> None:- pass-- @override- def add_pipe_step(- self,- from_stuff: Stuff | None,- to_stuff: Stuff,- pipe_code: str,- comment: str,- pipe_layer: list[str],- as_item_index: int | None = None,- is_with_edge: bool = True,- ) -> None:- pass-- @override- def add_batch_step(- self,- from_stuff: Stuff | None,- to_stuff: Stuff,- to_branch_index: int,- pipe_layer: list[str],- comment: str,- ) -> None:- pass-- @override- def add_aggregate_step(- self,- from_stuff: Stuff,- to_stuff: Stuff,- pipe_layer: list[str],- comment: str,- ) -> None:- pass-- @override- def add_condition_step(- self,- from_stuff: Stuff,- to_condition: PipeConditionDetails,- condition_expression: str,- pipe_layer: list[str],- comment: str,- ) -> None:- pass-- @override- def add_choice_step(- self,- from_condition: PipeConditionDetails,- to_stuff: Stuff,- pipe_layer: list[str],- comment: str,- ) -> None:- pass-- @override- def output_flowchart(- self,- title: str | None = None,- subtitle: str | None = None,- is_detailed: bool = False,- ) -> None:- passdiff --git a/pipelex/pipeline/track/tracker_config.py b/pipelex/pipeline/track/tracker_config.pydeleted file mode 100644index b208fe5c3..000000000--- a/pipelex/pipeline/track/tracker_config.py+++ /dev/null@@ -1,43 +0,0 @@-from typing import Literal--from pipelex.system.configuration.config_model import ConfigModel---class TrackerConfig(ConfigModel):- is_debug_mode: bool- is_include_text_preview: bool- is_include_interactivity: bool- theme: str | Literal["auto"]- layout: str | Literal["auto"]- wrapping_width: int | Literal["auto"]- nb_items_limit: int | Literal["unlimited"]- sub_graph_colors: list[str]- pipe_edge_style: str- branch_edge_style: str- aggregate_edge_style: str- condition_edge_style: str- choice_edge_style: str-- @property- def applied_theme(self) -> str | None:- if self.theme == "auto":- return None- return self.theme-- @property- def applied_layout(self) -> str | None:- if self.layout == "auto":- return None- return self.layout-- @property- def applied_wrapping_width(self) -> int | None:- if self.wrapping_width == "auto":- return None- return self.wrapping_width-- @property- def applied_nb_items_limit(self) -> int | None:- if self.nb_items_limit == "unlimited":- return None- return self.nb_items_limitdiff --git a/pipelex/pipeline/track/tracker_models.py b/pipelex/pipeline/track/tracker_models.pydeleted file mode 100644index 49a2712f1..000000000--- a/pipelex/pipeline/track/tracker_models.py+++ /dev/null@@ -1,47 +0,0 @@-from pydantic import BaseModel--from pipelex.types import StrEnum---class NodeCategory(StrEnum):- SPECIAL = "special"- STUFF = "stuff"- CONDITION = "condition"---class NodeAttributeKey(StrEnum):- CATEGORY = "category"- NAME = "name"- TAG = "tag"- DESCRIPTION = "description"- DEBUG_INFO = "debug_info"- SUBGRAPH = "subgraph"- COMMENT = "comment"---class SpecialNodeName(StrEnum):- START = "start"---class EdgeCategory(StrEnum):- PIPE = "pipe"- BATCH = "batch"- AGGREGATE = "aggregate"- CONDITION = "condition"- CHOICE = "choice"---class EdgeAttributeKey(StrEnum):- EDGE_CATEGORY = "edge_category"- PIPE_CODE = "pipe_code"- CONDITION_EXPRESSION = "condition_expression"- CHOSEN_PIPE = "chosen_pipe"---class GraphTree(BaseModel):- nodes_by_subgraph: dict[str, list[str]]---class SubGraphClassDef(BaseModel):- name: str- color: strdiff --git a/pipelex/system/configuration/configs.py b/pipelex/system/configuration/configs.pyindex f30df0d5a..20e1158fc 100644--- a/pipelex/system/configuration/configs.py+++ b/pipelex/system/configuration/configs.py@@ -9,7 +9,6 @@ from pipelex.cogt.model_backends.prompting_target import PromptingTargetfrom pipelex.cogt.templating.templating_style import TemplatingStylefrom pipelex.core.pipes.exceptions import PipeValidationErrorTypefrom pipelex.language.plx_config import PlxConfig-from pipelex.pipeline.track.tracker_config import TrackerConfigfrom pipelex.system.configuration.config_model import ConfigModelfrom pipelex.system.configuration.config_root import ConfigRootfrom pipelex.tools.aws.aws_config import AwsConfig@@ -124,7 +123,6 @@ class PromptingConfig(ConfigModel):class FeatureConfig(ConfigModel):- is_pipeline_tracking_enabled: boolis_reporting_enabled: bool@@ -170,7 +168,6 @@ class Pipelex(ConfigModel):aws_config: AwsConfigvalidation_error_config: ValidationErrorConfig- tracker_config: TrackerConfigstructure_config: StructureConfigprompting_config: PromptingConfigplx_config: PlxConfigdiff --git a/pipelex/test_extras/shared_pytest_plugins.py b/pipelex/test_extras/shared_pytest_plugins.pyindex 63c8bee91..cb691d20b 100644--- a/pipelex/test_extras/shared_pytest_plugins.py+++ b/pipelex/test_extras/shared_pytest_plugins.py@@ -1,7 +1,9 @@import osimport pytest-from pytest import FixtureRequest, Parser+from pytest import Config, FixtureRequest, Parser+from rich.console import Console+from rich.panel import Panelfrom pipelex.hub import get_consolefrom pipelex.pipe_run.pipe_run_params import PipeRunMode@@ -63,6 +65,51 @@ def pytest_addoption(parser: Parser):)+def pytest_configure(config: Config) -> None: # noqa: ARG001+ """Check prerequisites before test collection starts.++ Validates that Pipelex Gateway terms are accepted when gateway is enabled.+ This runs early to provide clear feedback before wasting time on test collection.+ """+ # Skip check in CI environments (IntegrationMode.CI doesn't require terms)+ if is_env_var_set(key="GITHUB_ACTIONS") or is_env_var_set(key="CI"):+ return++ # Skip check in Codex Cloud (terms acceptance handled differently)+ if is_env_var_truthy(key=CODEX_CLOUD_ENV_VAR_KEY):+ return++ # Import here to avoid circular imports during pytest startup+ from pipelex.system.configuration.config_loader import config_manager # noqa: PLC0415+ from pipelex.system.pipelex_service.pipelex_service_config import ( # noqa: PLC0415+ is_pipelex_gateway_enabled,+ load_pipelex_service_config_if_exists,+ )++ if not is_pipelex_gateway_enabled():+ return++ pipelex_service_config = load_pipelex_service_config_if_exists(config_dir=config_manager.pipelex_config_dir)++ if pipelex_service_config is None or not pipelex_service_config.agreement.terms_accepted:+ console = Console()+ console.print()+ console.print(+ Panel(+ "[bold yellow]Pipelex Service Terms Agreement Required[/bold yellow]\n\n"+ "Tests cannot run because Pipelex Gateway is enabled but terms haven't been accepted.\n\n"+ "[bold]To fix this, choose one option:[/bold]\n\n"+ " [cyan]1.[/cyan] Run [green]pipelex init agreement[/green] to accept terms (quick, no config reset)\n\n"+ " [cyan]2.[/cyan] Run [green]pipelex init config[/green] to fully reset and configure backends\n\n"+ " [cyan]3.[/cyan] Disable gateway in [blue].pipelex/inference/backends.toml[/blue]:\n"+ " [dim]Set pipelex_gateway.enabled = false[/dim]\n",+ title="⚠️ Setup Required",+ border_style="yellow",+ )+ )+ pytest.exit("Service terms not accepted - run 'pipelex init agreement' first", returncode=1)++@pytest.fixturedef pipe_run_mode(request: FixtureRequest) -> PipeRunMode:mode_str = request.config.getoption("--pipe-run-mode")diff --git a/tests/integration/pipelex/fixtures/llm_fixtures.py b/tests/integration/pipelex/fixtures/llm_fixtures.pyindex 49baf501b..5bd8584ac 100644--- a/tests/integration/pipelex/fixtures/llm_fixtures.py+++ b/tests/integration/pipelex/fixtures/llm_fixtures.py@@ -54,7 +54,6 @@ AMAZON_MODELS = [# --- Anthropic Models (Claude) ------------------------------------------------------------------ANTHROPIC_MODELS = ["claude-3-haiku",- "claude-3-opus","claude-3.7-sonnet","claude-4-opus","claude-4-sonnet",