A lightweight library by Hugging Face for building AI agents that write and execute actions directly in Python code.

### Key Features
– **Code-as-Actions Paradigm:** Empowers LLMs to write raw Python code to perform actions, bypassing the overhead and rigidity of traditional JSON-based tool-calling schemas.
– **Lightweight & Auditable:** Built with a minimal codebase, making it highly customizable, fast to initialize, and easy to audit for production pipelines.
– **Secure Local Execution:** Features built-in execution sandboxing to restrict unauthorized system access while running LLM-generated code locally.

### Use Cases
– Building resource-efficient local agents that execute data manipulation and API orchestration tasks. Developers can pair these lightweight workflows with local runners like GGML and llama.cpp for offline, private execution.

### Developer Pros & Cons
– **Pro:** Dramatically reduces token overhead and formatting errors by using Python syntax rather than parsing nested JSON structures.
– **Con:** Executing arbitrary LLM-generated code requires strict sandboxing and configuration to prevent potential security vulnerabilities.

Check out smolagents here 🚀