Enhance skills tool to have an arg so it is more reliably called, and error handling in agent
- Updated the `skills_categories` function to include a `verbose` parameter, allowing users to request skill counts per category. - Modified the `handle_skills_function_call` method to pass the `verbose` argument to `skills_categories`. - Improved error handling in the `AIAgent` class by injecting a recovery message when invalid JSON arguments are detected, guiding users on how to correct their tool calls. - Enhanced the `GatewayRunner` to return a user-friendly error message if the agent fails to generate a final response, improving overall user experience.
This commit is contained in:
parent
221fb17c5e
commit
212460289b
4 changed files with 35 additions and 15 deletions
|
|
@ -451,7 +451,16 @@ class GatewayRunner:
|
|||
# TODO: Implement proper history restoration
|
||||
|
||||
result = agent.run_conversation(message)
|
||||
return result.get("final_response", "(No response)")
|
||||
|
||||
# Return final response, or a message if something went wrong
|
||||
final_response = result.get("final_response")
|
||||
if final_response:
|
||||
return final_response
|
||||
elif result.get("error"):
|
||||
# Agent couldn't recover - show the error
|
||||
return f"⚠️ {result['error']}"
|
||||
else:
|
||||
return "(No response generated)"
|
||||
|
||||
# Start progress message sender if enabled
|
||||
progress_task = None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue