Skip to content

Add Tool Filtering to Agent Config #80

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

WillFleming
Copy link

This PR adds support for filtering tools available to an agent via include_tools and exclude_tools parameters.

Summary

  • New AgentConfig fields: include_tools and exclude_tools (lists of {server}-{tool} strings)
  • Tools are filtered at initialization; exclusion takes precedence over inclusion
  • Makes it easy to restrict or customize tool access per agent

Examples

@agent(
    name="search_agent",
    servers=["search-api"],
    include_tools=["search-api-web_search"]
)
@agent(
    name="safe_file_agent",
    servers=["file-system"],
    exclude_tools=["file-system-delete_file"]
)

Useful for limiting tool access in multi-agent setups or when integrating with third-party tool servers.

@evalstate
Copy link
Owner

evalstate commented Apr 19, 2025

Thanks @WillFleming -- this is a great feature.

Couple of questions/information if you're open to collaborate further on this:

  1. We've begun using AgentCard and AgentSkill types from the A2A Protocol internally to describe Agents and their Types. It's early days, but you can see in router_agent.py and

    async def convert(self, tool: Tool) -> AgentSkill:
    """
    Convert a Tool to an AgentSkill.
    """
    _, tool_without_namespace = await self._parse_resource_name(tool.name, "tool")
    return AgentSkill(
    id=tool.name,
    name=tool_without_namespace,
    description=tool.description,
    tags=["tool"],
    examples=None,
    inputModes=None, # ["text/plain"],
    # cover TextContent | ImageContent ->
    # https://github.com/modelcontextprotocol/modelcontextprotocol/pull/223
    # https://github.com/modelcontextprotocol/modelcontextprotocol/pull/93
    outputModes=None, # ,["text/plain", "image/*"],
    )
    the beginnings of mapping Tools to Skills. It feels like this might be a good way to go (but it's early days).

  2. The consideration of whether this should be a runtime or configuration time decision (or controllable both ways).

I'd be interested in your thoughts on the above and thank you for the PR so far :)

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