Enhance linting for subagent routing and tools#16
Conversation
Added validation for subagent routing strategy and improved error handling for tools configuration.
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
There was a problem hiding this comment.
Pull request overview
This PR updates the managed-agent cookbook tool-scope linter to add subagent routing validation and revise tool configuration handling.
Changes:
- Adds documentation for subagent routing validation.
- Adds checks for missing
routing_strategyon subagent entries. - Refactors
_lint_one()andmain()logic inscripts/lint-tool-scope.py.
Comments suppressed due to low confidence (2)
scripts/lint-tool-scope.py:107
- This module guard is inserted before the existing remainder of the file, leaving the old
_lint_onetail and a secondmain()below it at module scope. Because that leftover block includesreturn errsoutside any function, the script will fail to import/run with aSyntaxErrorinstead of performing the lint.
if __name__ == "__main__":
sys.exit(main())
scripts/lint-tool-scope.py:46
- This only checks that
routing_strategyis present and truthy, but the added policy text says subagents must use the required'handoff'routing. A typo or unsupported strategy such asdirectwould pass this lint, so the new rule does not actually enforce the required routing mode.
# Feature: Ensure every subagent has a defined 'routing_strategy'
for sa in subagents:
if isinstance(sa, dict) and not sa.get("routing_strategy"):
errs.append(f"{path}: subagent '{sa.get('name')}' missing routing_strategy")
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| tools = doc.get("tools", []) | ||
| subagents = doc.get("subagents", []) | ||
|
|
||
| # Feature: Ensure every subagent has a defined 'routing_strategy' | ||
| for sa in subagents: | ||
| if isinstance(sa, dict) and not sa.get("routing_strategy"): | ||
| errs.append(f"{path}: subagent '{sa.get('name')}' missing routing_strategy") |
Added validation for subagent routing strategy and improved error handling for tools configuration.