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:
teknium1
2026-02-03 15:26:59 -08:00
parent 221fb17c5e
commit 212460289b
4 changed files with 35 additions and 15 deletions

View File

@@ -406,10 +406,15 @@ def get_skills_tool_definitions() -> List[Dict[str, Any]]:
"type": "function",
"function": {
"name": "skills_categories",
"description": "List available skill categories. Call first if you want to discover categories, then use skills_list(category) to filter, or call skills_list if unsure.",
"description": "List available skill categories. Call this first to discover what skill categories exist, then use skills_list(category) to see skills in a category.",
"parameters": {
"type": "object",
"properties": {},
"properties": {
"verbose": {
"type": "boolean",
"description": "If true, include skill counts per category. Default: false."
}
},
"required": []
}
}
@@ -907,7 +912,8 @@ def handle_skills_function_call(function_name: str, function_args: Dict[str, Any
str: Function result as JSON string
"""
if function_name == "skills_categories":
return skills_categories()
verbose = function_args.get("verbose", False)
return skills_categories(verbose=verbose)
elif function_name == "skills_list":
category = function_args.get("category")