v1.21.0

huggingface/smolagentsv1.21.0Aug 7, 2025by albertvillanova

AI Summary

A major release focusing on tool improvements, executor security by blocking dunder calls, and Gradio UI enhancements. It also removes several deprecated parameters and attributes.

Key Highlights

  • Added `to_code_prompt` and `to_tool_calling_prompt` methods to Tools
  • Enhanced LocalPythonExecutor security by blocking dunder calls
  • Improved Gradio UI with memory reset and better type mapping
  • Removed deprecated `grammar`, token count attributes, and `logs` attribute

Breaking Changes

  • Removed deprecated `grammar` parameter
  • Removed deprecated token count attributes
  • Removed deprecated agent `logs` attribute
  • Removed deprecated default `sse` transport

New Features

  • Tool prompt generation methods
  • Enhanced security
  • Gradio UI improvements

Full Release Notes

## Enhancements โœจ

* **Tool & Model Improvements**

  * Add Tool to_code_prompt and to_tool_calling_prompt by @albertvillanova in https://github.com/huggingface/smolagents/pull/1599
  * Improve function body extraction in tools by @HairlessVillager in https://github.com/huggingface/smolagents/pull/1627
  * Support passing model_kwargs to TransformersModel by @albertvillanova in https://github.com/huggingface/smolagents/pull/1608
  * Support dict messages as direct input to models by @albertvillanova in https://github.com/huggingface/smolagents/pull/1570

* **Executor Improvements**

  * Enhance `LocalPythonExecutor` security by blocking dunder calls by @nnfrog in https://github.com/huggingface/smolagents/pull/1551
  * Fix `continue` semantics of `LocalPythonExecutor`by @adaminsky in https://github.com/huggingface/smolagents/pull/1645
  * Fix `GeneratorExp` in `LocalPythonExecutor` to return `Generator` instead of `list` by @albertvillanova in https://github.com/huggingface/smolagents/pull/1650

* **Gradio & UI**

  * Reset agent memory on GradioUI clear button by @albertvillanova in https://github.com/huggingface/smolagents/pull/1611
  * Use `gr.Number` for mapping integer and number type components in `launch_gradio_demo` by @karenwky in https://github.com/huggingface/smolagents/pull/1320

## Bug Fixes ๐Ÿ›

* Fix: Prevent empty additional_args from being added to agent prompt by @jokokojote in https://github.com/huggingface/smolagents/pull/1566
* Fix SyntaxError in generated Gradio app due to 'class' attribute by @albertvillanova in https://github.com/huggingface/smolagents/pull/1615
* Fix serialization inconsistency in MultiStepAgent.to_dict/from_dict for managed_agents by @hazrmard in https://github.com/huggingface/smolagents/pull/1577
* Fix a kwargs error in LocalPythonExecutor by @aymeric-roucher in https://github.com/huggingface/smolagents/pull/1583
* Fix structured outputs by @MicrosoftJames in https://github.com/huggingface/smolagents/pull/1642
* Fix bug where `AmazonBedrockServerModel` crashes in thinking mode by @benoriol in https://github.com/huggingface/smolagents/pull/1632
* Fix: Remove duplicate line in `tool_calling_agent` prompt by @yusuf-eren in https://github.com/huggingface/smolagents/pull/1636
* Fix: `RemotePythonExecutor` should not send variables if none exist by @thomasjpfan in https://github.com/huggingface/smolagents/pull/1605
* Disable parallel tool calls for final answer by @aymeric-roucher in https://github.com/huggingface/smolagents/pull/1539


## Documentation ๐Ÿ“š

* Improve Installation docs with uv option by @albertvillanova in https://github.com/huggingface/smolagents/pull/1550
* Fix and improve MCP server security warnings in docs by @albertvillanova in https://github.com/huggingface/smolagents/pull/1549
* DOC: Fix image link for docs (secure_code_execution.md) by @FacerAin in https://github.com/huggingface/smolagents/pull/1582
* Update title of page "What are agents" by @aymeric-roucher in https://github.com/huggingface/smolagents/pull/1546
* Enable multilingual docs by @albertvillanova in https://github.com/huggingface/smolagents/pull/1633
* ๐ŸŒ [i18n-KO] Translated `index.md` to Korean by @FacerAin in https://github.com/huggingface/smolagents/pull/1581
* ๐ŸŒ [i18n-KO] Translated `text_to_sql.md` to Korean by @nsbg in https://github.com/huggingface/smolagents/pull/1603

## CI / Dependency Updates ๐Ÿงช

