Repository navigation
[runtime][python][docs] Fix multi-agent examples and clarify sub-agent usage - #1287
Merged
wenjin272 merged 5 commits intoOct 20, 2026
Merged
Conversation
Create the implicit TableEnvironment from the input DataStream environment. Cover explicit and implicit environments with both output schemas and types. Generated-by: Codex CLI 0.153.4 (GPT-6) Co-authored-by: Codex <codex@openai.com>
Resolve missing child resources from the root while preserving child overrides and root lifecycle ownership. Cover scope creation, shared resources, nested calls and ReAct prompt isolation, and document the shared lookup rule. Generated-by: Codex CLI 0.153.4 (GPT-6) Co-authored-by: Codex <codex@openai.com>
Return zero percentages when a window contains no valid ratings while retaining review reasons. Add aggregation regression coverage and update the quickstart example. Generated-by: Codex CLI 0.153.4 (GPT-6) Co-authored-by: Codex <codex@openai.com>
Describe Table input as Row, align example variable names, and exercise the prompt action with a real Row payload. Generated-by: Codex CLI 0.153.4 (GPT-6) Co-authored-by: Codex <codex@openai.com>
Reorganize the sub-agent guide around declaration, invocation and result handling. Clarify schemas, external setup modes, session ownership, recovery guarantees, observability and usage limits. Generated-by: Codex CLI 0.153.4 (GPT-6) Co-authored-by: Codex <codex@openai.com>
sangkyoonnam
approved these changes
Oct 20, 2026
sangkyoonnam
left a comment
Contributor
There was a problem hiding this comment.
LGTM for the Python runtime and example changes; I didn't review the docs.
I checked Python against Java for lookup order, nested-scope fallback, ownership of inherited resources, and dependency resolution.
I ran the focused tests on a9878cf2: 48 passed in test_resource_cache_inheritance.py, test_eager_materialize.py, test_remote_execution_environment.py, test_multiple_agent_example.py and test_prompt_driven_actions.py. With resource_cache.py, flink_runner_context.py, remote_execution_environment.py and workflow_multiple_agent_example.py reverted to the merge base, 9 tests fail, covering resource fallback, lazy table-environment creation and aggregation with no valid scores.
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.
Related issues: #1283
Purpose of change
Improve the Multi-Agent documentation for 0.4 and fix three Python issues exposed by checking its examples: internal children cannot resolve root resources, DataStream-to-Table conversion fails without an explicit TableEnvironment, and review aggregation divides by zero when no score is valid.
The implementation description below covers the Python runtime and example changes. The documentation also clarifies registration, delegation, input schemas, external setups, sessions, results, recovery, monitoring and restrictions, with aligned Java/Python examples.
Runtime flow
RemoteAgentBuilder.t_envcreates a missing TableEnvironment from the input DataStream's execution environment and caches it.FlinkRunnerContextgives each internal child's resource cache a reference to the root cache. Lookup checks the child first, then delegates missing registrations to the root. The root creates, caches and closes shared resources.0.0%entries while preserving the review reasons.Key decisions
Root fallback matches the Java child-scope behavior, including nested children. Delegating lookup instead of copying resources preserves root ownership and dependency resolution. Child overrides remain local. Table examples use the actual
pyflink.common.Rowinput, and a prompt-action regression uses a real Row.Behavioral Semantics
Interaction decisions
KeyError.Behavioral contracts
Failure behavior
Missing resources still raise
KeyError; provider and resource-opening errors propagate rather than being hidden by fallback. Table planning/conversion errors retain their existing behavior. The aggregation guard handles only the zero-valid-score case; it does not add general input validation. These changes introduce no external-service retries or error suppression.Tests
test_siblings_share_one_parent_instance_without_owning_ittest_child_override_and_dependency_lookup_use_child_scopetest_shared_resource_dependencies_remain_in_the_root_scopetest_missing_name_in_existing_type_falls_back_but_wrong_type_does_nottest_child_provider_failure_does_not_silently_fall_backtest_new_child_scopes_can_resolve_root_resources; parameterizedtest_caller_driven_react_subagenttest_model_driven_react_subagent_delegationtest_datastream_to_table_uses_input_environmenttest_score_distribution_ignores_out_of_range_scorestest_prompt_driven_actions.pyValidation completed on this change:
git diff --checkpassed.Not verified: the full repository test suite, the Flink version matrix, live model/remote-agent services, or fresh Java snippet compilation. Real Flink validation used Flink 2.3, Python 3.11 and JDK 21. The documentation's recovery descriptions were checked against source and focused tests; this PR does not add a restart/failover E2E scenario.
API
No public Agent API or YAML format changes.
ResourceCachegains an optional fallback cache. Python children that previously failed on root-only resources can now resolve them; existing child registrations retain precedence. Java behavior is unchanged. Table input remains Row; its documentation is corrected. The example retains its processing-time streaming windows.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)