smolagents  by huggingface

Agent library for building systems that think in code

created 8 months ago
21,689 stars

Top 2.0% on sourcepulse

GitHubView on GitHub
Project Summary

smolagents is a Python library for building AI agents that think and act in Python code, targeting developers and researchers. It simplifies the creation of powerful agents with minimal code, offering first-class support for code-writing agents, sandboxed execution, and seamless integration with various LLMs and tools.

How It Works

smolagents employs a ReAct-like loop where the LLM generates actions as Python code snippets, rather than JSON or text. This approach, implemented in the CodeAgent, is claimed to reduce LLM calls by 30% and improve performance on benchmarks. Tool calls are executed as Python function calls, and the agent can handle multimodal inputs and integrate with external tools from libraries like LangChain or even Hugging Face Spaces.

Quick Start & Requirements

  • Install via pip: pip install smolagents
  • Requires Python. Specific LLM integrations may have additional dependencies (e.g., transformers, ollama, API keys for cloud providers).
  • Official documentation: https://github.com/huggingface/smolagents

Highlighted Details

  • Code-centric Agents: Agents write actions as Python code, leading to more efficient and performant workflows.
  • Sandboxed Execution: Supports secure execution via E2B or Docker to mitigate risks of arbitrary code execution.
  • Model & Modality Agnostic: Integrates with any LLM (local, Hub, OpenAI, Anthropic via LiteLLM) and supports text, vision, audio, and video inputs.
  • Hub Integration: Allows sharing and loading agents and tools directly from the Hugging Face Hub.

Maintenance & Community

  • Developed by Hugging Face contributors, including prominent figures like Thomas Wolf and Leandro von Werra.
  • Contribution guide available for community involvement.
  • BibTeX entry provided for academic citation.

Licensing & Compatibility

  • The library is likely distributed under a permissive license, common for Hugging Face projects, but the specific license is not explicitly stated in the README. Compatibility for commercial use is generally high for Hugging Face libraries.

Limitations & Caveats

The README highlights security as a critical consideration, recommending sandboxed execution. While it claims open-source models perform comparably to closed models, this is based on specific benchmarks provided within the repository. The "smol" nature means abstractions are minimal, encouraging users to dive into the source code.

Health Check
Last commit

1 day ago

Responsiveness

1 day

Pull Requests (30d)
87
Issues (30d)
39
Star History
3,961 stars in the last 90 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), Taranjeet Singh Taranjeet Singh(Cofounder of Mem0), and
1 more.

fragments by e2b-dev

0.6%
6k
Next.js template for AI-generated apps
created 1 year ago
updated 1 week ago
Feedback? Help us improve.