Sahaj.blogs
31 Dec 2024 · AI updates

smolagents: agents that write their actions as code

Hugging Face launched smolagents, a minimal agent library whose main agent type writes its actions as Python code, plus a clear way to think about "agency" as a spectrum.

What happened

Hugging Face launched smolagents, a very small library for building agents. The headline agent is a CodeAgent, which writes its actions as Python code.

The technical details

The post’s framing is the part I found most useful. AI agents are “programs where LLM outputs control the workflow”, and agency is a spectrum, not yes/no:

levelLLM output…name
☆☆☆has no effect on program flowsimple processor
★☆☆picks a branchrouter
★★☆picks a function and its argumentstool call
★★★controls iteration and when to stopmulti-step agent

The post also discusses how well open models do on agentic workflows.

Why it matters

It’s a clear vocabulary for the agent loop I wrote by hand in August 2026: decide, act, observe, until done. Writing actions as code, rather than as one JSON tool call at a time, lets a single step combine several tools with loops and variables.

#agents#hugging-face#open-source

Sources

  1. Introducing smolagents: simple agents that write actions in code — Hugging Face
  2. smolagents (GitHub) — GitHub

This is a summary written from the linked public sources. Figures and numbers are as reported there.