@@ -214,11 +214,18 @@ def extract_agent_metadata(agent: Any) -> dict[str, Any]:
214214
215215 # Try multiple attribute names for model ID
216216 model_id = None
217- for attr in ["model_id" , "model" , "model_name" , "_model_id" , "name" ]:
218- if hasattr (model , attr ):
219- model_id = getattr (model , attr )
220- if model_id and model_id != "Unknown" :
221- break
217+
218+ # Check for Strands-style config dict first
219+ if hasattr (model , "config" ) and isinstance (model .config , dict ):
220+ model_id = model .config .get ("model_id" )
221+
222+ # Fall back to checking various attributes
223+ if not model_id :
224+ for attr in ["model_id" , "model" , "model_name" , "_model_id" , "name" ]:
225+ if hasattr (model , attr ):
226+ model_id = getattr (model , attr )
227+ if model_id and model_id != "Unknown" :
228+ break
222229
223230 # Clean up model_id if it's a long AWS model string
224231 if model_id and isinstance (model_id , str ):
@@ -238,8 +245,17 @@ def extract_agent_metadata(agent: Any) -> dict[str, Any]:
238245 model_id = "Claude Haiku"
239246
240247 metadata ["model_id" ] = model_id or "Unknown Model"
241- metadata ["max_tokens" ] = getattr (model , "max_tokens" , "Unknown" )
242- metadata ["temperature" ] = getattr (model , "temperature" , "Unknown" )
248+
249+ # Try to get max_tokens and temperature
250+ # Check config dict first (Strands-style), then attributes
251+ if hasattr (model , "config" ) and isinstance (model .config , dict ):
252+ metadata ["max_tokens" ] = model .config .get ("max_tokens" , "Unknown" )
253+ # Temperature might be in params dict within config
254+ params = model .config .get ("params" , {})
255+ metadata ["temperature" ] = params .get ("temperature" , "Unknown" )
256+ else :
257+ metadata ["max_tokens" ] = getattr (model , "max_tokens" , "Unknown" )
258+ metadata ["temperature" ] = getattr (model , "temperature" , "Unknown" )
243259
244260 # Try to extract tools - check multiple attributes
245261 tools = None
0 commit comments