Open Source
Explore the latest AI open-source projects from GitHub and HuggingFace.
Explore the latest AI open-source projects from GitHub and HuggingFace.
smolagents is a minimalist Python agent framework from HuggingFace built on a single principle: agents should write Python code as their actions, not JSON tool calls. With a core logic fitting in approximately 1,000 lines of code, it achieves 30% fewer reasoning steps than traditional tool-calling approaches on research benchmarks — while supporting 100+ LLM backends. ## Code-First Agent Design The central innovation is the CodeAgent class. Instead of selecting tools by outputting JSON, a CodeAgent writes Python code snippets that call tools as regular Python functions. The code executes in a sandboxed environment and results are returned to the agent's memory for the next step. This mirrors how experienced developers solve problems: by writing composable, iterative code rather than filling structured forms. Research demonstrates the approach requires 30% fewer steps and achieves higher performance on difficult benchmarks compared to JSON tool-calling agents. ## Minimal Codebase Philosophy The entire agent logic fits in ~1,000 lines of Python. This is a deliberate design constraint. A smaller codebase means fewer abstractions to learn, easier debugging, and lower risk of framework bugs masking model behavior. Developers can read the entire library in an afternoon — a meaningful advantage in a field where black-box frameworks are common. ## Model-Agnostic Design smolagents supports over 100 LLMs through integrations with HuggingFace inference providers, OpenAI, Anthropic, Azure, AWS Bedrock, and LiteLLM. Local models via Ollama are fully supported. Teams are not locked into any single provider. ## Vision and Multimodal Agents A major capability milestone enabled vision-language models as agent backends. The web browsing agent (webagent) leverages this to navigate real websites by scrolling, clicking, and reading page content — behavior previously requiring specialized browser automation tools. Agents can save screenshots as observations, enabling reasoning over visual UI states. ## Secure Sandbox Execution For production deployments, smolagents supports multiple sandboxed code execution environments: Blaxel, E2B, Modal, Docker, and WebAssembly. This addresses the inherent security risk of executing agent-generated code by isolating execution from the host environment. ## Tool Ecosystem Integration The library integrates with MCP (Model Context Protocol) servers and LangChain tools, enabling existing tool ecosystems to be reused without writing adapters. Agents and tools can be published to and loaded from HuggingFace Hub, enabling community-driven reuse. Version 1.24.0 (January 16, 2026) added backward compatibility fixes and support for GPT-5.2 model variants. The 25,500+ GitHub stars reflect strong developer adoption across research and production contexts.