Skip to content

Enhance linting for subagent routing and tools#16

Open
krataratha wants to merge 1 commit into
anthropics:mainfrom
krataratha:patch-1
Open

Enhance linting for subagent routing and tools#16
krataratha wants to merge 1 commit into
anthropics:mainfrom
krataratha:patch-1

Conversation

@krataratha
Copy link
Copy Markdown

Added validation for subagent routing strategy and improved error handling for tools configuration.

Added validation for subagent routing strategy and improved error handling for tools configuration.
Copilot AI review requested due to automatic review settings May 14, 2026 15:55
@github-actions
Copy link
Copy Markdown


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_strategy on subagent entries.
  • Refactors _lint_one() and main() logic in scripts/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_one tail and a second main() below it at module scope. Because that leftover block includes return errs outside any function, the script will fail to import/run with a SyntaxError instead of performing the lint.
if __name__ == "__main__":
    sys.exit(main())

scripts/lint-tool-scope.py:46

  • This only checks that routing_strategy is present and truthy, but the added policy text says subagents must use the required 'handoff' routing. A typo or unsupported strategy such as direct would 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.

Comment on lines +40 to +46
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")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants