Hugging Face

Agents Course · smolagents · Transformers

Framework · OSS3 patterns
In Plain English

This page shows every pattern that Hugging Face has published or written about — 3 in total. Each one includes a simple picture of how it works, a short explanation, an example of when to use it, and its trade-offs (the good parts and the not-so-good parts).

Reading patterns from one source at a time matters because it lets you see how a single company or team thinks about building AI agents, and compare their ideas side by side. If a pattern here also appears in the bigger Deep Catalogue, you will see a link so you can read the full, detailed version.

An open reference book with a pencil in the fold under warm lamp light

3B.01Code Agent

CODE AGENTPYTHON SANDBOX Agent Write Code Execute Read Result Continueinvokeresult

Agent writes Python code to be executed, rather than JSON tool calls — more expressive but requires sandboxing.

Use caseData analysis, math-heavy workflows, complex compositions.
Trade-offsMore expressive than JSON calls · Sandbox mandatory.

Cross-ref: Deep Catalogue TOO-ACT-01 →

3B.02Tool-Calling Agent (JSON)

TOOL-CALLING AGENT User Agent JSON Call Tool Return

Standard function-call pattern — JSON arguments for declared tools.

Use caseMost general-purpose agents.
Trade-offsInteroperable · Less expressive than code agents.

See 1C.02, 2D.01

3B.03Smolagent

SMOLAGENT Minimal Core Think Act Observe Stop?thinkactobservestop?

Minimal-scaffolding agent — a few hundred lines of Python, ReAct-like loop, extensible.

Use caseTeaching, prototyping, small production cases.
Trade-offsTransparent and hackable · Less production-hardened.