-
Notifications
You must be signed in to change notification settings - Fork 332
Open
Labels
Milestone
Description
Today, the configuration pivots on plugin names, with each plugin defining where and how it applies (via hooks
, conditions
, tags
, etc.). While flexible, this model introduces certain complexities:
Each plugin declares where it applies.
plugins:
- name: "ContentFilter"
kind: "plugins.native.content_filter.ContentFilterPlugin"
hooks: ["prompt_pre_fetch", "prompt_post_fetch"]
priority: 100
conditions:
- prompts: ["customer_chat", "support_bot"]
server_ids: []
tenant_ids: []
config:
block_patterns: ["ssn", "credit_card"]
mask_char: "*"
- name: "LoggingPlugin"
kind: "plugins.native.logging.LoggingPlugin"
hooks: ["prompt_post_fetch"]
priority: 200
conditions:
- prompts: ["customer_chat"]
1. Tracking Burden
- Each plugin must list all tools, prompts, and resources it applies to.
- As the number of plugins grows, keeping track of their applicability across multiple contexts becomes cumbersome.
2. Ordering Challenges
- Plugin execution order is controlled globally by
priority
. - Maintaining a consistent processing pipeline across routes/tools requires careful coordination of priorities across all plugins.
- Debugging order-of-execution issues becomes harder as more plugins are introduced.
3. Global vs. Local View
- The current structure emphasizes plugins first, not the routes/tools they protect.
- To know which plugin runs for a particular route/tool, you must cross-reference multiple plugin definitions.
Route-Centric Organization (Pivot on Routes/Tools)
Instead of pivoting on plugin names, pivoting on routes/tools invocations could simplify configuration.
Each route/tool lists its filters/plugins inline.
routes:
customer_chat:
- name: ContentFilter
mode: enforce
config:
block_patterns: ["ssn", "credit_card"]
mask_char: "*"
- name: LoggingPlugin
mode: permissive
support_bot:
- name: ContentFilter
mode: enforce_ignore_error
- name: LoggingPlugin
mode: enforce
Benefits
Route-Centric Organization
- Each route/tool is self-contained, listing its applicable filters/plugins inline.
- Easier to understand the complete processing pipeline for a given endpoint / tool.
Simplified Filter Ordering
- Execution order is explicit in the array sequence, avoiding global priority management.
Targeted Configuration
- Each route can have a completely different filter/plugin combination.
- Conditional logic is built into route matching instead of being spread across plugin definitions.
Operational Simplicity
- Adding/removing filters for a route doesn't affect unrelated routes.
- Route-level changes are isolated, safer, and easier to test.
Clear Visibility
- Direct mapping between API endpoints/tool invocations and their processing steps.
- Faster onboarding for new operators—just open the route config and see everything at once.
Industry Precedent
Spring Cloud Gateway uses a similar route-centric model:
spring:
cloud:
gateway:
routes:
- id: createUser
uri: http://dev.something.com
predicates:
- Path=/api/createUser
- Method=POST
filters:
- name: MockExtractSomethingFilter
- name: TokenAuthenticationFilter
- id: updateUser
uri: http://dev.agentpro.com
predicates:
- Path=/api/updateUser/**
- Method=PUT
filters:
- name: MockExtractSomethingFilter
- name: TokenAuthenticationFilter
- name: RBACAuthFilter
args:
requiredPermissions: UPDATE_USER
- RewritePath=/api/updateUser/(?<UniqueCode>.*), /api/updateUser/${UniqueCode}
Questions
- What drove the original decision to use a plugin-centric model?
- Are there specific Context Forge use cases where plugin-centric configuration provides clear advantages?
- Would a route-centric design scale better as the plugin ecosystem grows?
- Could a hybrid approach address concerns from both models?
Note: This is a proposal for discussion. The goal is to evaluate whether a route-centric organization would improve operational clarity and maintainability.
araujof