* Pin mcpadapt to support image/audio content by @albertvillanova in https://github.com/huggingface/smolagents/pull/1558
* Temporarily skip wrongly implemented tests by @albertvillanova in https://github.com/huggingface/smolagents/pull/1571
* CI hotfix: Pin mlx < 0.26.5 by @albertvillanova in https://github.com/huggingface/smolagents/pull/1586
* Support mlx-0.26.5 by @albertvillanova in https://github.com/huggingface/smolagents/pull/1589
* CI hotfix: Pin transformers < 4.54.0 by @albertvillanova in https://github.com/huggingface/smolagents/pull/1620
* Support transformers 4.54.0 by @albertvillanova in https://github.com/huggingface/smolagents/pull/1625
* Fix CI PytestUnknownMarkWarning: Unknown pytest.mark.timeout by @albertvillanova in https://github.com/huggingface/smolagents/pull/1630
* Fix CI quality: remove trailing whitespace by @albertvillanova in https://github.com/huggingface/smolagents/pull/1617

## Deprecations & Cleanups ๐Ÿงน

* Replace deprecated ast.Num and ast.Str with ast.Constant in tool validation by @WilliamRabuel in https://github.com/huggingface/smolagents/pull/1594
* Remove deprecated `grammar` parameter by @albertvillanova in https://github.com/huggingface/smolagents/pull/1651
* Remove deprecated token count attributes by @albertvillanova in https://github.com/huggingface/smolagents/pull/1652
* Remove deprecated agent `logs` attribute by @albertvillanova in https://github.com/huggingface/smolagents/pull/1653
* Remove mention of deprecated `ManagedAgent` from docs by @albertvillanova in https://github.com/huggingface/smolagents/pull/1655
* Remove deprecated default `sse` transport by @albertvillanova in https://github.com/huggingface/smolagents/pull/1656
* Replace duckduckgo_search with ddgs to address package rename warning by @WilliamRabuel in https://github.com/huggingface/smolagents/pull/1593
* Remove unused is_same_item function by @albertvillanova in https://github.com/huggingface/smolagents/pull/1631
* Remove unnecessary import by @rahul-1729 in https://github.com/huggingface/smolagents/pull/1639
* Simplify _is_package_available by @albertvillanova in https://github.com/huggingface/smolagents/pull/1641

## Miscellaneous ๐Ÿ”ง

* Add support for Amazon Bedrock API Keys by @colesmcintosh in https://github.com/huggingface/smolagents/pull/1612
* Factorize create_agent_gradio_app_template function by @albertvillanova in https://github.com/huggingface/smolagents/pull/1616
* Fix: Allow passing integers for floats by @aymeric-roucher in https://github.com/huggingface/smolagents/pull/1623
* Fix Tool.forward to raise NotImplementedError instead of returning by @HairlessVillager in https://github.com/huggingface/smolagents/pull/1628
* Make validate_tool_arguments raise instead of returning error string by @albertvillanova in https://github.com/huggingface/smolagents/pull/1634
* Remove mention of python in additional args by @aymeric-roucher in https://github.com/huggingface/smolagents/pull/1584
* ToolCallingAgent: remove unnecessary addition to `model_output` by @aymeric-roucher in https://github.com/huggingface/smolagents/pull/1622
* Minor fix in toolCallingAgentPrompt by @rahul-1729 in https://github.com/huggingface/smolagents/pull/1574

## Maintenance ๐Ÿ—๏ธ

* Bump dev version: v1.21.0.dev0 by @albertvillanova in https://github.com/huggingface/smolagents/pull/1544
* Remove empty issue template by @albertvillanova in https://github.com/huggingface/smolagents/pull/1562
* Improve issue templates by @albertvillanova in https://github.com/huggingface/smolagents/pull/1563
* Add issue template for documentation improvements by @albertvillanova in https://github.com/huggingface/smolagents/pull/1564
* Add uv option to CONTRIBUTING by @albertvillanova in https://github.com/huggingface/smolagents/pull/1561


## New Contributors
* @jokokojote made their first contribution in https://github.com/huggingface/smolagents/pull/1566
* @rahul-1729 made their first contribution in https://github.com/huggingface/smolagents/pull/1574
* @WilliamRabuel made their first contribution in https://github.com/huggingface/smolagents/pull/1594
* @FacerAin made their first contribution in https://github.com/huggingface/smolagents/pull/1582
* @thomasjpfan made their first contribution in https://github.com/huggingface/smolagents/pull/1605
* @hazrmard made their first contribution in https://github.com/huggingface/smolagents/pull/1577
* @HairlessVillager made their first contribution in https://github.com/huggingface/smolagents/pull/1628
* @benoriol made their first contribution in https://github.com/huggingface/smolagents/pull/1632
* @yusuf-eren made their first contribution in https://github.com/huggingface/smolagents/pull/1636
* @nnfrog made their first contribution in https://github.com/huggingface/smolagents/pull/1551
* @nsbg made their first contribution in https://github.com/huggingface/smolagents/pull/1603
* @karenwky made their first contribution in https://github.com/huggingface/smolagents/pull/1320
* @MicrosoftJames made their first contribution in https://github.com/huggingface/smolagents/pull/1642
* @adaminsky made their first contribution in https://github.com/huggingface/smolagents/pull/1645

**Full Changelog**: https://github.com/huggingface/smolagents/compare/v1.20.0...v1.21.0