OlympHill
smolagents logo

smolagentsBiblioteca Python minimalistă de la Hugging Face pentru construirea de agenți AI bazați pe cod în câteva linii

5.0 (4)
Daniel NikulshynRecenzat de Daniel Nikulshyn·Actualizat mai 2026

Prezentare

smolagents este un cadru de agent deschis sursă al lui Hugging Face conceput în jurul simplității și a unei suprafețe mici. În loc de a organiza agenții prin apeluri de instrumente JSON verbale, el le permite agențiilor să-și exprime acțiunile ca cod Python, ceea ce dă adesea rezultate mai expresive și reduce numărul de pași LLM necesari pentru a completa o sarcină. Biblioteca este agnostica privind modelul, funcționând cu modele găzduite pe Hub-ul Hugging Face, servere de inferență locale, și principalele furnizori de API ca OpenAI și Anthropic. Oferă opțiuni de executare sandboxed precum E2B și Docker, astfel încât codul generat să poată rula în siguranță, și se integrează cu ecosistemele de instrumente comune, inclusiv Hub Spaces și instrumente LangChain. Este destinat dezvoltatorilor care doresc un punct de start transparent și încărcabil pentru proiecte de agent, dar în locul unei cadre opiniativate și greve, ceea ce îl face potrivit pentru prototipare, cercetare și utilizări productive ușoare.

Funcții cheie

  • CodeAgent care scrie și execută Python pentru a rezolva sarcini
  • Suport pentru Hugging Face, OpenAI, Anthropic și modele locale
  • Execuție cod în sandbox cu back-end-uri E2B și Docker
  • Integrare instrumente cu Hub, LangChain și funcții Python personalizate
  • Agent ToolCalling încorporat pentru utilizarea tradițională a instrumentelor de stil JSON
  • Design ușor, cu dependențe minime

Prețuri

Model
Free
Evaluare
5.0 / 5 (4)

Cazuri de utilizare

Construiți agenți AI bazați pe cod rapid

Dezvoltatorii pot crea agenți care rezolvă sarcini prin scrierea și executarea codului Python, reducând numărul de pași LLM în comparație cu abordările de apelare a instrumentelor JSON.

Rulați agenți cu orice furnizor LLM

Prototipați agenți folosind modele Hugging Face Hub, servere de inferență locale sau API-uri precum OpenAI și Anthropic fără a schimba cadrul de lucru.

Executați cod generat în siguranță

Utilizați back-end-uri sandbox E2B sau Docker pentru a rula codul Python generat de agent în medii izolate, atenuând riscurile de securitate în timpul execuției automate a sarcinilor.

Integrați ecosisteme de instrumente existente

Combinați funcții Python personalizate cu Hub Spaces și instrumente LangChain pentru a extinde capacitățile agenților, păstrând în același timp o bază de cod minimă și ușor de citit.

Pro și contra

Pro

  • Cod bază foarte mică, ușor de citit și de extins
  • Acțiunile bazate pe cod reduc pașii și sporesc expresivitatea agenților
  • Funcționează cu mulți furnizori LLM și modele locale
  • Execuție în sandbox prin E2B sau Docker pentru rularea mai sigură a codului
  • Gratuit și complet open source

Contra

  • Cerință de cunoștințe Python pentru a utiliza eficient
  • Mai puține integrări încorporate decât cadrele de lucru mai mari pentru agenți
  • Execuția codului introduce considerații de securitate de gestionat
  • Mai puțin potrivit pentru orchestrarea complexă a mai multor agenți de la bun început

Recenzii

5.0

Medie din 4 evaluări.

5
4
4
0
3
0
2
0
1
0

Conectează-te pentru a lăsa o recenzie.

Naomi Suzuki

Naomi Suzuki

Apr 15, 2026

Use it every day

Honestly didn't expect to like it this much. Tool integration with Hub, LangChain, and custom Python functions is exactly what I needed, and code-based actions reduce steps and boost agent expressiveness. I do wish requires Python knowledge to use effectively, but I reach for it almost every day now and it just clicks.

WC

Wei Chen

Dec 18, 2025

Does the job

Pretty happy overall. Tool integration with Hub, LangChain, and custom Python functions just works and very small, readable codebase that is easy to extend. Code execution introduces security considerations to manage can be annoying, but no dealbreakers — I'd recommend it to a friend without hesitating.

Jamal Carter

Jamal Carter

Nov 25, 2025

Does the job

Pretty happy overall. Sandboxed code execution with E2B and Docker backends just works and sandboxed execution via E2B or Docker for safer code running. but no dealbreakers — I'd recommend it to a friend without hesitating.

SG

Sanjay Gupta

Jul 11, 2025

Skeptical, then convinced

I went in skeptical — most tools in this space overpromise. It actually delivers on codeAgent that writes and executes Python to solve tasks, and code-based actions reduce steps and boost agent expressiveness caught me off guard. still, I'd recommend giving it a real trial.

Întrebări

How strong are open models for agentic workflows?

We've created CodeAgent instances with some leading models, and compared them on this benchmark that gathers questions from a few different benchmarks to propose a varied blend of challenges. Find the benchmarking code here for more detail on the agentic setup used, and see a comparison of using LLMs code agents compared to vanilla (spoilers: code agents works better). This comparison shows that open-source models can now take on the best closed models!

Asked by Diego Fernández · Feb 16, 2026

How smol is this library?

We strived to keep abstractions to a strict minimum: the main code in agents.py has <1,000 lines of code. Still, we implement several types of agents: CodeAgent writes its actions as Python code snippets, and the more classic ToolCallingAgent leverages built-in tool calling methods. We also have multi-agent hierarchies, import from tool collections, remote code execution, vision models... By the way, why use a framework at all? Well, because a big part of this stuff is non-trivial. For instance, the code agent has to keep a consistent format for code throughout its system prompt, its parser, the execution. So our framework handles this complexity for you. But of course we still encourage you to hack into the source code and use only the bits that you need, to the exclusion of everything else!

Asked by Ludovic Girard · Nov 27, 2025

How do Code agents work?

Our CodeAgent works mostly like classical ReAct agents - the exception being that the LLM engine writes its actions as Python code snippets. Actions are now Python code snippets. Hence, tool calls will be performed as Python function calls. For instance, here is how the agent can perform web search over several websites in one single action: Writing actions as code snippets is demonstrated to work better than the current industry practice of letting the LLM output a dictionary of the tools it wants to call: uses 30% fewer steps (thus 30% fewer LLM calls) and reaches higher performance on difficult benchmarks. Head to our high-level intro to agents to learn more on that. Since code execution can be a serious security concern (arbitrary code execution!), you should run agent code in a sandbox. We support several options: E2B, Blaxel, Modal — managed cloud sandboxes, simplest to set up Docker — self-hosted container isolation The built-in LocalPythonExecutor is not a security sandbox. It applies some restrictions but can be bypassed and must not be used as a security boundary. Alongside CodeAgent, we also provide the standard ToolCallingAgent which writes actions as JSON/text blobs. You can pick whichever style best suits your use case.

Asked by Greta Nowak · Oct 31, 2025

Pune o întrebare

Alternative la Framuri de Agenti AI