Smolagents

github.com/huggingface/smolagents

Visit Website

Hugging Face's minimalist agent library where agents write and execute Python code as their primary reasoning tool, rather than calling predefined function schemas.

Why it is useful

Code-as-action is a more powerful and flexible tool use pattern than JSON function calling — the agent can compose arbitrary logic rather than being limited to predefined tools. The library is intentionally small (~1000 lines) which makes it auditable and easy to extend. Hugging Face's backing means it integrates cleanly with the model hub and transformers ecosystem.