# Smolagents Code First AI Agent Library

> smolagents is HuggingFace's barebones Python library for building AI agents that think in code rather than JSON. Agents write and execute Python code as their action space, enabling more flexible reasoning and tool use with support for sandboxed execution via E2B, Docker, or WebAssembly. Use when this capability is needed.

- Skill: `tomevault-io/smolagents-code-first-ai-agent-library` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/smolagents-code-first-ai-agent-library`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/smolagents-code-first-ai-agent-library/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: DevOps & Infra
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/smolagents-code-first-ai-agent-library

---


# smolagents Code-First AI Agent Library

smolagents is HuggingFace's barebones Python library for building AI agents that think in code rather than JSON. Agents write and execute Python code as their action space, enabling more flexible reasoning and tool use with support for sandboxed execution via E2B, Docker, or WebAssembly.

## Installation

Use the upstream install or setup path that matches your environment:
- pip install "smolagents[toolkit]"

Requirements and caveats from upstream:
- Our [CodeAgent](https://huggingface.co/docs/smolagents/reference/agents#smolagents.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:
- [Docker](https://www.docker.com/) — self-hosted container isolation

Basic usage or getting-started notes:
- smolagents is a library that enables you to run powerful agents in a few lines of code. It offers:
- 🧑‍💻 **First-class support for Code Agents**. Our [CodeAgent](https://huggingface.co/docs/smolagents/reference/agents#smolagents.CodeAgent) writes its actions in code (as opposed to "agents being used to write code")....
- Then define your agent, give it the tools it needs and run it!

- Source: https://github.com/huggingface/smolagents
- Extracted from upstream docs: https://raw.githubusercontent.com/huggingface/smolagents/HEAD/README.md

## Source

- [Agent Skill Exchange](https://agentskillexchange.com/skills/smolagents-code-first-ai-agent-library/)

---
> Source: [agentskillexchange/skills](https://github.com/agentskillexchange/skills) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-06-16 -->

