[runtime][plan][python] Add built-in operational metrics - #955
Open
joeyutong wants to merge 3 commits into
Open
Conversation
joeyutong
force-pushed
the
codex/agent-operational-metrics-pr
branch
from
August 3, 2026 11:33
faddd6f to
934c1ce
Compare
2 tasks
joeyutong
force-pushed
the
codex/agent-operational-metrics-pr
branch
from
August 4, 2026 03:07
6bfa5f7 to
cf250fa
Compare
joeyutong
force-pushed
the
codex/agent-operational-metrics-pr
branch
2 times, most recently
from
August 11, 2026 16:08
d056238 to
1715c67
Compare
Derive input-run, Action, LLM, Tool, Skill, and MCP metrics from runtime lifecycle boundaries. Rebuild current-count gauges from Flink state and align Java and Python retry metrics under the model resource scope. Co-Authored-By: Claude Code <noreply@anthropic.com> AI-Model: gpt-5 AI-Contributed/Feature: 1214/1214 AI-Contributed/UT: 653/653
Document the current Java and Python Tool result mappings, align the retry configuration reference with the model resource scope, and link the follow-up alignment work. Co-Authored-By: Claude Code <noreply@anthropic.com> AI-Model: gpt-5 AI-Contributed/Feature: 4/4 AI-Contributed/UT: 0/0
Use the test Agent name when validating the operator metric scope. Co-Authored-By: Claude Code <noreply@anthropic.com> AI-Model: gpt-5 AI-Contributed/Feature: 0/0 AI-Contributed/UT: 8/8
joeyutong
force-pushed
the
codex/agent-operational-metrics-pr
branch
from
August 23, 2026 12:20
1715c67 to
806fdc9
Compare
joeyutong
marked this pull request as ready for review
August 23, 2026 12:21
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.
What changed
This PR implements the built-in operational metrics proposed in Discussion #901.
It builds on the execution lifecycle and trace context introduced by the merged #924. Metrics and Event Log recording consume the same in-process execution events independently; metrics are not derived by reading the Event Log.
Runtime lifecycle integration
ActionExecutionOperatorrecords input queue, input-run, Action task, and Action execution boundaries at the points where they occur.OperatorStateManagerexposes pending Action state for restoring current-count gauges after task recovery.BuiltInMetricsis the central dispatcher. Action lifecycle events feed Action metrics, while LLM and Tool lifecycle events feed execution-entity metrics.Metric implementations
BuiltInInputRunMetricsrecords run outcomes, end-to-end, queue, and processing latency, pending input Events, and active input runs.BuiltInActionMetricsrecords scheduling and logical execution latency, pending Action tasks, and active Action executions.BuiltInExecutionMetricspairs execution start and terminal events by execution id, then dispatches by entity type.LlmExecutionMetricRecorderrecords model-resource success, failure, and latency.ToolExecutionMetricRecorderrecords Tool metrics and projects explicit Skill and MCP Server metadata into independent scopes.Tool outcomes retain the existing language-specific contracts. Java maps an unsuccessful
ToolResponseto failure. Python maps resource preparation and invocation exceptions to failure, while a normal arbitrary return remains successful because Python currently has no explicit error-result type. Strict alignment is tracked in #956 and is planned after the parallel Tool-call work in #926. This PR retains the Tool and MCP outcome counters and does not infer failure from arbitrary return payloads.Java and Python ChatModel paths
model_resourcein both Java and Python, including final-failure andIGNOREpaths.modelscope.Metric scope and documentation
Validation
mvn -T4 -B --no-transfer-progress spotless:checkmvn -B --no-transfer-progress -pl plan,runtime -am -DskipITs -Dtest=ChatModelActionRetryTest,ChatModelActionRoutingTest,CompileUtilsTest,BuiltInActionMetricsTest,BuiltInExecutionMetricsTest,BuiltInInputRunMetricsTest,ActionExecutionOperatorTest -Dsurefire.failIfNoSpecifiedTests=false testpython/:pytest -q flink_agents/plan/tests/actions/test_chat_model_action_retry.py flink_agents/api/tests/test_execution_reporter.py flink_agents/runtime/tests/test_flink_runner_context_trace.pypython/:ruff check flink_agents/plan/actions/chat_model_action.py flink_agents/plan/tests/actions/test_chat_model_action_retry.pyRelated work