anderson-ufrj
commited on
Commit
·
78c6734
1
Parent(s):
fc3c0be
feat(debug): add Drummond status endpoint and enhanced logging
Browse files- Add /debug/drummond-status endpoint to check agent initialization
- Enhanced logging for intent routing decisions
- Better visibility into why Drummond might be failing
- Help diagnose production issues
- src/api/routes/chat.py +18 -1
src/api/routes/chat.py
CHANGED
|
@@ -90,10 +90,13 @@ async def send_message(
|
|
| 90 |
if intent.type in [IntentType.GREETING, IntentType.CONVERSATION, IntentType.HELP_REQUEST,
|
| 91 |
IntentType.ABOUT_SYSTEM, IntentType.SMALLTALK, IntentType.THANKS, IntentType.GOODBYE]:
|
| 92 |
target_agent = "drummond"
|
|
|
|
| 93 |
elif intent.type == IntentType.INVESTIGATE:
|
| 94 |
target_agent = "abaporu"
|
|
|
|
| 95 |
else:
|
| 96 |
target_agent = "abaporu" # Default to master agent
|
|
|
|
| 97 |
|
| 98 |
# Create agent message
|
| 99 |
agent_message = AgentMessage(
|
|
@@ -521,4 +524,18 @@ async def get_available_agents() -> List[Dict[str, Any]]:
|
|
| 521 |
"description": "Avalia equidade e inclusão",
|
| 522 |
"status": "active"
|
| 523 |
}
|
| 524 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
if intent.type in [IntentType.GREETING, IntentType.CONVERSATION, IntentType.HELP_REQUEST,
|
| 91 |
IntentType.ABOUT_SYSTEM, IntentType.SMALLTALK, IntentType.THANKS, IntentType.GOODBYE]:
|
| 92 |
target_agent = "drummond"
|
| 93 |
+
logger.info(f"Routing to Drummond for intent type: {intent.type}")
|
| 94 |
elif intent.type == IntentType.INVESTIGATE:
|
| 95 |
target_agent = "abaporu"
|
| 96 |
+
logger.info(f"Routing to Abaporu for intent type: {intent.type}")
|
| 97 |
else:
|
| 98 |
target_agent = "abaporu" # Default to master agent
|
| 99 |
+
logger.info(f"Defaulting to Abaporu for intent type: {intent.type}")
|
| 100 |
|
| 101 |
# Create agent message
|
| 102 |
agent_message = AgentMessage(
|
|
|
|
| 524 |
"description": "Avalia equidade e inclusão",
|
| 525 |
"status": "active"
|
| 526 |
}
|
| 527 |
+
]
|
| 528 |
+
|
| 529 |
+
@router.get("/debug/drummond-status")
|
| 530 |
+
async def debug_drummond_status():
|
| 531 |
+
"""Debug endpoint to check Drummond agent status"""
|
| 532 |
+
return {
|
| 533 |
+
"drummond_initialized": drummond_agent is not None,
|
| 534 |
+
"drummond_error": drummond_init_error,
|
| 535 |
+
"drummond_type": str(type(drummond_agent)) if drummond_agent else None,
|
| 536 |
+
"has_process_method": hasattr(drummond_agent, 'process') if drummond_agent else False,
|
| 537 |
+
"intent_types_for_drummond": [
|
| 538 |
+
"GREETING", "CONVERSATION", "HELP_REQUEST",
|
| 539 |
+
"ABOUT_SYSTEM", "SMALLTALK", "THANKS", "GOODBYE"
|
| 540 |
+
]
|
| 541 |
+
}
|