Skip to content

feat(routing): add local model routing#3443

Closed
vvv214 wants to merge 2 commits intoagentscope-ai:mainfrom
vvv214:codex/qwenpaw-routing-minimal
Closed

feat(routing): add local model routing#3443
vvv214 wants to merge 2 commits intoagentscope-ai:mainfrom
vvv214:codex/qwenpaw-routing-minimal

Conversation

@vvv214
Copy link
Copy Markdown
Contributor

@vvv214 vvv214 commented Apr 15, 2026

Theme

This PR brings QwenPaw's existing local/cloud routing config back into the live runtime and upgrades it from a mode-only skeleton to a deterministic routing v1.

What this PR adds

  • wire llm_routing back into create_model_and_formatter
  • keep the existing dual-slot local/cloud config shape
  • add deterministic routing rules for:
    • structured output
    • non-text user content
    • tool_choice=required
    • recent tool context
  • make multimodal capability checks routing-aware so cloud-routed multimodal requests are not pre-stripped
  • keep formatter/media behavior aligned with routing decisions
  • add focused backend unit tests for routing policy, model-factory wiring, formatter normalization, and prompt multimodal capability resolution

What this PR does not add

  • learned router / local judge
  • benchmark or experiment scripts
  • shadow evaluation / route logging
  • extra UI control surface for routing modes

Why now

QwenPaw still carries the llm_routing config and RoutingChatModel skeleton on main, but today it only does local_first / cloud_first. This PR makes that path actually usable without expanding the config model.

Related history

Testing

  • PYTHONPATH=src python -m pytest tests/unit/agents/test_prompt_multimodal_routing.py tests/unit/agents/test_routing_chat_model.py tests/unit/agents/test_routing_model_factory.py tests/unit/agents/test_model_factory_message_normalization.py -q
  • pre-commit run --files src/qwenpaw/agents/prompt.py src/qwenpaw/agents/routing_chat_model.py src/qwenpaw/agents/model_factory.py tests/unit/agents/test_prompt_multimodal_routing.py tests/unit/agents/test_routing_chat_model.py tests/unit/agents/test_routing_model_factory.py tests/unit/agents/test_model_factory_message_normalization.py

@github-actions
Copy link
Copy Markdown

Welcome to QwenPaw! 🐾

Hi @vvv214, this is your 5th Pull Request.

📋 About PR Template

To help maintainers review your PR faster, please make sure to include:

  • Description - What this PR does and why
  • Type of Change - Bug fix / Feature / Breaking change / Documentation / Refactoring
  • Component(s) Affected - Core / Console / Channels / Skills / CLI / Documentation / Tests / CI/CD / Scripts
  • Checklist:
    • Run and pass pre-commit run --all-files
    • Run and pass relevant tests (pytest or as applicable)
    • Update documentation if needed
  • Testing - How to test these changes
  • Local Verification Evidence:
    pre-commit run --all-files
    # paste summary result
    
    pytest
    # paste summary result

Complete PR information helps speed up the review process. You can edit the PR description to add these details.

🙌 Join Developer Community

Thanks so much for your contribution! We'd love to invite you to join the official QwenPaw developer group! You can find the Discord and DingTalk group links under the "Developer Community" section on our docs page:
https://qwenpaw.agentscope.io/docs/community

We truly appreciate your enthusiasm—and look forward to your future contributions! 😊

We'll review your PR soon.


Tip

⭐ If you find QwenPaw useful, please give us a Star!

Star QwenPaw

Staying ahead

Star QwenPaw on GitHub and be instantly notified of new releases.

Your star helps more developers discover this project! 🐾

@vvv214 vvv214 changed the title feat(routing): add qwenpaw routing v1 feat(routing): add local model routing Apr 15, 2026
@vvv214
Copy link
Copy Markdown
Contributor Author

vvv214 commented Apr 15, 2026

Superseded by #3451 (routing strategy) and #3452 (Settings UI).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant