Skip to content

feat(server): compose proxy applications from typed configuration - #2467

Merged
Pouyanpi merged 2 commits into
developfrom
pouyanpi/proxy-declarative-composition-a
Oct 23, 2026
Merged

Pouyanpi merged 2 commits into
developfrom
pouyanpi/proxy-declarative-composition-a

Conversation

@Pouyanpi

@Pouyanpi Pouyanpi commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Select provider instances, operations, dialects and Rails configs through typed Python configuration, reusing the existing application assembly. No runtime policy generation.

Stack: #2466 → #2467 → #2468. Package separation follows separately; API-docs prototype excluded.

PR Base
#2467: typed composition #2466
#2468: YAML/launcher #2467

Summary by CodeRabbit

  • New Features

    • Added an experimental Python proxy application with declarative configuration for providers, operations, dialects, and Rails configurations.
    • Supports fixed or dynamically selected Rails configurations, custom integrations, local routes, request limits, and timeouts.
    • Configuration and routing are validated before the application starts.
  • Documentation

    • Added guidance covering setup, supported providers, routing, validation, authentication boundaries, and lifecycle behavior.
  • Bug Fixes

    • Improved configuration validation to reject invalid, conflicting, incomplete, or unsupported settings.

@github-actions github-actions Bot added size: L status: needs triage New issues that have not yet been reviewed or categorized. labels Oct 15, 2026
@Pouyanpi Pouyanpi self-assigned this Oct 15, 2026
@Pouyanpi
Pouyanpi force-pushed the pouyanpi/proxy-declarative-composition-a branch from bbc2247 to 9668baa Compare October 20, 2026 08:12
@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.42520% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...moguardrails/server/experimental/_configuration.py 97.80% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@Pouyanpi
Pouyanpi added this pull request to stack #2477 October 20, 2026 12:19
@Pouyanpi
Pouyanpi force-pushed the pouyanpi/proxy-declarative-composition-a branch from 9668baa to 70b7a83 Compare October 20, 2026 12:31
@Pouyanpi
Pouyanpi force-pushed the pouyanpi/proxy-declarative-composition-a branch from 70b7a83 to 2e85af3 Compare October 20, 2026 13:54
@Pouyanpi
Pouyanpi marked this pull request as ready for review October 20, 2026 13:59
@Pouyanpi
Pouyanpi force-pushed the pouyanpi/proxy-declarative-composition-a branch from 2e85af3 to fccc743 Compare October 20, 2026 15:41
@Pouyanpi
Pouyanpi force-pushed the pouyanpi/proxy-declarative-composition-a branch from fccc743 to bf49ad9 Compare October 20, 2026 17:06
@Pouyanpi
Pouyanpi force-pushed the pouyanpi/proxy-declarative-composition-a branch 2 times, most recently from d370ff5 to 53a49fa Compare October 21, 2026 08:22
@Pouyanpi
Pouyanpi force-pushed the pouyanpi/proxy-declarative-composition-a branch 2 times, most recently from 3273d3a to bf9dc0a Compare October 21, 2026 11:06
@Pouyanpi Pouyanpi added status: triaged Triaged by a maintainer; eligible for automated review (CodeRabbit/Greptile). and removed status: needs triage New issues that have not yet been reviewed or categorized. labels Oct 21, 2026
@coderabbitai

coderabbitai Bot commented Oct 21, 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/Guardrails/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 1ffafb77-bd72-4314-a973-2aab975aaf3b
📥 Commits

Reviewing files that changed from the base of the PR and between 6afe8d3 and bf9dc0a.

📒 Files selected for processing: 6
  • nemoguardrails/server/experimental/_application.py
  • nemoguardrails/server/experimental/_configuration.py
  • nemoguardrails/server/experimental/application.md
  • nemoguardrails/server/experimental/application.py
  • nemoguardrails/server/experimental/rails/config.py
  • tests/server/experimental/test_application_configuration.py

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

