wenjin272 opened a new issue, #1438: URL: https://github.com/apache/flink-agents/issues/1438
### Search before asking - [x] I searched the existing issues and found no dedicated issue for this refactoring across Java and Python. ### Description Separate model routing declarations from resource implementations and keep routing execution details out of the shared chat action. Track Java and Python alignment in this issue. The Java refactoring was completed in #1363. Python still defines `ModelRouter` as a `Resource` in the API module, exposes the builder through that class, and instantiates it during builder and plan validation. Its chat action also retains routing orchestration, metadata storage, and retry-stat handling. ### Scope - Keep the user-facing `ModelRouter.of(...).build()` declaration entry point in the API module; move the resource implementation into the plan module. Both classes can retain the name `ModelRouter` in their respective modules. - Validate descriptors during plan construction, including restored plans. Resource construction should decode and initialize an already-validated descriptor without repeating declaration validation. Builder-time checks can remain for early feedback. - Resolve the declaration to the implementation before resource instantiation, keeping the generic resource provider generic. Update resource-name constants, YAML handling, and cross-language plan serialization together. - Keep model selection, candidate execution, fallback, and routing metadata management in the routing layer. The shared chat action should handle the common chat/tool lifecycle. - Keep execution results and route data separate from metadata storage, and share retry-stat handling through an internal helper rather than calling back into the chat action. - Cover declaration, validation, plan serialization/restoration, ordinary routing, and tool-call continuation with focused tests while preserving existing behavior. ### Implementation status - [x] Java: completed in #1363. - [ ] Python: align the declaration/resource split, validation boundaries, and routing execution responsibilities with Java. The Python changes in #1363 only synchronized the Java router placeholder and cross-language handling; they did not refactor the native Python router. Quality-triggered escalation is tracked separately in #1437. This issue covers the refactoring and does not require adding that feature as part of the same change. ### Are you willing to submit a PR? - [ ] I'm willing to submit a PR! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
