fix: resolve skills not exposed to agents and LogLevel enum errors#3209
fix: resolve skills not exposed to agents and LogLevel enum errors#3209JasonW404 wants to merge 2 commits into
Conversation
be13985 to
1c65925
Compare
1c65925 to
24e0752
Compare
- Fix LogLevel.WARNING AttributeError by replacing with LogLevel.ERROR (smolagents LogLevel enum only has OFF/ERROR/INFO/DEBUG, no WARNING) at core_agent.py lines 417 and 804 - Increase skills token budget from 1000 to 4000 in summary_config.py to accommodate the verbose 6-step skill usage process (~2500-3500 chars) that was being silently dropped by TokenBudgetStrategy - Add skills sections to English prompt templates (manager + managed) mirroring the Chinese template structure with <available_skills> block and skill usage requirements section - Add diagnostic logging in create_agent_info.py and core_agent.py to track skills count and component assembly for debugging - Improve exception handling in _get_skills_for_template() with ERROR level logging and full stack trace for better observability - Add comprehensive test suite (test_context_component_types.py) with 38 tests covering component types, assembly validation, and semantic equivalence between Jinja2 templates and component assembly path All 104 tests pass (38 backend + 66 SDK), zero regressions.
24e0752 to
f8797b0
Compare
|
Thanks for the thorough root-cause analysis and the detailed PR description. A few observations after reviewing the diff:
Overall: The core fixes (budget increase, LogLevel enum, skills in EN templates) are correct and necessary. The structural refactoring (KB extraction, SkillsComponent type change, resources header) is going in the right direction. The above items are suggestions, not blockers. |
…fault - Add atomic replace_components() method to ContextManager to prevent race conditions when swapping components on conversation-level CM - Fix run_agent.py to re-register components on surviving CM after overwrite (both MCP and non-MCP paths) - Guard CM creation in nexent_agent.py with enabled check to avoid creating useless CM when context management is disabled - Change enable_context_manager default from False to True - Fix numbering consistency: tools and skills always show 1./3. prefix - Fix indentation in manager_system_prompt_template_en.yaml (6→5 spaces) - Add tests for replace_components() and component survival after overwrite
|
Thanks for the thorough review! Addressing your points: Point 1 (Log warning when strategy drops component): The logging is already active in the current code. See logger.warning(
"TokenBudgetStrategy dropped component type=%s priority=%d "
"tokens=%d reason=%s (total %d/%d, type %d/%d)",
comp.component_type, comp.priority, comp_tokens, reason,
total_tokens, token_budget,
current_type_total, comp_budget,
)This logs whenever a component is dropped due to budget pressure, identifying whether it was the global or per-type budget that tripped. Point 5 (Priority=55 concern for managed agents): Fixed in latest commit. Tools and skills now always show numbering (1. Tools, 3. Skills) regardless of Point 6 (Indentation nit): Fixed in latest commit. Lines 225-227 in Additional fixes in this commit:
Points 2-4 noted, thanks for the positive feedback on the structural improvements! |
Summary
Fix two critical runtime issues that prevented skills from being exposed to agents and caused agent execution failures.
Issues Fixed
1. Skills Not Exposed to Agents (skills_count=0)
Root Cause: The
TokenBudgetStrategywas silently dropping theSkillsComponentbecause the formatted skills description (with the 6-step usage process) exceeded the 1000-token budget allocated to theskillscomponent type.Fix: Increased the skills token budget from 1000 to 4000 tokens in
summary_config.pyto accommodate the verbose skill usage instructions (~2500-3500 chars).Additional Fix: Added missing skills sections to English prompt templates (
manager_system_prompt_template_en.yamlandmanaged_system_prompt_template_en.yaml) to provide a fallback path when the component-based assembly is not used.2. LogLevel Enum AttributeError
Root Cause: Code referenced
LogLevel.WARNINGwhich doesn't exist in the smolagentsLogLevelenum (only hasOFF,ERROR,INFO,DEBUG).Fix: Replaced
LogLevel.WARNINGwithLogLevel.ERRORat two locations incore_agent.py(lines 417 and 804).Changes
sdk/nexent/core/agents/summary_config.py: Increased skills budget from 1000 to 4000 tokenssdk/nexent/core/agents/core_agent.py: Fixed LogLevel.WARNING → LogLevel.ERROR (2 occurrences)backend/prompts/manager_system_prompt_template_en.yaml: Added skills sectionsbackend/prompts/managed_system_prompt_template_en.yaml: Added skills sectionsbackend/agents/create_agent_info.py: Added diagnostic logging and improved exception handlingtest/backend/utils/test_context_component_types.py: Added 38 comprehensive testsTesting
All 104 tests pass (38 backend + 66 SDK), zero regressions.
Verification
After applying these fixes:
read_skill_md(),run_skill_script(), and other skill-related toolsAttributeError: WARNINGcrashes during agent execution