The proxy application now supports validated declarative configuration alongside explicit provider integrations. Provider endpoints and fixed or dynamic Rails configuration selection are resolved during application construction. Tests cover configuration validation, routing, and guarded and passthrough request handling.

Changes: Proxy Application Configuration

Layer / File(s) Summary
Configuration contracts and provider resolution
nemoguardrails/server/experimental/_configuration.py, nemoguardrails/server/experimental/rails/config.py, nemoguardrails/server/experimental/application.md, tests/server/experimental/test_application_configuration.py
Adds immutable provider and application configuration models, validates Rails configuration entries, and resolves supported provider bindings and Rails selections. Tests cover validation, endpoint bindings, and schema behavior.
Application construction and settings
nemoguardrails/server/experimental/_application.py, nemoguardrails/server/experimental/application.py, nemoguardrails/server/experimental/application.md, tests/server/experimental/test_application_configuration.py
Adds factory overloads for declarative configuration and explicit integrations, applies configuration values or defaults, and exports the public application API. Tests cover construction, settings, routing, and pre-resource validation.
Request-time Rails selection and proxy behavior
nemoguardrails/server/experimental/application.md, tests/server/experimental/test_application_configuration.py
Documents fixed and dynamic Rails selection. Tests cover resolver context and failures, blocked and passthrough traffic, and buffered and streaming responses.

Priority: ➖ Normal

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

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant ProxyApplication
  participant ConfigResolver
  participant RailsCatalogue
  participant UpstreamTransport
  Client->>ProxyApplication: Send guarded request
  ProxyApplication->>ConfigResolver: Resolve Rails configuration with request context
  ConfigResolver-->>ProxyApplication: Return selected Rails configuration
  ProxyApplication->>RailsCatalogue: Apply selected Rails configuration
  ProxyApplication->>UpstreamTransport: Forward permitted request
  UpstreamTransport-->>ProxyApplication: Return buffered or streaming response
  ProxyApplication-->>Client: Return proxy response
Loading
Merge Risk: ⚪ Minimal · up to bf9dc

No actionable issue remains from this review; the change is mergeable after normal checks.

Pre-merge checks: Passed 4 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 16.98% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 53 functions across 5 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Test Results For Major Changes Warning The PR contains a major feature change: it adds typed proxy configuration, expands the public application factory, and adds 589 lines of configuration tests. The authored PR description contains only … Add a Testing section to the PR description. Document the focused test run, the complete experimental-server test result, pre-commit status, and any known pre-existing failure with its scope.
Passed 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 and concisely describes the main change: composing proxy applications from typed configuration.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 16.98% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 53 functions across 5 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Full details: Test Results For Major Changes

Explanation

The PR contains a major feature change: it adds typed proxy configuration, expands the public application factory, and adds 589 lines of configuration tests. The authored PR description contains only the feature description and stack information. It does not document test commands or test results.

Resolution

Add a Testing section to the PR description. Document the focused test run, the complete experimental-server test result, pre-commit status, and any known pre-existing failure with its scope.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@greptile-apps

greptile-apps Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Adds typed Python configuration for composing proxy applications from reviewed provider bindings and a shared Rails catalogue.

  • Python settings choose the proxy’s provider operations and Rails rules.
  • Each provider can use fixed Rails rules or choose them per request.

No actionable issues were found. Tests were inspected, not run. The previous-review comparison failed the ancestry/base guards, so this review covered the full PR diff. No previous review threads were supplied.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[ProxyConfig] --> B[Validate declaration]
    B --> C[Select reviewed provider bindings]
    B --> D{Rails selection}
    D -->|Fixed| E[Use declared config ID]
    D -->|Dynamic| F[Call trusted resolver]
    C --> G[Existing application assembly]
    E --> G
    F --> G
    G --> H[Validate catalogue paths and routes]
    H --> I[Lifespan starts HTTP client and Rails checkers]
Loading

Reviews (7) · Last reviewed commit: "test(server): align declarative Response..." · Reviewed by Greptile

