[api][plan][runtime] Introduce AGENT resource type and sub-agent invocation API - #938
Open
pltbkd wants to merge 3 commits into
Open
[api][plan][runtime] Introduce AGENT resource type and sub-agent invocation API#938pltbkd wants to merge 3 commits into
pltbkd wants to merge 3 commits into
Conversation
pltbkd
force-pushed
the
subagent-framework
branch
from
July 29, 2026 16:13
9356349 to
875b513
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.
Design discussion: #909
Purpose of change
Introduces
AGENTas a first-class resource type and the caller-facing sub-agent invocation API across Java / Python / YAML, per discussion #909.SubagentSetupis the general sub-agent framework. This PR lands the framework and the one way to plug into it today: a customSubagentSetupimplementation. Registering anAgentdirectly as an internal sub-agent is a follow-up addition.Included:
ResourceType.AGENT; register viaaddResource(name, AGENT, setup)and via YAMLsubagents:.Subagent(caller interface) +SubagentSetup(base) +Result+BaseSubagentCallable(captures failures intoResult).call()/asAsyncCallable()run through durable execution; a deterministic(sessionId, callId)identity lets failover replay reuse cached results instead of re-invoking. UseasAsyncCallable()instead ofcallAsync()to support batch async execution.sessionIdis framework-generated and deterministic; callers may pass their own to continue a session.callIdis auto-generated from the per-session conversation ordinal.Evolved from the #909 proposal during review:
Resultcarries a serializableerrorMessage(the failure's full stack trace) instead of a liveException, so it survives durable persistence.(sessionId, callId).Notes
Agentdirectly as anAGENTresource, compiled into a scoped child plan, and its isolated execution).Resultand the parallel async primitive (executeAllAsync) overlap with Parallel Tool Execution ([Feature] Parallel Tool Call Execution #926) and can be aligned/iterated during review.Tests
SubagentSetup+ YAML descriptor), and deterministic-id context / failover-recovery / operator-integration tests.ExternalSubagentTest— programmatic and YAML-declared sub-agent invocation (including failure surfaced viaResult) on a real Flink job.API
Additive public API, kept semantically aligned across Java / Python / YAML:
ResourceType.AGENT,Subagent,SubagentSetup,Result,BaseSubagentCallable,RunnerContext#nextSessionId()/nextCallId(sessionId), and the YAMLsubagents:block.No breaking changes to existing APIs.
Documentation
doc-neededbut deferred: add once the internal sub-agent lands and the API stabilizesdoc-not-neededdoc-included