A barebones library for agents that think in code, enabling powerful AI agents in a few lines of code.
smolagents is a barebones library for building agents that think in code. It enables running powerful AI agents in a few lines of code, with first-class support for CodeAgents that write actions as Python code snippets. The library is model-agnostic (supports any LLM via Hugging Face, LiteLLM, OpenAI, Anthropic, etc.), tool-agnostic (supports MCP, LangChain, Hub Spaces), and modality-agnostic (text, vision, video, audio). It includes a CLI, sandboxed execution (E2B, Docker, Pyodide), and Hub integration for sharing agents.
Key Features
check_circleCodeAgent that writes actions as Python code
lightbulbDevelopers build custom AI agents that can browse the web, search, and perform multi-step tasks by writing Python code actions, reducing development time from days to hours.
lightbulbData scientists automate data analysis workflows by creating agents that can query databases, run pandas operations, and generate reports using natural language instructions.
lightbulbResearchers prototype agentic systems quickly using the minimal codebase, testing different LLMs and tools without heavy framework overhead.
lightbulbDevOps engineers deploy sandboxed agents for secure automation tasks, leveraging Docker or E2B isolation to run untrusted code safely.
lightbulbContent creators use the webagent CLI to automate web scraping and data extraction from e-commerce sites, collecting product details and prices in minutes.
lightbulbEducators teach AI agent concepts using the simple ReAct loop implementation, allowing students to understand agent internals without complex abstractions.
lightbulbProduct teams integrate smolagents into their applications via the API, enabling end-users to interact with AI agents that can call custom tools and APIs.
AI agentscode agentsLLMHugging Faceopen sourcePythonagent frameworkReActtool usesandbox