Key takeaways
- CodeAgent expresses actions as Python; ToolCallingAgent offers conventional structured tool calls.
- The local executor is explicitly not a security boundary; untrusted code needs an appropriate sandbox.
- Remote snippet execution and hosting the entire agent have different credential, state, and multi-agent tradeoffs.
FAQ
What is smolagents?
A Hugging Face Python library for agents that select and execute tools, especially by generating Python actions rather than individual JSON calls.
Is the local Python executor a sandbox?
No. The current security policy explicitly disclaims an isolation guarantee; import restrictions and operation limits are best-effort mitigations.
How much does smolagents cost?
The library is Apache-2.0 licensed. Model inference, external sandbox services, storage, and observability can have separate costs.
Can smolagents use multiple model providers?
Yes. Adapters include Hugging Face inference, local models, LiteLLM, OpenAI-compatible endpoints, Azure, and Amazon Bedrock.
Executive Summary
smolagents is Hugging Face's Python agent library. Its defining abstraction is CodeAgent: the model generates Python actions that call tools, combine intermediate values, and continue a reasoning-and-action loop. A separate ToolCallingAgent supports conventional structured tool calls. The framework also offers model adapters, managed-agent hierarchies, and MCP tool integration.[1]
The important operational distinction is where those actions execute. The current security policy says the local executor provides no isolation guarantee. External executors can move generated code into a sandbox, while running the entire agent remotely changes the placement of model calls, tools, state, and credentials.[2][3] This profile was checked September 15, 2026; see the broader agent frameworks comparison.
| Attribute | Verified detail |
|---|---|
| Maintainer | Hugging Face[1] |
| Runtime | Python 3.10 or newer; optional dependency groups select integrations[4] |
| Latest published release checked | 1.26.0, May 29, 2026[5] |
| License | Apache-2.0[6] |
| Security boundary | Supplied by the chosen external execution environment, not the local interpreter[2] |
Product Overview
The library is for developers building an agent inside an application. A run receives a task, adds observations to the agent's memory, asks the model for an action, executes it, and continues until a final answer or termination condition. Python actions can compose multiple tool calls within a single generated program; that is a programming mechanism, not a guarantee of better accuracy or fewer billable tokens on every workload.[1]
| Capability | Practical meaning |
|---|---|
| Code actions | The model can use variables, loops, and tool functions in an action rather than only emit one tool-call object.[1] |
| Conventional tool calls | ToolCallingAgent permits a different action format when arbitrary generated Python is unnecessary.[1] |
| Model selection | Hugging Face inference, local Transformers/Ollama, LiteLLM, OpenAI-compatible endpoints, Azure, and Bedrock adapters are documented.[1] |
| Tool ecosystem | MCP servers, LangChain tools, and Hugging Face Spaces can supply tools; loading shared artifacts remains a trust decision.[1][2] |
| Inspection | OpenTelemetry instrumentation and guides for Phoenix, MLflow, and Langfuse expose runs for debugging.[7] |
The repository also exposes smolagent and webagent command-line entry points. Browser interaction requires its own dependencies and tools; installing the core package does not imply that every optional integration is configured.[1][4]
Technical Architecture
Separate the agent loop from code execution
A snippet executor sends generated actions to an external environment while the model-calling loop remains local. Hosting the entire application remotely instead moves that loop and its tools into the remote environment. The secure-execution guide documents the extra state and credential work for full-agent hosting and warns that the simple snippet route does not support the same managed-agent arrangements.[3]
Current integrations include Docker, E2B, Modal, and Blaxel. These names identify selectable backends; their isolation, egress, persistence, and account policies still need separate evaluation in an agent sandbox decision. The 1.26.0 release removed the remote WasmExecutor, so older examples using that executor are not a current setup path.[1][5]
A small documented setup
The following adapts the official Docker example. It requires a functioning Docker installation plus access to the model selected by InferenceClientModel; it was reviewed against documentation, not executed for this report.[3]
python -m pip install 'smolagents[docker]==1.26.0'
from smolagents import CodeAgent, InferenceClientModel
with CodeAgent(
model=InferenceClientModel(),
tools=[],
executor_type="docker",
) as agent:
answer = agent.run("Calculate the 100th Fibonacci number.")
print(answer)
The context manager is the documented cleanup mechanism. Test interruption and failure handling in the target environment as well as the successful path; abrupt process termination can require operational cleanup outside the Python context manager.[3][8]
Local restrictions are not isolation
LocalPythonExecutor interprets Python's syntax tree with restrictions such as authorized imports and operation limits. Those restrictions are not an OS boundary. The current security policy explicitly treats host filesystem or network access through the local executor as outside its isolation guarantees. An application handling untrusted model-authored code should select and configure an appropriate external execution boundary.[3][2]
Strengths
- Composable actions. Python is useful when one reasoning step needs to combine results, iterate over inputs, or calculate a derived value.[1]
- Selectable execution. The library exposes a concrete choice between local execution, snippet backends, and full-agent hosting rather than making every deployment use one service.[3]
- Inspectable runs. OpenTelemetry integration makes the sequence of model and tool activity available to a chosen tracing backend.[7]
Cautions
- A larger action surface. Generated Python requires a stricter execution decision than a deliberately narrow application function.[2]
- Backend-specific behavior. State movement, credentials, managed agents, and lifecycle handling vary with the execution arrangement.[3]
- Artifact trust. Shared agents, tools, and model artifacts require review and version pinning; a Hub location is not a security approval.[2]
- Trace handling. The inspection guide records model/tool interactions and inputs/outputs. Treat the trace destination as part of the application's data flow.[7]
What Developers Say
On March 5, 2026, GitHub user lifeishurdle reported that an interrupted Docker-backed run left a container occupying port 8888, causing the next run to fail. The report included Windows, Python 3.14.3, and smolagents 1.24.0 environment details. It remained open when checked, but it is a versioned user report, not evidence that every current installation has the same behavior.[8]
The useful evaluation question is whether cleanup works during cancellation, model errors, and startup failure in the team's deployment. This review did not reproduce that issue or perform comparative agent benchmarks.
Pricing & Licensing
Licensing model: Apache-2.0 for the library; the repository does not make a paid hosted service a prerequisite for using its code.[6][1]
Operating costs: Selected model providers and external sandbox backends can charge separately. Local execution still consumes compute, and tracing can introduce storage or service costs. The package's optional integration groups are dependency choices, not bundled service credits.[4][3][7]
Competitive Positioning
| Alternative | Decision difference |
|---|---|
| Pydantic AI | Its central application contract emphasizes typed outputs, dependencies, and composable capabilities. Compare that contract with smolagents' generated-code action model.[9][1] |
| LangChain / LangGraph | LangGraph exposes stateful graph orchestration, checkpointing, and interrupts; compare those controls when the workflow needs an explicit execution graph.[10] |
| Tembo | Tembo supplies coding-agent sessions, repository context, integrations, and review workflows. It addresses operating coding agents at the platform layer, while smolagents is a library for constructing an application agent.[11] |
Disclosure: Ry Walker is Tembo's founder and CEO. No native smolagents–Tembo integration was verified for this review; the comparison identifies adjacent responsibilities, not a tested deployment recipe.
Ideal Customer Profile
Best fit: Developers who need composable Python actions, can select an appropriate execution environment, and want to instrument their own agent application.
Poor fit: Teams expecting a complete managed coding-agent service from a Python package, or treating the default local interpreter as sufficient isolation for untrusted code.
Viability Assessment
The repository was publicly available and unarchived when checked. Its latest published 1.26.0 release included an executor removal and maintenance changes; the current security policy says fixes ship in the latest release rather than being backported to old versions.[1][5][2] These are useful maintenance facts. They do not establish a support SLA, organizational adoption count, or comparative reliability.
Bottom Line
smolagents is worth evaluating when generated Python is the desired action language. Its value is the combination of that loop with model, tool, and executor adapters. The engineering responsibility is equally concrete: decide where code runs, what it can reach, how credentials are scoped, and how a failed run is inspected and cleaned up.
Recommended for: Application teams comfortable owning execution and lifecycle behavior.
Not recommended for: Deployments that require the local executor itself to provide an isolation boundary.
Outlook: Evaluate current releases and the chosen backend together; the library and infrastructure can evolve independently.
Research by Ry Walker Research • methodology
Sources
- [1] smolagents repository and architecture
- [2] smolagents security policy and trust boundaries
- [3] smolagents code execution and sandbox approaches
- [4] smolagents package requirements and extras
- [5] smolagents 1.26.0 release, May 29, 2026
- [6] smolagents Apache-2.0 license
- [7] smolagents OpenTelemetry inspection guide
- [8] lifeishurdle: interrupted Docker runs leave containers, March 5, 2026
- [9] Pydantic AI library and typed agent architecture
- [10] LangGraph stateful agent orchestration
- [11] Tembo coding-agent platform