-
Notifications
You must be signed in to change notification settings - Fork 303
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
base: main
Are you sure you want to change the base?
Agents landing page #1728
Conversation
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. |
Thanks a lot @merveenoyan , this will be a great addition! 😃 |
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]>
There was a problem hiding this 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
There was a problem hiding this 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
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]>
There was a problem hiding this 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. |
There was a problem hiding this comment.
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
Co-authored-by: Pedro Cuenca <[email protected]>
Co-authored-by: vb <[email protected]>
Co-authored-by: vb <[email protected]>
Co-authored-by: vb <[email protected]>
There was a problem hiding this 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😁)
docs/hub/_toctree.yml
Outdated
- local: agents | ||
title: Agents on Hub |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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" |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)
Co-authored-by: Aymeric Roucher <[email protected]>
Co-authored-by: Julien Chaumond <[email protected]>
Co-authored-by: Julien Chaumond <[email protected]>
There was a problem hiding this 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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
```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). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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). | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
```python | |
```python | |
# pip install gradio | |
import grade as gr |
making the snippet more complete
compiling everything agents and MCP clients, please let me know if I miss something! @aymeric-roucher @abidlabs @julien-c