From 146694539e443554e2c025cede8b12e5ba660f0d Mon Sep 17 00:00:00 2001 From: huanghuoguoguo <1051233107@qq.com> Date: Tue, 19 May 2026 10:36:19 +0800 Subject: [PATCH] chore(pipeline): clarify preferred default runner --- src/langbot/pkg/api/http/service/pipeline.py | 26 +++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/langbot/pkg/api/http/service/pipeline.py b/src/langbot/pkg/api/http/service/pipeline.py index f1d17767..1e1f5f40 100644 --- a/src/langbot/pkg/api/http/service/pipeline.py +++ b/src/langbot/pkg/api/http/service/pipeline.py @@ -8,7 +8,10 @@ import typing from ....core import app from ....entity.persistence import pipeline as persistence_pipeline -DEFAULT_RUNNER_ID = 'plugin:langbot/local-agent/default' +# Prefer the official local-agent plugin when it is installed. This is not a +# built-in fallback: when no AgentRunner plugin is available, the default +# pipeline stays unbound so the UI can guide users to install a runner. +PREFERRED_DEFAULT_RUNNER_ID = 'plugin:langbot/local-agent/default' default_stage_order = [ @@ -52,16 +55,25 @@ class PipelineService: with open(template_path, 'r', encoding='utf-8') as f: config = json.load(f) + agent_runner_registry = getattr(self.ap, 'agent_runner_registry', None) + if agent_runner_registry is None: + return config + try: - runners = await self.ap.agent_runner_registry.list_runners(bound_plugins=None) + runners = await agent_runner_registry.list_runners(bound_plugins=None) except Exception as e: - self.ap.logger.warning(f'Failed to load plugin agent runners for default pipeline config: {e}') + logger = getattr(self.ap, 'logger', None) + if logger: + logger.warning(f'Failed to load plugin agent runners for default pipeline config: {e}') return config if not runners: return config - selected_runner = next((runner for runner in runners if runner.id == DEFAULT_RUNNER_ID), runners[0]) + selected_runner = next( + (runner for runner in runners if runner.id == PREFERRED_DEFAULT_RUNNER_ID), + runners[0], + ) ai_config = config.setdefault('ai', {}) runner_config = ai_config.setdefault('runner', {}) runner_config['id'] = selected_runner.id @@ -102,10 +114,12 @@ class PipelineService: # Only installed/available runners should be shown config_item['options'] = runner_options - # Set default to the official local-agent when installed, otherwise first available runner. + # Prefer the official local-agent plugin when installed; otherwise use the first + # discoverable runner. If no runner is available, leave the default unset so the + # UI can recommend installing an AgentRunner plugin, similar to the RAG flow. if runner_options and 'default' not in config_item: default_option = next( - (option for option in runner_options if option['name'] == DEFAULT_RUNNER_ID), + (option for option in runner_options if option['name'] == PREFERRED_DEFAULT_RUNNER_ID), runner_options[0], ) config_item['default'] = default_option['name']