Skip to content
AImpact
IT EN
Medium Agents · 1 min read

Hugging Face smolagents: agents that write code instead of JSON

In one sentence Hugging Face releases smolagents, a minimal library for LLM agents whose core logic fits in about a thousand lines. Pushes the 'code agents' paradigm: the agent writes Python snippets instead of JSON tool calls.

Verified Official source
ShareLinkedInX
Reading level

Hugging Face ships smolagents, a small library for building LLM agents: according to the launch blog, the agent logic fits in about a thousand lines of code. The strong idea isn't the size but the paradigm: instead of replying with JSON like {"tool": "search", "args": {...}}, the agent writes Python code that calls your functions directly.

In practice: the model emits a snippet like result = search("LLM agents"); summary = summarize(result). The snippet is executed (optionally in a remote sandbox via E2B), the result goes back to the model, which picks the next step.

Why it matters: a code agent can combine multiple tools in one turn, do loops, conditionals, parsing — things JSON tool calls need several steps for.

Companies

Hugging Face

Tools

smolagents, CodeAgent, ToolCallingAgent

Tags

Hugging FaceSmolagentsCode AgentsOpen SourceTool Use

Sources