{"id":25023193,"url":"https://github.com/eser/smolagentsjs","last_synced_at":"2025-03-30T12:44:52.692Z","repository":{"id":271040939,"uuid":"912222966","full_name":"eser/smolagentsjs","owner":"eser","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-05T01:11:25.000Z","size":898,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-24T18:28:02.537Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eser.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-05T00:26:50.000Z","updated_at":"2025-01-05T01:11:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"525c02fa-da0a-4e8c-b7b9-6fb705b35ce3","html_url":"https://github.com/eser/smolagentsjs","commit_stats":null,"previous_names":["eser/smolagentsjs"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eser%2Fsmolagentsjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eser%2Fsmolagentsjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eser%2Fsmolagentsjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eser%2Fsmolagentsjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eser","download_url":"https://codeload.github.com/eser/smolagentsjs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246320131,"owners_count":20758407,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-05T14:37:29.168Z","updated_at":"2025-03-30T12:44:52.682Z","avatar_url":"https://github.com/eser.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!---\nCopyright 2024 The HuggingFace Team. All rights reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--\u003e\n\u003cp align=\"center\"\u003e\n    \u003c!-- Uncomment when CircleCI is set up\n    \u003ca href=\"https://circleci.com/gh/huggingface/accelerate\"\u003e\u003cimg alt=\"Build\" src=\"https://img.shields.io/circleci/build/github/huggingface/transformers/master\"\u003e\u003c/a\u003e\n    --\u003e\n    \u003ca href=\"https://github.com/huggingface/smolagents/blob/main/LICENSE\"\u003e\u003cimg alt=\"License\" src=\"https://img.shields.io/github/license/huggingface/smolagents.svg?color=blue\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://huggingface.co/docs/smolagents/index.html\"\u003e\u003cimg alt=\"Documentation\" src=\"https://img.shields.io/website/http/huggingface.co/docs/smolagents/index.html.svg?down_color=red\u0026down_message=offline\u0026up_message=online\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/huggingface/smolagents/releases\"\u003e\u003cimg alt=\"GitHub release\" src=\"https://img.shields.io/github/release/huggingface/smolagents.svg\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/huggingface/smolagents/blob/main/CODE_OF_CONDUCT.md\"\u003e\u003cimg alt=\"Contributor Covenant\" src=\"https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch3 align=\"center\"\u003e\n  \u003cp\u003e🤗 smolagents - a smol library to build great agents!\u003c/p\u003e\n\u003c/h3\u003e\n\n`smolagents` is a library that enables you to run powerful agents in a few lines of code. It offers:\n\n✨ **Simplicity**: the logic for agents fits in ~thousand lines of code (see [agents.py](https://github.com/huggingface/smolagents/blob/main/src/smolagents/agents.py)). We kept abstractions to their minimal shape above raw code!\n\n🧑‍💻 **First-class support for Code Agents**, i.e. agents that write their actions in code (as opposed to \"agents being used to write code\"). To make it secure, we support executing in sandboxed environments via [E2B](https://e2b.dev/).\n - On top of this [`CodeAgent`](https://huggingface.co/docs/smolagents/reference/agents#smolagents.CodeAgent) class, we still support the standard [`ToolCallingAgent`](https://huggingface.co/docs/smolagents/reference/agents#smolagents.ToolCallingAgent) that writes actions as JSON/text blobs.\n\n🤗 **Hub integrations**: you can share and load tools to/from the Hub, and more is to come!\n\n🌐 **Support for any LLM**: it supports models hosted on the Hub loaded in their `transformers` version or through our inference API, but also supports models from OpenAI, Anthropic and many others via our [LiteLLM](https://www.litellm.ai/) integration.\n\n## Quick demo\n\nFirst install the package.\n```bash\npip install smolagents\n```\nThen define your agent, give it the tools it needs and run it!\n```py\nfrom smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel\n\nagent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=HfApiModel())\n\nagent.run(\"How many seconds would it take for a leopard at full speed to run through Pont des Arts?\")\n```\n\nhttps://github.com/user-attachments/assets/cd0226e2-7479-4102-aea0-57c22ca47884\n\n## Code agents?\n\nIn our `CodeAgent`,  the LLM engine writes its actions in code. This approach is demonstrated to work better than the current industry practice of letting the LLM output a dictionary of the tools it wants to calls: [uses 30% fewer steps](https://huggingface.co/papers/2402.01030) (thus 30% fewer LLM calls)\nand [reaches higher performance on difficult benchmarks](https://huggingface.co/papers/2411.01747). Head to [our high-level intro to agents](https://huggingface.co/docs/smolagents/conceptual_guides/intro_agents) to learn more on that.\n\nEspecially, since code execution can be a security concern (arbitrary code execution!), we provide options at runtime:\n  - a secure python interpreter to run code more safely in your environment\n  - a sandboxed environment using [E2B](https://e2b.dev/).\n\n## How smol is it really?\n\nWe strived to keep abstractions to a strict minimum: the main code in `agents.py` is only ~1,000 lines of code.\nStill, 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.\n\nBy 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!\n\n## How strong are open models for agentic workflows?\n\nWe've created [`CodeAgent`](https://huggingface.co/docs/smolagents/reference/agents#smolagents.CodeAgent) instances with some leading models, and compared them on [this benchmark](https://huggingface.co/datasets/m-ric/agents_medium_benchmark_2) that gathers questions from a few different benchmarks to propose a varied blend of challenges.\n\n[Find the benchmarking code here](https://github.com/huggingface/smolagents/blob/main/examples/benchmark.ipynb) 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).\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/blog/smolagents/benchmark_code_agents.png\" alt=\"benchmark of different models on agentic workflows\" width=70%\u003e\n\u003c/p\u003e\n\nThis comparison shows that open source models can now take on the best closed models!\n\n## Citing smolagents\n\nIf you use `smolagents` in your publication, please cite it by using the following BibTeX entry.\n\n```bibtex\n@Misc{smolagents,\n  title =        {`smolagents`: The easiest way to build efficient agentic systems.},\n  author =       {Aymeric Roucher and Thomas Wolf and Leandro von Werra and Erik Kaunismäki},\n  howpublished = {\\url{https://github.com/huggingface/smolagents}},\n  year =         {2025}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feser%2Fsmolagentsjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feser%2Fsmolagentsjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feser%2Fsmolagentsjs/lists"}