Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
197 commits
Select commit Hold shift + click to select a range
28cfef2
Rename managed agent in multiagents docs to avoid confusing the LLM (…
albertvillanova Feb 24, 2025
bcf9bf8
Update documentation on sandboxes (#747)
aymeric-roucher Feb 24, 2025
27c7d83
Add audioop-lts as Python>=3.13 Open DeepResearch requirement for pyd…
albertvillanova Feb 24, 2025
7844408
Create docker extra installation dependency (#764)
albertvillanova Feb 24, 2025
44f4336
Fix bracket logging in rich (#753)
aymeric-roucher Feb 24, 2025
99102f1
Enable custom final answer in CodeAgent (#769)
aymeric-roucher Feb 24, 2025
90c9e85
Fix TypeError raised by launch_gradio_demo with PipelineTool (#732)
albertvillanova Feb 25, 2025
b577f4f
Use docker extra in Secure code execution docs (#780)
albertvillanova Feb 25, 2025
b0608be
Support custom final_answer in agent init (#783)
albertvillanova Feb 25, 2025
1c49ae2
Fix LiteLLMModel API key usage in CLI (#788)
asselindebeauville Feb 25, 2025
df617bb
Secure code execution wrong title in docs TOC (#771)
maeste Feb 25, 2025
7fcc859
Update Open DeepResearch to install smolagents from local path (#786)
albertvillanova Feb 25, 2025
84089bc
Support importing scipy and sklearn without AttributeError: module 's…
albertvillanova Feb 25, 2025
9498094
Fix and test validate_tools_and_managed_agents (#731)
albertvillanova Feb 26, 2025
d0c3f43
Add Docker executor (#733)
aymeric-roucher Feb 26, 2025
2b8ecd0
Update README with mention to Docker sandboxed execution (#803)
touseefahmed96 Feb 26, 2025
d24a207
Support running a demo of Open DeepResearch (#806)
albertvillanova Feb 26, 2025
af03d17
Added sidebar layout and session state management for agent (#797)
yvrjsharma Feb 26, 2025
82e647a
Fix CI quality in examples/gradio_ui (#822)
albertvillanova Feb 27, 2025
3e7945c
Improve dependency loading of Open DeepResearch visual_qa (#821)
albertvillanova Feb 28, 2025
2664c79
Improve setup instruction for Open DeepResearch (#823)
albertvillanova Feb 28, 2025
eed0003
Support other models than o1 in Open Deep Research (#824)
albertvillanova Feb 28, 2025
1db3eb7
Fix final_answer_pattern matching in remote executors (#826)
albertvillanova Feb 28, 2025
259f55d
Fix and refactor tests of Docker executors (#827)
albertvillanova Feb 28, 2025
6abcb5f
Remove unnecessary self argument in GoogleSearchTool super() call (#828)
gael1130 Feb 28, 2025
eef2c17
Fix call from dict with LocalPythonExecutor (#837)
albertvillanova Feb 28, 2025
4f2aa3e
Minor fix of import in VisitWebpageTool (#840)
keetrap Mar 3, 2025
0460614
Make local Python interpreter safer by checking if returns builtins (…
albertvillanova Mar 3, 2025
1077862
Remove dockerfiles (#798)
touseefahmed96 Mar 3, 2025
34a3913
fix: correcting tool_call role (#779)
zndqs Mar 3, 2025
e2a4690
Fix translation guide as it points to invalid location (#794)
FanwangM Mar 3, 2025
3a14d0d
Fix load_model in webagent CLI (#855)
albertvillanova Mar 4, 2025
43d0d59
Fix message for observations without tool_calls (#857)
albertvillanova Mar 4, 2025
8849b95
Make local Python interpreter safer by checking if returns dangerous …
albertvillanova Mar 4, 2025
70d9229
Fix CI test_action_step_to_messages (#868)
albertvillanova Mar 4, 2025
ff7ba51
Make local Python interpreter safer by adding builtins to dangerous m…
albertvillanova Mar 4, 2025
034dcb4
Fix LiteLLMModel docstring (#885)
albertvillanova Mar 5, 2025
340b466
Fix bug where operations count was not reinitialized at each step (#866)
aymeric-roucher Mar 5, 2025
da06f2b
Fix CLI webagent (#889)
albertvillanova Mar 5, 2025
40d795d
Bump dev version: v1.11.0.dev0 (#890)
albertvillanova Mar 5, 2025
bf3686e
Add Chinese translation & fix zh doc build process (#893)
muscaestar Mar 6, 2025
b67cc94
Fix chained assignment in local executor (#843)
sysradium Mar 6, 2025
df2b7eb
Check dangerous modules instead of dangerous patterns (#877)
albertvillanova Mar 6, 2025
ce25b0d
Fix typo in building good agents tutorial (#903)
whistler Mar 6, 2025
e6bd39a
Add tests and refactor CLI (#892)
albertvillanova Mar 7, 2025
323e2f5
Bump mcpadapt >= 0.0.15 (#895)
albertvillanova Mar 7, 2025
1dbdd3c
Update docs about changing the system prompt (#900)
albertvillanova Mar 7, 2025
8f3f939
Support transformers 4.49.0 (#898)
albertvillanova Mar 7, 2025
55d746a
Fix typo in list of dangerous functions (#909)
albertvillanova Mar 7, 2025
ed49300
Improve evaluate_subscript (#916)
albertvillanova Mar 8, 2025
3d0a793
Enforce security check in all evaluations (#906)
albertvillanova Mar 10, 2025
4931eb4
Improve performance of test_while infinite loop (#907)
albertvillanova Mar 10, 2025
e51d82a
Test all dangerous functions and fix check of os.system (#911)
albertvillanova Mar 10, 2025
9438234
Fix Tool docstring, and model init exception (#927)
zhanluxianshen Mar 10, 2025
412cd82
Remove default model_id from models (#905)
albertvillanova Mar 10, 2025
64eb63f
Improve docstring of parse_code_blobs (#876)
albertvillanova Mar 10, 2025
2f300dc
Test vulnerability for dangerous modules (#929)
albertvillanova Mar 10, 2025
812c2d2
Fix broken link to benchmarking code in README (#933)
amaarora Mar 11, 2025
0329674
Fix Gradio UI for unnamed agents (#812)
sysradium Mar 12, 2025
bab16c4
Add mlx-lm to all extra (#961)
albertvillanova Mar 13, 2025
580b679
Fix Gradio UI for None name (#956)
albertvillanova Mar 13, 2025
4451d81
Introduce counter class (#891)
Bilokin Mar 13, 2025
e374d1b
Fix AzureOpenAIServerModel to not call openai.OpenAI (#966)
albertvillanova Mar 13, 2025
23eaf93
Fix CI usage of uv (#970)
albertvillanova Mar 13, 2025
e432d41
Adds VLLMModel (#337)
NathanHB Mar 13, 2025
8132f2f
Support passing flatten_messages_as_text to OpenAIServerModel and tes…
albertvillanova Mar 13, 2025
c8f5322
Fix tool function implementation (#943)
albertvillanova Mar 13, 2025
d8eac75
Fix broken example of using MCP Server (#936)
njbrake Mar 13, 2025
c641c12
Support passing any kwargs to E2BExecutor Sandbox (#951)
aymeric-roucher Mar 14, 2025
c9b5afb
Fix VLLMModel example in models docs (#976)
zhanluxianshen Mar 14, 2025
13afa93
Fix OpenAIServerModel client (#975)
Mar 14, 2025
ba17042
Forbid all modules by default except whitelist authorized_imports (#935)
albertvillanova Mar 14, 2025
ba7baee
Forbid access to all dunder attributes by default (#979)
albertvillanova Mar 14, 2025
023bab2
Raise agent generation errors (#948)
aymeric-roucher Mar 14, 2025
be94612
Update Open Deep Research's README.md (#763)
keetrap Mar 14, 2025
33230a4
Make sure to log thoughts if verbosity_level is set to high (#964)
aymeric-roucher Mar 14, 2025
c975ded
Get correct source code for functions defined in local executor. (#973)
aymeric-roucher Mar 14, 2025
45b2c86
Bump dev version: v1.12.0.dev0 (#982)
albertvillanova Mar 14, 2025
ed51b6b
Fix json parsing (#987)
sysradium Mar 15, 2025
8430152
Fix Agent.from_hub for older smolagents exports (#989)
albertvillanova Mar 15, 2025
c03954c
Regression fix: ChatMessageToolCall id must be a string (#990)
sysradium Mar 16, 2025
2dc4ac1
Always parse tool calls from APIs (#991)
aymeric-roucher Mar 17, 2025
ecc130b
Fix additional authorized imports (#998)
keetrap Mar 17, 2025
80e387f
Fix custom prompt templates in Agent.from_hub (#1001)
albertvillanova Mar 17, 2025
b8bd0c5
Always parse arguments from API tool calls (#1000)
aymeric-roucher Mar 17, 2025
83e971a
Fix TransformersModel: torch_dtype and trust_remote_code not passed t…
Louis-Gv Mar 17, 2025
884b770
Fix double space in toolcalling_agent.yaml (#1021)
louisbrulenaudet Mar 18, 2025
9c4d0ed
Update images type and docstring (#1018)
keetrap Mar 19, 2025
5ca4667
Support JSON string arguments in tool calls (#1003)
albertvillanova Mar 19, 2025
1e1a881
Pass trust_remote_code to transformers tokenizer/processor (#1013)
albertvillanova Mar 19, 2025
b8083aa
Fix code using pillow required dependency (#1019)
albertvillanova Mar 19, 2025
dd2d29f
Fix tests of Agent.save and Tool.save (#1029)
albertvillanova Mar 19, 2025
bfac2e3
Remove dependency on transformers get_tests_dir (#1026)
albertvillanova Mar 19, 2025
cb32069
Reduce model calls in planning_step from 2 to 1 (#985)
aymeric-roucher Mar 19, 2025
195b47f
Bugfix: adding <end_code> to prevent imaginary tool calls in CodeAgen…
IlyaGusev Mar 20, 2025
e8955e0
Use pytest-datadir for shared data files (#1031)
albertvillanova Mar 20, 2025
9e4593f
Refactor Agent.to_dict (#1004)
albertvillanova Mar 20, 2025
4d58faf
Add support for MCP SSE servers (#931)
grll Mar 20, 2025
01f9dab
Bump dev version: v1.13.0.dev0 (#1035)
albertvillanova Mar 20, 2025
5b2882d
Fix telemetry AttributeError: module 'smolagents' has no attribute 'A…
IlyaGusev Mar 21, 2025
d58403c
Hotfix CI: pin transformers < 4.50.0 (#1044)
albertvillanova Mar 22, 2025
1149f64
Align name of tool __source__ (#1042)
albertvillanova Mar 22, 2025
7fef3d8
Update type hints and docstrings of Agent/Tool .save with Path type (…
albertvillanova Mar 22, 2025
afa2d78
Fix PythonInterperterTool description of code input with auth imports…
benediktstroebl Mar 22, 2025
3fa3c7e
Fix typos in Code Agent prompt (#1063)
andysalerno Mar 24, 2025
eee7674
Validate agent name (#768)
Misakar-0v0 Mar 24, 2025
d35aeb9
allow users to retrieve original Gradio app (#811)
sysradium Mar 24, 2025
4f00a90
fix(`MLXModel`): define var to avoid `UnboundLocalError` (#1059)
SauravMaheshkar Mar 24, 2025
13a6293
Minor Fix code block rendering (#1055)
keetrap Mar 24, 2025
71270ec
Add WikipediaSearchTool to default tools (#514)
touseefahmed96 Mar 25, 2025
8833d90
Improve MLXModel call (#1067)
albertvillanova Mar 25, 2025
6025d3d
Support transformers 4.50.0 (#1070)
albertvillanova Mar 25, 2025
49acb8e
Improve Tool.push_to_hub to avoid saving to local filesystem (#1051)
albertvillanova Mar 25, 2025
ee07d40
Fix Tool.to_dict for nullable input parameter (#1038)
albertvillanova Mar 25, 2025
49c8fe3
Support tool Gradio app with boolean input type (#1065)
albertvillanova Mar 25, 2025
fc644cd
Support running CI on push to ci-* branch (#1047)
albertvillanova Mar 25, 2025
461189d
Set Agent/Tool requirements as a sorted list (#1048)
albertvillanova Mar 25, 2025
df39ce8
Support passing raw to ChatMessage.from_dict (#1010)
albertvillanova Mar 25, 2025
59b2762
Distinguish between AgentToolCallError and AgentToolExecutionError (#…
sysradium Mar 26, 2025
d17db47
Add detail on potential threats to system (#1077)
aymeric-roucher Mar 26, 2025
39927f4
Refactor Tool.save (#1075)
albertvillanova Mar 26, 2025
f929af3
Fixing typos in toolcallingagent prompt (#1082)
Y-artios Mar 26, 2025
d8d3aa0
Refactor step yielding during streaming run to log PlanningSteps (#1083)
aymeric-roucher Mar 26, 2025
3240fa8
Make pandas a test extra dependency only (#1081)
albertvillanova Mar 26, 2025
f6ccb87
Add security disclaimer to MCP docs (#1090)
albertvillanova Mar 28, 2025
337288e
Fix get_json_schema for docstrings with type annotations (#1088)
albertvillanova Mar 28, 2025
35e9e8a
Remove transformers/huggingface-hub to check torch availability (#1022)
albertvillanova Mar 28, 2025
6a3ccbc
Improve ApiModel and subclasses instantiation (#1095)
albertvillanova Mar 31, 2025
346a96b
Add trust_remote_code to ToolCollection.from_mcp (#1091)
albertvillanova Mar 31, 2025
d3ba51f
Add user message after plan (#1104)
aymeric-roucher Mar 31, 2025
83e2ce5
Re-authorize submodule imports if top was allowed (#1103)
aymeric-roucher Mar 31, 2025
ce2e9e9
Add agent interruption (#1112)
aymeric-roucher Mar 31, 2025
ffb4983
Validate tool name as Python identifier (#1041)
albertvillanova Apr 1, 2025
ef39c6e
Increase request timeout for tests that time out (#972)
albertvillanova Apr 1, 2025
3e3299b
Update README.md (#1125)
aymeric-roucher Apr 2, 2025
64a688f
Change: expanded error exception for incorrect tool parameters (#1099)
cgthayer Apr 2, 2025
5b06212
Hotfix CI AttributeError: 'PngImageFile' object has no attribute 'fil…
albertvillanova Apr 2, 2025
2acc73b
Gradio UI: log observations images (#1113)
aymeric-roucher Apr 2, 2025
41f827a
Replace AgentGenerationError with AgentParsingError for ToolCallingAg…
aymeric-roucher Apr 2, 2025
3092f7d
Fix planning_interval=1 bug in MultiStepAgent (#1118)
RolandJAAI Apr 2, 2025
25f3a1f
Set main as the no-argument CLI entry point (#1126)
albertvillanova Apr 2, 2025
bbc90e3
Bump version to 1.14.0.dev
aymeric-roucher Apr 2, 2025
087a304
Unpin pillow < 11.2.0 (#1140)
albertvillanova Apr 3, 2025
b781114
Pass vLLM (VLLMModel) model client params as `model_kwargs` (#1137)
sergiopaniego Apr 3, 2025
d972556
Docs: Add Code Agents in agency table (#1144)
aymeric-roucher Apr 4, 2025
0f4fc59
Replace ChatMessage.from_hf_api with from_dict with asdict (#1076)
albertvillanova Apr 4, 2025
3af67af
feat(models): add support for Amazon Bedrock native API (#1115)
leandrodamascena Apr 4, 2025
05ccd4c
Make to_messages methods compatible with Qwen-VL (#1148)
aymeric-roucher Apr 7, 2025
9e89489
Fix get_json_schema for keyword in description (#1146)
albertvillanova Apr 7, 2025
e0990ee
Support images in stream_to_gradio (#1154)
aymeric-roucher Apr 7, 2025
cec8d32
Fix: adjust PlanningStep user message to avoid azure's content filter…
bpoppinga Apr 8, 2025
67ebe70
Refactor code agent system prompt (#1153)
aymeric-roucher Apr 9, 2025
c97c5c4
Fix bug authors (#1163)
aymeric-roucher Apr 9, 2025
3a25900
Fix memory step model output in ToolCallingAgent (#1156)
keetrap Apr 9, 2025
cdd045d
Parsing model outputs: allow whitespaces after the header of code blo…
aymeric-roucher Apr 10, 2025
a6dd8a3
Fix: Add default value to optional argument (#1155)
rca-umb Apr 11, 2025
1957144
Add more detail to code execution documentation (#983)
maeste Apr 11, 2025
f415249
Make TextInspectorTool serializable (#1176)
albertvillanova Apr 11, 2025
d00ef7c
Clarify tool usage in agent step tutorial (#1175)
albertvillanova Apr 11, 2025
be42587
Provide ability to override Agent logger (#1166)
sysradium Apr 11, 2025
5aa4e1a
Pin mcpadapt >= 0.0.19 to include security fix (#1178)
albertvillanova Apr 11, 2025
4f87703
Fix tool validation with multiple assignments (#1177)
albertvillanova Apr 11, 2025
6854fcc
Fix typo in the memory.mdx (#1187)
alpsencer Apr 14, 2025
0eefeb6
feat: add custom Docker image support and enhanced configuration for …
kingdomad Apr 14, 2025
1e853a3
Add api_key argument in HfApiModel (#947)
aymeric-roucher Apr 14, 2025
2c08619
Implement Tool.from_dict (#1006)
albertvillanova Apr 14, 2025
ade08ca
Implement Agent.from_dict (#1007)
albertvillanova Apr 14, 2025
7983378
Call recursively Agent.to_dict for managed agents (#1008)
albertvillanova Apr 14, 2025
a8f72aa
Support `Literal` type annotations in `@tool` for defining enums (#1195)
stephanlensky Apr 15, 2025
0378c91
Support class docstrings in LocalPythonExecutor (#1192)
albertvillanova Apr 15, 2025
277b742
Star-pattern-based import authorization (#1180)
aymeric-roucher Apr 15, 2025
954361f
Reference Inference Providers more clearly (#1197)
julien-c Apr 15, 2025
333eb21
Support annotated assignment in LocalPythonExecutor (#1193)
albertvillanova Apr 16, 2025
163415f
Fix evaluate_boolop for non-boolean return type (#1191)
ZeusFSX Apr 16, 2025
54edaab
Make MultiStepAgent and abstract class (#1204)
sysradium Apr 16, 2025
d99a13e
rename `HfApiModel` to `InferenceClientModel` (#1198)
julien-c Apr 16, 2025
073cfeb
fix: creating tool should not affect function that is being wrapped (…
njbrake Apr 16, 2025
952d88f
Remove header comments from MDX docs for proper rendering (#1212)
albertvillanova Apr 17, 2025
c9605a9
Fix CI test by updating LiteLLM error message (#1214)
albertvillanova Apr 17, 2025
9171c9f
Fix typo in evaluate_ast() docs: static_tools -> custom_tools (#1217)
JungeAlexander Apr 17, 2025
3d8d145
Make OpenDeepResearch tools serializable (#1206)
albertvillanova Apr 17, 2025
e1e473f
Add Security Policy (#1208)
albertvillanova Apr 18, 2025
5edf110
Improve docs for stream run (#1215)
albertvillanova Apr 18, 2025
3f6b7da
Skip unsupported stop parameter for reasoning models (#1211)
albertvillanova Apr 18, 2025
ee0a0fb
SmolAgents MCP Client (#1200)
grll Apr 18, 2025
be4c8b5
Bump dev version: v1.15.0.dev0 (#1221)
albertvillanova Apr 18, 2025
dacb076
CI: Simplify testing by running all tests in a single command (#1218)
albertvillanova Apr 18, 2025
d8daf8f
Fix typo in pydoc (#1222)
darxriggs Apr 18, 2025
baa02f7
Change language from semantic to lexical for BM25 (#1230)
NoRaincheck Apr 22, 2025
778fccf
Move MCPClient to root-level lib and manage optional dependencies (#1…
njbrake Apr 22, 2025
6923eb5
Add LiteLLM Router model (#1096)
NishantBaheti Apr 23, 2025
fdc86eb
Update README.md (#1233)
aymeric-roucher Apr 23, 2025
63d02a5
Set __name__ to "__main__" in local Python interpreter (#1234)
albertvillanova Apr 23, 2025
113d8c9
Streaming model outputs (#1236)
aymeric-roucher Apr 24, 2025
3dc1766
Simplify validation of stream (#1242)
albertvillanova Apr 24, 2025
05b709d
Remove dead code related to non-CompletionDelta streaming results (#1…
albertvillanova Apr 25, 2025
68cdf52
Fix deprecated typing (#1249)
albertvillanova Apr 25, 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
11 changes: 6 additions & 5 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Quality Check

on: [pull_request]

env:
UV_SYSTEM_PYTHON: 1

jobs:
check_code_quality:
runs-on: ubuntu-latest
Expand All @@ -16,15 +19,13 @@ jobs:
python-version: "3.12"

# Setup venv
- name: Setup venv + uv
- name: Setup uv
run: |
pip install --upgrade uv
uv venv

- name: Install dependencies
run: uv pip install "smolagents[quality] @ ."

# Equivalent of "make quality" but step by step
- run: uv run ruff check examples src tests utils # linter
- run: uv run ruff format --check examples src tests utils # formatter
- run: uv run python utils/check_tests_in_ci.py
- run: ruff check examples src tests # linter
- run: ruff format --check examples src tests # formatter
100 changes: 12 additions & 88 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
name: Python tests

on: [pull_request]
on:
pull_request:
push:
branches:
- ci-*

env:
UV_SYSTEM_PYTHON: 1

jobs:
build-ubuntu:
Expand All @@ -21,99 +28,16 @@ jobs:
python-version: ${{ matrix.python-version }}

# Setup venv
- name: Setup venv + uv
- name: Setup uv
run: |
pip install --upgrade uv
uv venv

# Install dependencies
- name: Install dependencies
run: |
uv pip install "smolagents[test] @ ."

# Run all tests separately for individual feedback
# Use 'if success() || failure()' so that all tests are run even if one failed
# See https://stackoverflow.com/a/62112985
- name: Import tests
run: |
uv run pytest ./tests/test_import.py
if: ${{ success() || failure() }}

- name: Agent tests
run: |
uv run pytest ./tests/test_agents.py
if: ${{ success() || failure() }}

- name: Default tools tests
run: |
uv run pytest ./tests/test_default_tools.py
if: ${{ success() || failure() }}

# - name: Docs tests # Disabled for now (slow test + requires API keys)
# run: |
# uv run pytest ./tests/test_all_docs.py

- name: Final answer tests
run: |
uv run pytest ./tests/test_final_answer.py
if: ${{ success() || failure() }}

- name: Models tests
run: |
uv run pytest ./tests/test_models.py
if: ${{ success() || failure() }}

- name: Memory tests
run: |
uv run pytest ./tests/test_memory.py
if: ${{ success() || failure() }}

- name: Monitoring tests
run: |
uv run pytest ./tests/test_monitoring.py
if: ${{ success() || failure() }}

- name: Local Python executor tests
run: |
uv run pytest ./tests/test_local_python_executor.py
if: ${{ success() || failure() }}

- name: E2B executor tests
run: |
uv run pytest ./tests/test_e2b_executor.py
if: ${{ success() || failure() }}

- name: Search tests
run: |
uv run pytest ./tests/test_search.py
if: ${{ success() || failure() }}

- name: Tools tests
run: |
uv run pytest ./tests/test_tools.py
if: ${{ success() || failure() }}

- name: Tool validation tests
run: |
uv run pytest ./tests/test_tool_validation.py
if: ${{ success() || failure() }}

- name: Types tests
run: |
uv run pytest ./tests/test_types.py
if: ${{ success() || failure() }}

- name: Utils tests
run: |
uv run pytest ./tests/test_utils.py
if: ${{ success() || failure() }}

- name: Gradio UI tests
run: |
uv run pytest ./tests/test_gradio_ui.py
if: ${{ success() || failure() }}

- name: Function type hints utils tests
# Run tests
- name: Test with pytest
run: |
uv run pytest ./tests/test_function_type_hints_utils.py
if: ${{ success() || failure() }}
pytest ./tests/
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,6 @@ archive/
savedir/
output/
tool_output/

# Gradio runtime
.gradio/
29 changes: 0 additions & 29 deletions Dockerfile

This file was deleted.

3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
.PHONY: quality style test docs utils
.PHONY: quality style test docs

check_dirs := examples src tests utils

# Check code quality of the source code
quality:
ruff check $(check_dirs)
ruff format --check $(check_dirs)
python utils/check_tests_in_ci.py

# Format source code automatically
style:
Expand Down
48 changes: 34 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,23 @@ limitations under the License.
<h3 align="center">
<div style="display:flex;flex-direction:row;">
<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/smolagents/smolagents.png" alt="Hugging Face mascot as James Bond" width=400px>
<p>A smol library to build great agents!</p>
<p>Agents that think in code!</p>
</div>
</h3>

`smolagents` is a library that enables you to run powerful agents in a few lines of code. It offers:

✨ **Simplicity**: the logic for agents fits in ~1,000 lines of code (see [agents.py](https://github.com/huggingface/smolagents/blob/main/src/smolagents/agents.py)). We kept abstractions to their minimal shape above raw code!

🧑‍💻 **First-class support for Code Agents**. Our [`CodeAgent`](https://huggingface.co/docs/smolagents/reference/agents#smolagents.CodeAgent) writes its actions in code (as opposed to "agents being used to write code"). To make it secure, we support executing in sandboxed environments via [E2B](https://e2b.dev/).
🧑‍💻 **First-class support for Code Agents**. Our [`CodeAgent`](https://huggingface.co/docs/smolagents/reference/agents#smolagents.CodeAgent) writes its actions in code (as opposed to "agents being used to write code"). To make it secure, we support executing in sandboxed environments via [E2B](https://e2b.dev/) or via Docker.

🤗 **Hub integrations**: you can [share/pull tools to/from the Hub](https://huggingface.co/docs/smolagents/reference/tools#smolagents.Tool.from_hub), and more is to come!
🤗 **Hub integrations**: you can [share/pull tools or agents to/from the Hub](https://huggingface.co/docs/smolagents/reference/tools#smolagents.Tool.from_hub) for instant sharing of the most efficient agents!

🌐 **Model-agnostic**: smolagents supports any LLM. It can be a local `transformers` or `ollama` model, one of [many providers on the Hub](https://huggingface.co/blog/inference-providers), or any model from OpenAI, Anthropic and many others via our [LiteLLM](https://www.litellm.ai/) integration.

👁️ **Modality-agnostic**: Agents support text, vision, video, even audio inputs! Cf [this tutorial](https://huggingface.co/docs/smolagents/examples/web_browser) for vision.

🛠️ **Tool-agnostic**: you can use tools from [LangChain](https://huggingface.co/docs/smolagents/reference/tools#smolagents.Tool.from_langchain), [Anthropic's MCP](https://huggingface.co/docs/smolagents/reference/tools#smolagents.ToolCollection.from_mcp), you can even use a [Hub Space](https://huggingface.co/docs/smolagents/reference/tools#smolagents.Tool.from_space) as a tool.
🛠️ **Tool-agnostic**: you can use tools from [LangChain](https://huggingface.co/docs/smolagents/reference/tools#smolagents.Tool.from_langchain), [MCP](https://huggingface.co/docs/smolagents/reference/tools#smolagents.ToolCollection.from_mcp), you can even use a [Hub Space](https://huggingface.co/docs/smolagents/reference/tools#smolagents.Tool.from_space) as a tool.

Full documentation can be found [here](https://huggingface.co/docs/smolagents/index).

Expand All @@ -57,17 +57,17 @@ pip install smolagents
```
Then define your agent, give it the tools it needs and run it!
```py
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel
from smolagents import CodeAgent, DuckDuckGoSearchTool, InferenceClientModel

model = HfApiModel()
model = InferenceClientModel()
agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=model)

agent.run("How many seconds would it take for a leopard at full speed to run through Pont des Arts?")
```

https://github.com/user-attachments/assets/cd0226e2-7479-4102-aea0-57c22ca47884

You can even share your agent to hub:
You can even share your agent to the Hub, as a Space repository:
```py
agent.push_to_hub("m-ric/my_agent")

Expand All @@ -77,12 +77,12 @@ agent.push_to_hub("m-ric/my_agent")
Our library is LLM-agnostic: you could switch the example above to any inference provider.

<details>
<summary> <b>HfApiModel, gateway for 4 inference providers</b></summary>
<summary> <b>InferenceClientModel, gateway for all <a href="https://huggingface.co/docs/inference-providers/index">inference providers</a> supported on HF</b></summary>

```py
from smolagents import HfApiModel
from smolagents import InferenceClientModel

model = HfApiModel(
model = InferenceClientModel(
model_id="deepseek-ai/DeepSeek-R1",
provider="together",
)
Expand All @@ -95,7 +95,7 @@ model = HfApiModel(
from smolagents import LiteLLMModel

model = LiteLLMModel(
"anthropic/claude-3-5-sonnet-latest",
model_id="anthropic/claude-3-5-sonnet-latest",
temperature=0.2,
api_key=os.environ["ANTHROPIC_API_KEY"]
)
Expand Down Expand Up @@ -143,6 +143,18 @@ model = AzureOpenAIServerModel(
)
```
</details>
<details>
<summary> <b>Amazon Bedrock models</b></summary>

```py
import os
from smolagents import AmazonBedrockServerModel

model = AmazonBedrockServerModel(
model_id = os.environ.get("AMAZON_BEDROCK_MODEL_ID")
)
```
</details>

## CLI

Expand All @@ -151,7 +163,7 @@ You can run agents from CLI using two commands: `smolagent` and `webagent`.
`smolagent` is a generalist command to run a multi-step `CodeAgent` that can be equipped with various tools.

```bash
smolagent "Plan a trip to Tokyo, Kyoto and Osaka between Mar 28 and Apr 7." --model-type "HfApiModel" --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"
```

Meanwhile `webagent` is a specific web-browsing agent using [helium](https://github.com/mherrmann/helium) (read more [here](https://github.com/huggingface/smolagents/blob/main/src/smolagents/vision_web_browser.py)).
Expand Down Expand Up @@ -201,7 +213,7 @@ Writing actions as code snippets is demonstrated to work better than the current

Especially, since code execution can be a security concern (arbitrary code execution!), we provide options at runtime:
- a secure python interpreter to run code more safely in your environment (more secure than raw code execution but still risky)
- a sandboxed environment using [E2B](https://e2b.dev/) (removes the risk to your own system).
- a sandboxed environment using [E2B](https://e2b.dev/) or Docker (removes the risk to your own system).

On top of this [`CodeAgent`](https://huggingface.co/docs/smolagents/reference/agents#smolagents.CodeAgent) class, we still support the standard [`ToolCallingAgent`](https://huggingface.co/docs/smolagents/reference/agents#smolagents.ToolCallingAgent) that writes actions as JSON/text blobs. But we recommend always using `CodeAgent`.

Expand All @@ -216,14 +228,22 @@ By the way, why use a framework at all? Well, because a big part of this stuff i

We've created [`CodeAgent`](https://huggingface.co/docs/smolagents/reference/agents#smolagents.CodeAgent) instances with some leading models, and compared them on [this benchmark](https://huggingface.co/datasets/m-ric/agents_medium_benchmark_2) that gathers questions from a few different benchmarks to propose a varied blend of challenges.

[Find the benchmarking code here](https://github.com/huggingface/smolagents/blob/main/examples/benchmark.ipynb) for more detail on the agentic setup used, and see a comparison of using LLMs code agents compared to vanilla (spoilers: code agents works better).
[Find the benchmarking code here](https://github.com/huggingface/smolagents/blob/main/examples/smolagents_benchmark/run.py) for more detail on the agentic setup used, and see a comparison of using LLMs code agents compared to vanilla (spoilers: code agents works better).

<p align="center">
<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/smolagents/benchmark_code_agents.jpeg" alt="benchmark of different models on agentic workflows. Open model DeepSeek-R1 beats closed-source models." width=60% max-width=500px>
</p>

This comparison shows that open-source models can now take on the best closed models!

## Security

Security is a critical consideration when working with code-executing agents. Our library provides:
- Sandboxed execution options using [E2B](https://e2b.dev/) or Docker
- Best practices for running agent code securely

For security policies, vulnerability reporting, and more information on secure agent execution, please see our [Security Policy](SECURITY.md).

## Contribute

Everyone is welcome to contribute, get started with our [contribution guide](https://github.com/huggingface/smolagents/blob/main/CONTRIBUTING.md).
Expand Down
9 changes: 9 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Security Policy

## Reporting a Vulnerability

To report a security vulnerability, please contact: [email protected]

## Learning More About Security

To learn more about running agents more securely, please see the [Secure Code Execution tutorial](docs/source/en/tutorials/secure_code_execution.mdx) which covers sandboxing with E2B and Docker.
7 changes: 2 additions & 5 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,6 @@ 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).

### Writing source documentation

Values that should be put in `code` should either be surrounded by backticks: \`like so\`. Note that argument names
Expand Down Expand Up @@ -271,4 +267,5 @@ is to be used in inference and also include the expected (ideally sensible)
output.
Often, readers will try out the example before even going through the function
or class definitions. Therefore, it is of utmost importance that the example
works as expected.
works as expected.

4 changes: 2 additions & 2 deletions docs/source/en/_toctree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
- local: tutorials/tools
title: 🛠️ Tools - in-depth guide
- local: tutorials/secure_code_execution
title: 🛡️ Secure your code execution with E2B
title: 🛡️ Secure code execution
- local: tutorials/memory
title: 📚 Manage your agent's memory
- title: Conceptual guides
Expand All @@ -27,7 +27,7 @@
- local: examples/text_to_sql
title: Self-correcting Text-to-SQL
- local: examples/rag
title: Master you knowledge base with agentic RAG
title: Master your knowledge base with agentic RAG
- local: examples/multiagents
title: Orchestrate a multi-agent system
- local: examples/web_browser
Expand Down
Loading
Loading