Repository navigation
[api][runtime][java][python] Support cross-language skill repositories - #1214
Merged
Merged
Conversation
Allow Python agents to load classpath skills and Java agents to load Python package skills through operator-scoped runtime bridges. Share source materialization and preserve temporary resource ownership and cleanup across both language paths. Handle distributed JARs without filename extensions, align API and YAML support, and cover packaged sources with cross-language end-to-end tests. Fixes apache#1194 Generated-by: Codex 0.153.4 (GPT-6) Co-authored-by: Codex <codex@openai.com>
1 of 2 tasks
weiqingy
added a commit
to weiqingy/flink-agents
that referenced
this pull request
Oct 11, 2026
Brings in apache#1214, apache#1208 and apache#1138. ChatModelInvoker's two new cancellation checks move to CancellationUtils, since main removed ModelRoutingResolver.isCancellation. ChatModelInvokerTest keeps this branch's tests plus main's provider cancellation test, and test_flink_runner_context_reconcilable.py takes both sides' imports. Generated-by: GitHub Copilot CLI 1.0.95 (Claude Opus 5.5)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linked issue: Fixes #1194
Purpose of change
Python agents can load Skills from job JARs through
Skills.from_classpath(...), and Java agents can load Skills from Python packages throughSkills.fromPackage(...). Both combinations also work through YAML, completing source support independently of the language declaring the agent.Runtime flow
JavaResourceAdapter.extractClasspathSkillswith the operator's Flink user-code classloader. Java resolves the resource and copies/extracts it into the Python repository's temporary directory.PythonBridgeManagerto initialize Python even for an otherwise Java-only agent. The resource context obtains the initialized interpreter when creatingSkillManager;PackageSkillRepositoryinvokes the Python package materializer into a Java-owned temporary directory.Key decisions
Each
SkillManagerowns its source-handler map, so a handler can bind its operator's interpreter or bridge without storing runtime instances globally. Source resolution is shared with native repositories through internal materializers. Classpath fallback opens archive files without requiring a.jarsuffix, covering Flink BLOB cache names and JARs without explicit directory entries.Behavioral Semantics
Interaction decisions
Cross-language use requires the Flink runtime and the corresponding dependencies in the job environment. Declaring a source does not install its JAR or package. Missing runtime bridges fail loading rather than selecting another source.
Behavioral contracts
SKILL.mdand accompanying files.load_skillreturns an error response on initialization failure in both languages, logs the exception chain, and does not misreport repeated failures as an empty configuration. URL origins in responses are redacted.Failure behavior
Repository initialization errors propagate to direct manager callers; partial results are cleaned up. The manager is marked initialized only after successful creation, allowing a later call to attempt initialization again. The built-in
load_skillcatches initialization exceptions and returnsToolResponse.error; no configured manager, unknown Skills, and missing attachments retain their error-response behavior. Repository cleanup failures retain the existing propagation behavior.Tests
PackageSkillsCrossLanguageTestinstalls a generated wheel;skills_cross_language_test.pysubmits a resource JAR. Both verify body and attachment reads. Declaration serialization tests cover the added factories.CrossLanguageSkillSourceTest,test_classpath_repository.py; includes reopening one manager's source after another manager is created and an extensionless JAR through a parent loader.SkillManagerTest,test_manager.py, andResourceCacheTest.LoadSkillToolTest,test_load_skill.py, and missing-source/bridge tests; repeated calls and URL redaction are asserted.Validation: Java clean reactor build with focused API/runtime Skills tests and two Java E2Es passed (170 tests); the final Java tool-response regressions passed (12 tests). Python Skills/API/YAML/cache suites passed (312 tests), as did two packaged-JAR E2Es and the final tool/classpath regressions (17 tests). Spotless, Ruff, and
git diff --checkpassed. Distribution JARs were clean-built and the Python wheel rebuilt for cross-language verification.Validated with Java 11, Python 3.11, and Flink 2.3. Other supported version combinations, a remote multi-TaskManager deployment, and injected operator failover were not exercised. These runs are focused validation, not the full project test suite.
API
Adds Java
Skills.fromPackage(String, String)and PythonSkills.from_classpath(*resources); existing native factories remain available. YAML keeps the existingpackage/classpathshape and gains the corresponding runtime paths. Java/Python runtime-global source registries are removed in favor of instance-owned handlers; these are internal runtime interfaces. Pythonload_skillnow returns an error response for initialization failures that previously escaped as exceptions; Java preserves its response-based contract with more accurate diagnostics.Documentation
doc-neededdoc-not-neededdoc-includedUpdates Skills usage/runtime requirements and refreshes generated YAML schemas and the bundled schema contract.
Was this patch authored or co-authored using generative AI tooling?
Generated-by: Codex 0.153.4 (GPT-6)