smolagents
Minimalist Hugging Face library for agents that write actions as code, with CodeAgent and ToolCallingAgent primitives.
Delv Safety Grade: B
Score 72/100 · assessed 2026-04-18
Smolagents is an official Hugging Face framework for building autonomous AI agents that execute actions by generating and running Python code. The maintainer score is excellent given Hugging Face's established reputation and active development. However, the permissions profile is concerning: agents can execute arbitrary Python code, access filesystems, make network calls, and interact with external APIs based on tool definitions. The framework's core design allows agents to write and execute code dynamically, which inherently carries significant security risks if not properly sandboxed. Supply chain is solid via PyPI distribution with standard Python packaging. Transparency is strong with comprehensive documentation at smolagents.org and an active GitHub repository. No known security incidents, but the code execution model requires careful deployment with appropriate isolation and input validation.
Green flags
- Official Hugging Face project with strong institutional backing
- Open source with active development and community engagement
- Well-documented at smolagents.org with clear examples
- Standard PyPI distribution with version management
- Transparent about agent capabilities and code execution model
Red flags
- Agents execute arbitrary Python code generated by LLMs
- No built-in sandboxing for code execution environment
- Tools can access filesystem, network, and external APIs without restriction
- CodeAgent primitive allows unrestricted Python interpreter access
- Potential for prompt injection leading to malicious code execution
Permissions requested
Pricing
Platforms
Review
Best for developers who want agent behaviour without agent framework overhead. If you're prototyping research tools or automating data tasks and you trust yourself to read a stack trace, this is cleaner than the alternatives. Skip it if you need production-grade guardrails or non-technical teammates will touch it.
Good at
- Code-as-action model makes execution traces readable and debuggable
- Minimal API surface means less to learn and less to break
- Works with any LLM that supports function calling or code generation
- Hugging Face integration is first-class for model inference tasks
- Open source with no vendor lock-in or usage fees
Watch out
- Basic retry logic leads to infinite loops if tool descriptions are poor
- No built-in sandboxing beyond Python's exec environment
- Documentation assumes comfort with reading library source code
- Limited community compared to LangChain or AutoGPT ecosystems
- No GUI or hosted option for non-developers
Use cases
- code-action agents
- tool-calling agents
- research