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

Merged
merged 35 commits into from
May 13, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
c631e6c
Agents landing page
merveenoyan May 6, 2025
8173750
Update agents.md
merveenoyan May 6, 2025
e87b33d
Update docs/hub/agents.md
merveenoyan May 7, 2025
64b6241
Update docs/hub/agents.md
merveenoyan May 7, 2025
600bb3b
Update docs/hub/agents.md
merveenoyan May 7, 2025
d99f6d2
Update docs/hub/agents.md
merveenoyan May 7, 2025
e4e1ef1
Update agents.md
merveenoyan May 7, 2025
d10be2b
Update docs/hub/agents.md
merveenoyan May 7, 2025
a3dc9c5
Update docs/hub/agents.md
merveenoyan May 7, 2025
ddc6745
Update docs/hub/agents.md
merveenoyan May 7, 2025
5451f02
Update docs/hub/agents.md
merveenoyan May 7, 2025
1fcf691
Update docs/hub/agents.md
merveenoyan May 7, 2025
6f99832
Update docs/hub/agents.md
merveenoyan May 7, 2025
3fe50ab
Update docs/hub/agents.md
merveenoyan May 7, 2025
69f4f63
Update docs/hub/agents.md
merveenoyan May 7, 2025
efd6f20
Update docs/hub/agents.md
merveenoyan May 7, 2025
9ea20e7
Update docs/hub/agents.md
merveenoyan May 7, 2025
ac7663e
Update docs/hub/agents.md
merveenoyan May 7, 2025
d4cb687
Update docs/hub/agents.md
merveenoyan May 7, 2025
5cd1f6c
Update docs/hub/agents.md
merveenoyan May 7, 2025
8139c97
Update docs/hub/agents.md
merveenoyan May 7, 2025
b951f2a
Update docs/hub/agents.md
merveenoyan May 7, 2025
38bcfa4
update toctree
merveenoyan May 7, 2025
dfbf60b
bit of formatting
merveenoyan May 7, 2025
75390d5
nit
merveenoyan May 7, 2025
28a41a9
format
merveenoyan May 7, 2025
bc904c3
Update docs/hub/agents.md
merveenoyan May 13, 2025
0979d18
Update docs/hub/agents.md
merveenoyan May 13, 2025
4a9e958
Update docs/hub/agents.md
merveenoyan May 13, 2025
54f60f5
Update agents.md
merveenoyan May 13, 2025
d4a18c4
nits
merveenoyan May 13, 2025
a0ee2b3
reorder
merveenoyan May 13, 2025
b209798
address comments
merveenoyan May 13, 2025
ccab741
move smolagents up
merveenoyan May 13, 2025
eff50a9
Update agents.md
merveenoyan May 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/hub/_toctree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
sections:
- local: adapters
title: Adapters
- 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

- local: allennlp
title: AllenNLP
- local: bertopic
Expand Down
64 changes: 64 additions & 0 deletions docs/hub/agents.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Agents on Hub

This page compiles all the libraries and tools Hugging Face offers for agentic workflows.

## Smolagents

[Smolagents](https://github.com/huggingface/smolagents) is a lightweight library to cover all agentic use cases from code writing agents to computer use in few lines of code. It is model agnostic, supporting local models served with Hugging Face Transformers, as well as models offered with [Inference Providers](../inference-providers/index.md), and proprietary model providers.

It offers three agent classes based on ReAct framework: `CodeAgent` for agents writing their own codes, `ToolCallingAgent` for tool calling agents and the `MultiStepAgent` which the former two agents are based on for multi-step ReAct workflows.

If you want to avoid defining agents yourself, easiest way to start an agent is through CLI, with `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)

```

Agents can be pushed to Hugging Face Hub as Spaces. Check out all the cool agents people have built [here](https://huggingface.co/spaces?filter=smolagents&sort=likes).

## huggingface.js mcp-client
Copy link
Contributor

Choose a reason for hiding this comment

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

One nit: would prefer putting smolagents above huggingface.js agents, since it has more usage and content.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

to me it makes sense to make it high to low level, but I have no strong opinion

Copy link
Contributor

Choose a reason for hiding this comment

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

smolagents seems more high level IMO, this part about huggingface.js sounds like a low level detail
WDYT @Vaibhavs10 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

CLI yes, but other than that it's not I think there's more customization

Copy link
Contributor

@aymeric-roucher aymeric-roucher May 13, 2025

Choose a reason for hiding this comment

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

I don't really see the logic in having "one MCP server of a package" listed above "one MCP server of a bigger package" (smolagents has more usage than the agentic part of huggingface.js): for me it would make sense for the bigger one to be listed first

Copy link
Member

Choose a reason for hiding this comment

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

personally don't think the order matter much, it's just three options anyway, IMHO having more hub related things up front makes wee bit more sense - we can always change the order later on if it doesn't make sense.


Huggingface.js offers an MCP client served with Inference Providers. Getting started with them is as simple as running `pnpm agent`. You can plug and play different models and providers by setting `PROVIDER` and `MODEL_ID` environmental variables.

```bash
export HF_TOKEN="hf_..."
export MODEL_ID="Qwen/Qwen2.5-72B-Instruct"
export PROVIDER="nebius"
pnpm agent
```

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



## Gradio MCP Server

Gradio MCP Server feature wraps Gradio applications to make them available for LLM to use.

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

```python
demo = gr.Interface(
fn=generate_images,
inputs="text",
outputs="image",
title="Image Generator"
)

demo.launch(mcp_server=True)
```

The server will be available at `http://your-server:port/gradio_api/mcp/sse` where your application is served. Lastly, add this to the settings of the MCP Client of your choice.

```
{
"mcpServers": {
"gradio": {
"url": "http://your-server:port/gradio_api/mcp/sse"
}
}
}
```


This is very powerful because it let's the LLM use any Gradio application as a tool. You can find a variety of them on [Spaces](https://huggingface.co/spaces) and serve.