Skip to content

feat(runner): build algorithms with runtime models - #912

Merged
afourniernv merged 2 commits into
NVIDIA-NeMo:mainfrom
afourniernv:codex/litellm-runtime-models
Oct 12, 2026
Merged

afourniernv merged 2 commits into
NVIDIA-NeMo:mainfrom
afourniernv:codex/litellm-runtime-models

Conversation

@afourniernv

@afourniernv afourniernv commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

What

Adds AlgorithmSpec::build_with_runtime_models(...), which builds an algorithm and the RuntimeModels it needs from the same route configuration.

Why

Embedded Rust hosts can already build an AlgorithmSpec, but the runtime model-group mapping is private. Without this method, a host has to duplicate Switchyard's algorithm-specific mapping for Stage, classifiers, subagents, and the other route types.

Notes for reviewers

Start with crates/switchyard-runner/src/algorithm.rs. The native deployment loader now uses the same builder instead of maintaining its own runtime-model resolver.

This adds one public method. AlgorithmSpec::build(...) and its behavior remain unchanged.

Related: #922 adds a separate error variant for preserving native host errors. The two PRs can merge independently.

Validated with:

  • cargo fmt --all --check
  • cargo test -p switchyard-runner

Summary by CodeRabbit

  • Bug Fixes
    • Route configuration now reports an error when an algorithm references a model target that is not available, rather than building the route with an unresolved target.

Signed-off-by: Alex Fournier <afournier@nvidia.com>
@afourniernv
afourniernv force-pushed the codex/litellm-runtime-models branch from a8dfbe1 to e773924 Compare October 6, 2026 17:37
@afourniernv afourniernv changed the title feat(runner): support embedded Rust hosts feat(runner): build algorithms with runtime models Oct 6, 2026
@afourniernv
afourniernv marked this pull request as ready for review October 9, 2026 18:37
@afourniernv
afourniernv requested a review from a team as a code owner October 9, 2026 18:37
@coderabbitai

coderabbitai Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA-NeMo/Switchyard/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: afffd075-ec44-4a20-80a3-91c49daa3523

📥 Commits

Reviewing files that changed from the base of the PR and between 79f2751 and e773924.


📒 Files selected for processing (3)
  • crates/switchyard-runner/src/algorithm.rs
  • crates/switchyard-runner/src/config.rs
  • crates/switchyard-runner/tests/route.rs

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.



Walkthrough

AlgorithmSpec now resolves configured target names into runtime model mappings and returns them with the built algorithm. Route construction and route tests use the returned mappings. Unknown targets produce an error.

Changes

Runtime model resolution

Layer / File(s) Summary
Build algorithms with runtime models
crates/switchyard-runner/src/algorithm.rs
AlgorithmSpec::build_with_runtime_models returns the built algorithm and resolved parent and optional subagent model groups. An unknown target name returns an error.
Use resolved models in route construction
crates/switchyard-runner/src/config.rs, crates/switchyard-runner/tests/route.rs
Route construction and tests use the algorithm builder’s returned runtime models. A route test checks the error for an unknown target.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to e7739

No actionable issue is established for this change; it appears ready for normal merge checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies the main change: building algorithms with runtime models in the runner.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.


  • Fix all pre-merge checks with AI
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

I’m a rabbit with a route to run,
I map each target, one by one.
The model groups now come along,
Unknown names return an error song.
I hop through tests beneath the moon.

Comment @coderabbitai help to get the list of available commands.

Signed-off-by: Alex Fournier <afournier@nvidia.com>

@nachiketb-nvidia nachiketb-nvidia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@afourniernv
afourniernv merged commit de4cc55 into NVIDIA-NeMo:main Oct 12, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants