fix: resolve AgentInfo is_active attribute error

 Fixed metrics summary endpoint 500 error
- Used getattr() with default value for is_active attribute
- Prevents AttributeError when AgentInfo lacks is_active
- Maintains backward compatibility with agent models

🔧 Production monitoring should now work properly
This commit is contained in:
aitbc
2026-04-02 15:43:06 +02:00
parent 3d8f01ac8e
commit 7644691385

View File

@@ -1125,7 +1125,7 @@ async def get_metrics_summary():
# Add additional system metrics
system_metrics = {
"total_agents": len(agent_registry.agents) if agent_registry else 0,
"active_agents": len([a for a in agent_registry.agents.values() if a.is_active]) if agent_registry else 0,
"active_agents": len([a for a in agent_registry.agents.values() if getattr(a, 'is_active', True)]) if agent_registry else 0,
"total_tasks": len(task_distributor.active_tasks) if task_distributor else 0,
"load_balancer_strategy": load_balancer.current_strategy.value if load_balancer else "unknown"
}