Skip to content

[Tiny Agents] Add tools to config #3242

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

NielsRogge
Copy link
Contributor

This PR enables tools inclusion/exclusion for a given agent. Users can specify the tools to include/exclude like so:

{
  "model": "meta-llama/Meta-Llama-3-8B-Instruct",
  "provider": "auto",
  "servers": [
    {
      "type": "stdio",
      "command": "npx",
      "args": ["@playwright/mcp@latest"],
+      "tools": {
+        "include": ["browser_click", "browser_close"]
      }
    }
  ]
}

Note: this feature was implemented using Claude Code.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Member

@julien-c julien-c left a comment

Choose a reason for hiding this comment

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

what does Claude say the behavior should be if specify both 'include' and 'exclude'? 😀

Copy link
Contributor

@Wauplin Wauplin left a comment

Choose a reason for hiding this comment

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

Back to work Claude! 😁

Copy link
Contributor

Choose a reason for hiding this comment

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

to be removed

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

to be removed

class StdioServerConfig(TypedDict):
type: Literal["stdio"]
command: str
args: List[str]
env: Dict[str, str]
cwd: str
tools: NotRequired[ToolsConfig]
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you rename it allowed_tools and accept only a list of strings as input? I can see pretty clearly the goal of allowing only a certain subset of tools but not necessarily excluding some. In the future if we really need it we can always add a new forbidden_tools property.

Note: this is taken from OpenAI's specs
image

Comment on lines +251 to +253
def _filter_tools(
self, tools: List[Any], tools_config: Optional[Dict[str, Any]], all_tool_names: List[str]
) -> List[Any]:
Copy link
Contributor

Choose a reason for hiding this comment

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

Haven't reviewed this logic myself but I feel that if we only have a allowed_tools list then a 1-line list comprehension should be enough

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.

4 participants