@@ -57,17 +57,23 @@ def __init__(self) -> None:
5757 self ._eval_run_info : dict [str , dict [str , Any ]] = {}
5858 self ._current_eval_set_run_id : str | None = None
5959 self ._current_entrypoint : str | None = None
60+ self ._current_agent_type : str | None = None
6061
6162 @staticmethod
62- def _get_agent_type ( entrypoint : str ) -> str :
63- """Determine agent type from entrypoint .
64-
65- Args:
66- entrypoint: The entrypoint path.
67-
68- Returns:
69- "LowCode" if entrypoint is "agent.json", "Coded" otherwise .
63+ def _resolve_agent_type ( agent_type : str | None , entrypoint : str | None ) -> str :
64+ """Emit the historical ``"LowCode"`` / ``"Coded"`` wire values .
65+
66+ Application Insights dashboards filter on those two exact strings.
67+ When the factory supplies a modern label (e.g. ``"uipath_lowcode"``,
68+ ``"uipath_coded"``) we normalize; when it supplies nothing we fall
69+ back to the pre-refactor entrypoint check (``agent.json`` ⇒
70+ low-code) so no in-flight consumer breaks .
7071 """
72+ if agent_type is not None :
73+ if "lowcode" in agent_type .lower () or "low_code" in agent_type .lower ():
74+ return "LowCode"
75+ return "Coded"
76+ # Fallback: pre-refactor entrypoint-based derivation.
7177 if entrypoint == "agent.json" :
7278 return "LowCode"
7379 return "Coded"
@@ -105,21 +111,25 @@ async def _on_eval_set_run_created(self, event: EvalSetRunCreatedEvent) -> None:
105111 "eval_set_id" : event .eval_set_id ,
106112 "eval_set_run_id" : eval_set_run_id ,
107113 "entrypoint" : event .entrypoint ,
114+ "agent_type" : event .agent_type ,
108115 "no_of_evals" : event .no_of_evals ,
109116 "evaluator_count" : len (event .evaluators ),
110117 }
111118
112119 # Store for child events
113120 self ._current_eval_set_run_id = eval_set_run_id
114121 self ._current_entrypoint = event .entrypoint
122+ self ._current_agent_type = event .agent_type
115123
116124 properties : dict [str , Any ] = {
117125 "EvalSetId" : event .eval_set_id ,
118126 "EvalSetRunId" : eval_set_run_id ,
119127 "Entrypoint" : event .entrypoint ,
120128 "EvalCount" : event .no_of_evals ,
121129 "EvaluatorCount" : len (event .evaluators ),
122- "AgentType" : self ._get_agent_type (event .entrypoint ),
130+ "AgentType" : self ._resolve_agent_type (
131+ event .agent_type , event .entrypoint
132+ ),
123133 "Runtime" : "URT" ,
124134 }
125135
@@ -156,7 +166,9 @@ async def _on_eval_run_created(self, event: EvalRunCreatedEvent) -> None:
156166 # Add entrypoint and agent type
157167 if self ._current_entrypoint :
158168 properties ["Entrypoint" ] = self ._current_entrypoint
159- properties ["AgentType" ] = self ._get_agent_type (self ._current_entrypoint )
169+ properties ["AgentType" ] = self ._resolve_agent_type (
170+ self ._current_agent_type , self ._current_entrypoint
171+ )
160172
161173 self ._enrich_properties (properties )
162174
@@ -207,7 +219,9 @@ async def _on_eval_run_updated(self, event: EvalRunUpdatedEvent) -> None:
207219
208220 if self ._current_entrypoint :
209221 properties ["Entrypoint" ] = self ._current_entrypoint
210- properties ["AgentType" ] = self ._get_agent_type (self ._current_entrypoint )
222+ properties ["AgentType" ] = self ._resolve_agent_type (
223+ self ._current_agent_type , self ._current_entrypoint
224+ )
211225
212226 if trace_id :
213227 properties ["TraceId" ] = trace_id
@@ -271,7 +285,9 @@ async def _on_eval_set_run_updated(self, event: EvalSetRunUpdatedEvent) -> None:
271285
272286 if set_info .get ("entrypoint" ):
273287 properties ["Entrypoint" ] = set_info ["entrypoint" ]
274- properties ["AgentType" ] = self ._get_agent_type (set_info ["entrypoint" ])
288+ properties ["AgentType" ] = self ._resolve_agent_type (
289+ set_info .get ("agent_type" ), set_info ["entrypoint" ]
290+ )
275291
276292 properties ["Runtime" ] = "URT"
277293
@@ -299,6 +315,7 @@ async def _on_eval_set_run_updated(self, event: EvalSetRunUpdatedEvent) -> None:
299315
300316 self ._current_eval_set_run_id = None
301317 self ._current_entrypoint = None
318+ self ._current_agent_type = None
302319
303320 except Exception as e :
304321 logger .debug (f"Error tracking eval set run updated: { e } " )
0 commit comments