Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
44 changes: 44 additions & 0 deletions .github/ISSUE_TEMPLATE/i8n.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: 🌐 Translating a new language?
about: Start a new translation effort in your language
title: '[i18n-<languageCode>] Translating docs to <languageName>'
labels: WIP
assignees: ''

---

<!--
Note: Please search to see if an issue already exists for the language you are trying to translate.
-->

Hi!

Let's bring the documentation to all the <languageName>-speaking community 🌐 (currently 0 out of 21 complete)

Who would want to translate? Please follow the 🤗 [TRANSLATING guide](https://github.com/huggingface/smolagents/blob/main/docs/TRANSLATING.md). Here is a list of the files ready for translation. Let us know in this issue if you'd like to translate any, and we'll add your name to the list.

Some notes:

* Please translate using an informal tone (imagine you are talking with a friend about smolagents 🤗).
* Please translate in a gender-neutral way.
* Add your translations to the folder called `<languageCode>` inside the [source folder](https://github.com/huggingface/smolagents/tree/main/docs/source).
* Register your translation in `<languageCode>/_toctree.yml`; please follow the order of the [English version](https://github.com/huggingface/transformers/blob/main/docs/source/en/_toctree.yml).
* Once you're finished, open a pull request and tag this issue by including #issue-number in the description, where issue-number is the number of this issue. Please ping the maintainers for review.
* 🙋 If you'd like others to help you with the translation, you can also post in the 🤗 [forums](https://discuss.huggingface.co/).

## Get Started section

- [ ] [index.md](https://github.com/huggingface/smolagents/blob/main/docs/source/en/index.md) https://github.com/huggingface/transformers/pull/20180
- [ ] [quicktour.md](https://github.com/huggingface/smolagents/blob/main/docs/source/en/guided_tour.md) (waiting for initial PR to go through)
- [ ] [installation.md](https://github.com/huggingface/smolagents/blob/main/docs/source/en/installation.md).

## Tutorial section
- [ ] [building_good_agents.md](https://github.com/huggingface/smolagents/blob/main/docs/source/en/tutorials/building_good_agents.md)
- [ ] [inspect_runs.md](https://github.com/huggingface/smolagents/blob/main/docs/source/en/tutorials/inspect_runs.md)
- [ ] [memory.md](https://github.com/huggingface/smolagents/blob/main/docs/source/en/tutorials/memory.md)
- [ ] [secure_code_execution.md](https://github.com/huggingface/smolagents/blob/main/docs/source/en/tutorials/secure_code_execution.md)
- [ ] [tools.md](https://github.com/huggingface/smolagents/blob/main/docs/source/en/tutorials/tools.md)

<!--
Keep on adding more as you go 🔥
-->
4 changes: 4 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ Adding a new tutorial or section is done in two steps:

Make sure to put your new file under the proper section. If you have a doubt, feel free to ask in a Github Issue or PR.

### Translating

When translating, refer to the guide at [./TRANSLATING.md](https://github.com/huggingface/smolagents/blob/main/docs/TRANSLATING.md).
Copy link
Member

Choose a reason for hiding this comment

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

I think we should locate the TRANSLATING.md file at the root of the repo, what do you think?

Copy link
Contributor Author

@suryabdev suryabdev Oct 16, 2025

Choose a reason for hiding this comment

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

I copied the file location from the transformers repo (/docs)
One reason for them placing it in the docs folder could be that all documentation and instructions for contributing to the docs are located there. (e.g., /docs/README.md). So it is an intuitive location, but I don't have any strong opinions. I’m fine with moving it to the root of the repository if that’s what you prefer.


### Writing source documentation

Values that should be put in `code` should either be surrounded by backticks: \`like so\`. Note that argument names
Expand Down
71 changes: 71 additions & 0 deletions docs/TRANSLATING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Translating the Smolagents documentation into your language

As part of our mission to democratize machine learning, we aim to make the Smolagents library available in many more languages! Follow the steps below to help translate the documentation into your language.

## Open an Issue

1. Navigate to the Issues page of this repository.
2. Check if anyone has already opened an issue for your language.
3. If not, create a new issue by selecting the "Translation template" from the "New issue" button.
4. Post a comment indicating which chapters you'd like to work on, and we'll add your name to the list.

## Fork the Repository

1. First, fork the Smolagents repo by clicking the Fork button in the top-right corner.
2. Clone your fork to your local machine for editing with the following command:

```bash
git clone https://github.com/YOUR-USERNAME/smolagents.git
```

Replace `YOUR-USERNAME` with your GitHub username.

## Copy-paste the English version with a new language code

The documentation files are organized in the following directory:

- **docs/source**: This contains all documentation materials organized by language.

To copy the English version to your new language directory:

1. Navigate to your fork of the repository:

```bash
cd ~/path/to/smolagents/docs
```

Replace `~/path/to` with your actual path.

2. Run the following command:

```bash
cp -r source/en source/LANG-ID
```

Replace `LANG-ID` with the appropriate ISO 639-1 or ISO 639-2 language code (see [this table](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) for reference).

## Start translating

Begin translating the text!

1. Start with the `_toctree.yml` file that corresponds to your documentation chapter. This file is essential for rendering the table of contents on the website.

- If the `_toctree.yml` file doesn't exist for your language, create one by copying the English version and commenting out unrelated sections (instead of deleting them) to avoid potential merge conflicts with other PRs.
- If the `_toctree.yml` file already exists for your language, open it and uncomment the sections that apply to the chapter you're translating.
- Ensure it is placed in the `docs/source/LANG-ID/` directory.

Here's an example structure for the `_toctree.yml` file:

```yaml
- sections:
- local: guided_tour # Keep this name for your .md file
title: Guided tour # Translate this
...
title: Tutorials # Translate this
```

2. Once you've set up and translated the `_toctree.yml`, proceed to translate the associated Markdown (`.md`) files.

## Collaborate and share

If you'd like assistance with your translation, open an issue and tag the maintainers. Feel free to share resources or glossaries to ensure consistent terminology.
6 changes: 3 additions & 3 deletions docs/source/en/conceptual_guides/intro_agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ while llm_should_continue(memory): # this loop is the multi-step part
memory += [action, observations]
```

This agentic system runs in a loop, executing a new action at each step (the action can involve calling some pre-determined *tools* that are just functions), until its observations make it apparent that a satisfactory state has been reached to solve the given task. Heres an example of how a multi-step agent can solve a simple math question:
This agentic system runs in a loop, executing a new action at each step (the action can involve calling some pre-determined *tools* that are just functions), until its observations make it apparent that a satisfactory state has been reached to solve the given task. Here's an example of how a multi-step agent can solve a simple math question:

<div class="flex justify-center">
<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/Agent_ManimCE.gif"/>
Expand All @@ -41,7 +41,7 @@ This agentic system runs in a loop, executing a new action at each step (the act

## ✅ When to use agents / ⛔ when to avoid them

Agents are useful when you need an LLM to determine the workflow of an app. But theyre often overkill. The question is: do I really need flexibility in the workflow to efficiently solve the task at hand?
Agents are useful when you need an LLM to determine the workflow of an app. But they're often overkill. The question is: do I really need flexibility in the workflow to efficiently solve the task at hand?
If the pre-determined workflow falls short too often, that means you need more flexibility.
Let's take an example: say you're making an app that handles customer requests on a surfing trip website.

Expand Down Expand Up @@ -102,4 +102,4 @@ Writing actions in code rather than JSON-like snippets provides better:
- **Composability:** could you nest JSON actions within each other, or define a set of JSON actions to re-use later, the same way you could just define a python function?
- **Object management:** how do you store the output of an action like `generate_image` in JSON?
- **Generality:** code is built to express simply anything you can have a computer do.
- **Representation in LLM training data:** plenty of quality code actions are already included in LLMs training data which means theyre already trained for this!
- **Representation in LLM training data:** plenty of quality code actions are already included in LLMs' training data which means they're already trained for this!
26 changes: 13 additions & 13 deletions docs/source/en/examples/text_to_sql.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

[[open-in-colab]]

In this tutorial, well see how to implement an agent that leverages SQL using `smolagents`.
In this tutorial, we'll see how to implement an agent that leverages SQL using `smolagents`.

> Let's start with the golden question: why not keep it simple and use a standard text-to-SQL pipeline?

A standard text-to-sql pipeline is brittle, since the generated SQL query can be incorrect. Even worse, the query could be incorrect, but not raise an error, instead giving some incorrect/useless outputs without raising an alarm.

👉 Instead, an agent system is able to critically inspect outputs and decide if the query needs to be changed or not, thus giving it a huge performance boost.

Lets build this agent! 💪
Let's build this agent! 💪

Run the line below to install required dependencies:
```bash
Expand Down Expand Up @@ -69,9 +69,9 @@ insert_rows_into_table(rows, receipts)

### Build our agent

Now lets make our SQL table retrievable by a tool.
Now let's make our SQL table retrievable by a tool.

The tools description attribute will be embedded in the LLMs prompt by the agent system: it gives the LLM information about how to use the tool. This is where we want to describe the SQL table.
The tool's description attribute will be embedded in the LLM's prompt by the agent system: it gives the LLM information about how to use the tool. This is where we want to describe the SQL table.

```py
inspector = inspect(engine)
Expand All @@ -89,7 +89,7 @@ Columns:
- tip: FLOAT
```

Now lets build our tool. It needs the following: (read [the tool doc](../tutorials/tools) for more detail)
Now let's build our tool. It needs the following: (read [the tool doc](../tutorials/tools) for more detail)
- A docstring with an `Args:` part listing arguments.
- Type hints on both inputs and output.

Expand Down Expand Up @@ -120,9 +120,9 @@ def sql_engine(query: str) -> str:

Now let us create an agent that leverages this tool.

We use the `CodeAgent`, which is smolagents main agent class: an agent that writes actions in code and can iterate on previous output according to the ReAct framework.
We use the `CodeAgent`, which is smolagents' main agent class: an agent that writes actions in code and can iterate on previous output according to the ReAct framework.

The model is the LLM that powers the agent system. `InferenceClientModel` allows you to call LLMs using HFs Inference API, either via Serverless or Dedicated endpoint, but you could also use any proprietary API.
The model is the LLM that powers the agent system. `InferenceClientModel` allows you to call LLMs using HF's Inference API, either via Serverless or Dedicated endpoint, but you could also use any proprietary API.

```py
from smolagents import CodeAgent, InferenceClientModel
Expand All @@ -136,9 +136,9 @@ agent.run("Can you give me the name of the client who got the most expensive rec

### Level 2: Table joins

Now lets make it more challenging! We want our agent to handle joins across multiple tables.
Now let's make it more challenging! We want our agent to handle joins across multiple tables.

So lets make a second table recording the names of waiters for each receipt_id!
So let's make a second table recording the names of waiters for each receipt_id!

```py
table_name = "waiters"
Expand All @@ -158,7 +158,7 @@ rows = [
]
insert_rows_into_table(rows, waiters)
```
Since we changed the table, we update the `SQLExecutorTool` with this tables description to let the LLM properly leverage information from this table.
Since we changed the table, we update the `SQLExecutorTool` with this table's description to let the LLM properly leverage information from this table.

```py
updated_description = """Allows you to perform SQL queries on the table. Beware that this tool's output is a string representation of the execution output.
Expand All @@ -175,7 +175,7 @@ for table in ["receipts", "waiters"]:

print(updated_description)
```
Since this request is a bit harder than the previous one, well switch the LLM engine to use the more powerful [Qwen/Qwen3-Next-80B-A3B-Thinking](https://huggingface.co/Qwen/Qwen3-Next-80B-A3B-Thinking)!
Since this request is a bit harder than the previous one, we'll switch the LLM engine to use the more powerful [Qwen/Qwen3-Next-80B-A3B-Thinking](https://huggingface.co/Qwen/Qwen3-Next-80B-A3B-Thinking)!

```py
sql_engine.description = updated_description
Expand All @@ -187,11 +187,11 @@ agent = CodeAgent(

agent.run("Which waiter got more total money from tips?")
```
It directly works! The setup was surprisingly simple, wasnt it?
It directly works! The setup was surprisingly simple, wasn't it?

This example is done! We've touched upon these concepts:
- Building new tools.
- Updating a tool's description.
- Switching to a stronger LLM helps agent reasoning.

✅ Now you can go build this text-to-SQL system youve always dreamt of! ✨
✅ Now you can go build this text-to-SQL system you've always dreamt of! ✨