Skip to content

Agents landing page #1728

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 26 commits into
base: main
Choose a base branch
from
Open

Agents landing page #1728

wants to merge 26 commits into from

Conversation

merveenoyan
Copy link
Contributor

compiling everything agents and MCP clients, please let me know if I miss something! @aymeric-roucher @abidlabs @julien-c

@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.

@aymeric-roucher
Copy link
Contributor

Thanks a lot @merveenoyan , this will be a great addition! 😃

merveenoyan and others added 5 commits May 7, 2025 11:07
Co-authored-by: Aymeric Roucher <[email protected]>
Co-authored-by: Aymeric Roucher <[email protected]>
Co-authored-by: Aymeric Roucher <[email protected]>
Co-authored-by: Aymeric Roucher <[email protected]>
Copy link
Member

@abidlabs abidlabs left a comment

Choose a reason for hiding this comment

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

gradio parts looks great @merveenoyan added some suggestions

Copy link
Member

@pcuenca pcuenca left a comment

Choose a reason for hiding this comment

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

LGTM with @abidlabs' suggestions

merveenoyan and others added 8 commits May 7, 2025 15:07
Co-authored-by: Abubakar Abid <[email protected]>
Co-authored-by: Abubakar Abid <[email protected]>
Co-authored-by: Pedro Cuenca <[email protected]>
Co-authored-by: Pedro Cuenca <[email protected]>
Co-authored-by: Pedro Cuenca <[email protected]>
Co-authored-by: Abubakar Abid <[email protected]>
Co-authored-by: Abubakar Abid <[email protected]>
Co-authored-by: Pedro Cuenca <[email protected]>
Copy link
Member

@Vaibhavs10 Vaibhavs10 left a comment

Choose a reason for hiding this comment

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

when finished it'll be cool to write about the Python client too.


demo.launch(mcp_server=True)

The MCP server will be available at `http://your-server:port/gradio_api/mcp/sse` where your application is served. It will have a tool corresponding to each function in your Gradio app, with the tool description automatically generated from the docstrings of your functions.
Copy link
Member

Choose a reason for hiding this comment

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

for the deployed space on the hub - it'd be hf.space domain right? - I wonder if we can make it more HF spaces as a MCP server centric.

https://www.gradio.app/guides/using-docs-mcp#installing-in-the-clients

cc: @abidlabs

merveenoyan and others added 2 commits May 7, 2025 16:47
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.

also cc @burtenshaw who's been working on a mcp-course from what i've seen (from random stalking😁)

Comment on lines 66 to 67
- local: agents
title: Agents on Hub
Copy link
Member

Choose a reason for hiding this comment

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

i would put it in Other, maybe between Paper pages and Search:

image

If you want to avoid defining agents yourself, the easiest way to start an agent is through the CLI, using the `smolagent` command.

```python
smolagent "Plan a trip to Tokyo, Kyoto and Osaka between Mar 28 and Apr 7." --model-type "InferenceClientModel" --model-id "Qwen/Qwen2.5-Coder-32B-Instruct" --imports "pandas numpy" --tools "web_search"
Copy link
Member

Choose a reason for hiding this comment

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

can we format it on multiple lines? see current rendering: https://moon-ci-docs.huggingface.co/docs/hub/pr_1728/en/agents

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry it was supposed to be bash

Copy link
Member

Choose a reason for hiding this comment

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

made a suggestion on above here: #1728 (comment)

Copy link
Member

@Vaibhavs10 Vaibhavs10 left a comment

Choose a reason for hiding this comment

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

Starting to look nice and clean, some more suggestions for readability and more complete snippets

If you want to avoid defining agents yourself, the easiest way to start an agent is through the CLI, using the `smolagent` command.

```bash
smolagent "Plan a trip to Tokyo, Kyoto and Osaka between Mar 28 and Apr 7." --model-type "InferenceClientModel" --model-id "Qwen/Qwen2.5-Coder-32B-Instruct" --imports "pandas numpy" --tools "web_search"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
smolagent "Plan a trip to Tokyo, Kyoto and Osaka between Mar 28 and Apr 7." --model-type "InferenceClientModel" --model-id "Qwen/Qwen2.5-Coder-32B-Instruct" --imports "pandas numpy" --tools "web_search"
smolagent "Plan a trip to Tokyo, Kyoto and Osaka between Mar 28 and Apr 7." \
--model-type "InferenceClientModel" \
--model-id "Qwen/Qwen2.5-Coder-32B-Instruct" \
--imports "pandas numpy" \
--tools "web_search"

bash -> multiline so that it's more readable for readers.


smolagents also supports MCP servers as tools, as follows:

```python
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
```python
```python
# pip install --upgrade smolagents mcp

so that the snippets are complete.

ENDPOINT_URL=http://localhost:1234/v1 \
MODEL_ID=lmstudio-community/Qwen3-14B-GGUF \
npx @huggingface/mcp-client
You can get more information about mcp-client [here](https://huggingface.co/docs/huggingface.js/en/mcp-client/README).
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
You can get more information about mcp-client [here](https://huggingface.co/docs/huggingface.js/en/mcp-client/README).

this shouldn't be in the bash statement.

npx @huggingface/mcp-client
You can get more information about mcp-client [here](https://huggingface.co/docs/huggingface.js/en/mcp-client/README).
```

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
You can get more information about mcp-client [here](https://huggingface.co/docs/huggingface.js/en/mcp-client/README).

adding it back here.


To make a Gradio application an MCP server, simply pass in `mcp_server=True` when launching your demo like follows.

```python
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
```python
```python
# pip install gradio
import grade as gr

making the snippet more complete

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.

7 participants