@Pouyanpi
Pouyanpi force-pushed the pouyanpi/proxy-declarative-composition-a branch from bf9dc0a to 729d8c4 Compare October 21, 2026 11:56
@Pouyanpi
Pouyanpi force-pushed the pouyanpi/proxy-declarative-composition-a branch from 729d8c4 to 40e9b87 Compare October 21, 2026 15:42
@Pouyanpi
Pouyanpi force-pushed the pouyanpi/proxy-declarative-composition-a branch from 40e9b87 to 47c93ca Compare October 21, 2026 18:19
@Pouyanpi
Pouyanpi removed this pull request from stack #2477 October 22, 2026 10:55
@Pouyanpi
Pouyanpi added this pull request to stack #2487 October 22, 2026 10:57

@tanushriya910 tanushriya910 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

changes look good to me, one non blocking question: the docs are clear that operations isn't a route allowlist, but once this is driven from YAML a reader may only see the config. wondering if an option to reject unguarded routes per instance is worth a follow-up, or we want to maintain the current behavior as part of the full passthrough design?

@Pouyanpi
Pouyanpi force-pushed the pouyanpi/proxy-declarative-composition-a branch from 47c93ca to e9db0a1 Compare October 23, 2026 10:22
@Pouyanpi
Pouyanpi force-pushed the pouyanpi/proxy-declarative-composition-a branch from e9db0a1 to 172926d Compare October 23, 2026 10:47
@m-misiura

Copy link
Copy Markdown
Contributor

changes look good to me, one non blocking question: the docs are clear that operations isn't a route allowlist, but once this is driven from YAML a reader may only see the config. wondering if an option to reject unguarded routes per instance is worth a follow-up, or we want to maintain the current behavior as part of the full passthrough design?

agreeing with @tanushriya910, no reason not to LGTM

@Pouyanpi

Copy link
Copy Markdown
Collaborator Author

Thanks @tanushriya910 and @m-misiura 🚀 I agree, an explicit per-instance option to reject unguarded routes should be a separate follow-up. this PR preserves the existing passthrough behavior (which I don't like it)

@m-misiura

Copy link
Copy Markdown
Contributor

Thanks @tanushriya910 and @m-misiura 🚀 I agree, an explicit per-instance option to reject unguarded routes should be a separate follow-up. this PR preserves the existing passthrough behavior (which I don't like it)

Ack, seperate follow-up sounds good. LGTM

Base automatically changed from pouyanpi/litellm-responses-dialect-2 to develop October 23, 2026 16:36
@Pouyanpi
Pouyanpi force-pushed the pouyanpi/proxy-declarative-composition-a branch from 172926d to dddc6b8 Compare October 23, 2026 16:41
Resolve explicit provider, operation, and dialect selections into existing endpoint bindings and reuse the application assembly. Keep native dialect selection provider-relative and preserve direct Python integrations without adding another factory selection API.

Use one shared Rails catalogue with fixed IDs per provider or an application-level dynamic resolver. Fixed providers bypass the callback; missing dynamic callbacks and unknown references fail closed. Preserve existing direct-call selection semantics and runtime ownership.

Validate nested ConfigEntry data without introducing a second entry type. Add configuration/schema, real-Rails buffered and streaming, passthrough, isolation, and direct-API regressions plus Python examples.

Validation: 169 focused tests and pre-commit passed. The complete experimental-server suite passed 1753 tests with one independently reproduced pre-existing core queue-cleanup failure; lifecycle fixes remain separate prerequisites.
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
Signed-off-by: Pouyanpi <13303554+Pouyanpi@users.noreply.github.com>
@Pouyanpi
Pouyanpi force-pushed the pouyanpi/proxy-declarative-composition-a branch from dddc6b8 to 3d4cdd9 Compare October 23, 2026 16:44
@Pouyanpi
Pouyanpi merged commit 1493e0a into develop Oct 23, 2026
17 checks passed
@Pouyanpi
Pouyanpi deleted the pouyanpi/proxy-declarative-composition-a branch October 23, 2026 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: L status: triaged Triaged by a maintainer; eligible for automated review (CodeRabbit/Greptile). temp: guardrails-proxy

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants