Repository navigation
[api][plan][runtime] Use generic resource descriptors for sub-agents - #1242
Merged
wenjin272 merged 1 commit intoOct 13, 2026
Merged
Conversation
Contributor
Author
wenjin272
force-pushed
the
codex/subagent-resource-descriptors
branch
from
October 13, 2026 07:09
770258d to
22c7391
Compare
2 of 5 tasks
Contributor
|
Thanks for the PR. LTGM. nit: the |
Declare internal sub-agents with Java and Python InternalSubagentResourceDescriptorBuilder APIs returning ordinary ResourceDescriptors, preserving description and input schema metadata. Normalize the Agent registration shorthand in addResource, then compile the child workflow into the descriptor's plan argument with cycle detection and per-name scopes. Construct runtime setups through generic resource providers and make SubagentSetup a Resource. Remove InternalSubagentProvider and its serialization special cases while preserving Python lifecycle forwarding for lazy internal sub-agent handles. External setups are declared through descriptors. Keep the generic ResourceDescriptor unchanged. Align plan fields and accessors across Java/Python, update cross-language snapshots and documentation, and keep runtime-dependent tests in the runtime suite. Validation: Java API/Plan/Runtime suites, Python API/Plan/Runtime suites, six real Flink internal/external sub-agent E2E tests with rebuilt JARs, Ruff, Java 11 Spotless, Apache RAT on the source export, and git diff --check. Generated-by: Codex CLI 0.153.4 (GPT-6) Co-authored-by: Codex <codex@openai.com>
wenjin272
force-pushed
the
codex/subagent-resource-descriptors
branch
from
October 13, 2026 11:38
22c7391 to
7b52fb1
Compare
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: Closes #1241
Purpose of change
Sub-agents can be declared through ordinary resource descriptors while preserving descriptions and input schemas for model-selected calls. This removes the dedicated internal-subagent provider and the different Java/Python serialized-resource representations.
Runtime flow
InternalSubagentResourceDescriptorBuilder().build()returns a descriptor (constructed withnewin Java).Agent.addResource/add_resourcealso wraps the direct-Agent shorthand in a descriptor.plan, assigns the registration name asscope, and retains recursive cycle detection.Key decisions
Keep the generic
ResourceDescriptorunchanged. The builder supplies declaration convenience; the plan layer owns compilation, and runtime owns invocation.SubagentSetupextendsResource, since the plan transfers its descriptor rather than a live setup instance.Behavioral Semantics
Interaction decisions
NotImplementedError.Behavioral contracts
Failure behavior
Builders reject missing Agents, conflicting schema/type declarations, unsupported input types, and blank schemas. Plan compilation rejects cycles and invalid AGENT declarations; runtime decoding rejects missing or malformed compiled plan data. These errors raise without fallback or retry. Child action failures retain the existing failed-result path. External transport, retry, and recovery semantics are unchanged.
Tests
AgentPlanSubagentResourceTest,test_agent_plan_subagent_resources.pyInternalSubagentResourceDescriptorBuilderTest,descriptorMetadataSurvivesCompilationAndJsonWithoutMutatingDeclaration,test_internal_subagent_descriptor.pyAgentPlanCrossLanguageTestsuites and internal-subagent snapshotsInternalSubagentCallTest,InternalSubagentDescriptorTest, three real Flink internal E2E casesSubagentRegisterTest, Python plan compilation rejection testPassed: Java API/Plan/Runtime reactor (2,494 passed, 44 skipped), Python API/Plan/Runtime (1,723 passed, 15 skipped), and six real Flink E2E tests using freshly rebuilt JARs. Ruff, Java 11 Spotless, source-export Apache RAT, and whitespace checks passed.
Python 3.12 regression verification: reproduced the runtime descriptor test failure with an unconstrained mock, then verified the protocol-constrained fixture with 25 descriptor, registration, and sub-agent API tests on both Python 3.11 and 3.12.
After the builder rename: Java focused tests (43 passed, 1 JDK guard test skipped on JDK 21) and Python 3.12 focused tests (49 passed, 1 snapshot-regeneration test skipped) passed.
Not verified: live remote agent services, old serialized-plan/checkpoint migration, and the full Flink/JDK version matrix. Runtime and E2E execution used JDK 21; existing low-JDK restrictions remain.
Implementation invariants and verification commands
Compiled internal descriptors use
JavaResourceProviderin both languages. They contain JSON-compatibleplandata and no live Agent. Python decoding copies that data before the existing AgentPlan validator rebuilds providers. Bridge discovery traverses nested descriptor plans; lifecycle registration no longer depends on the removed serialized-provider representation.mvn test -pl runtime -am -Dspotless.skip=true(JDK 21).pytest flink_agents/api flink_agents/plan flink_agents/runtime -m 'not integration'with the active environment's site-packages onPYTHONPATH.dist/commonanddist/flink-2.3; raninternal_subagent_test.py,subagent_external_integration_test.py, andsubagent_integration_test.pyon Flink 2.3.API
Adds Java/Python
InternalSubagentResourceDescriptorBuilder, constructed directly and returning an ordinaryResourceDescriptorfrombuild().SubagentSetupnow extendsResource; callers registering setup instances must register descriptors instead. Direct-Agent shorthand remains. Internal descriptor data usesplan, with Java setup accessorsgetPlan()/getPlanJson()and Pythonplan. Old dedicated-provider JSON is not supported by the new representation. Resource type and generic descriptor APIs are unchanged.Documentation
doc-neededdoc-not-neededdoc-includedWas this patch authored or co-authored using generative AI tooling?
Generated-by: Codex CLI 0.153.4 (GPT-6)