Lee-W commented on code in PR #72786:
URL: https://github.com/apache/airflow/pull/72786#discussion_r4034576665


##########
providers/common/ai/src/airflow/providers/common/ai/toolsets/managed_agent.py:
##########
@@ -232,9 +273,17 @@ async def call_tool(
         ctx: RunContext[Any],
         tool: ToolsetTool[Any],
     ) -> Any:
-        ref = self.agent_ref
+        ref = _safe_agent_ref(self)
         log.info("Consulting managed agent %s on %s", ref.get("name"), 
ref.get("platform"))
         result = await self.invoke(tool_args["prompt"])
+        # Emitted here, not in FailoverManagedAgentToolset.invoke(), so a lone
+        # toolset gets it too -- it is the only per-tool signal a bare toolset
+        # has, and it is the ratio that turns managed_agent.failover from a raw
+        # count into a rate (failovers / invocations for the same tool).
+        Stats.incr(

Review Comment:
   moved `managed_agent.invoked` increments before `invoke()` runs.
   
   The docs stop short of calling `served`/`invoked` a success rate, though.
   
   * `served` only exists for a group and only counts returns from 
`FailoverManagedAgentToolset.invoke()`
   * `invoked` counts the `call_tool()` path, so a direct `invoke(prompt)` is 
outside both.
   
   The Metrics section says so, and `invoked` is documented as the denominator 
for `managed_agent.failover` alone.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to