A lightweight web UI for 🤗smolagents.
🆕Recent Updates
- v0.1.0 (Dec 11, 2025): First release!
📑Table of Contents
✨Overview
🤗Smolagents is a flexible and powerful framework for building AI agents powered by large language models (LLMs). This repo aims to provide a friendly web App for both developers and end users.
| Features | Support |
|---|---|
| Chat history | :white_check_mark: persistent storage with local database |
| Image and dataset | :white_check_mark: Displays images, dataframes, and complex objects |
💿Installation
The Python package is available on PyPI.
pip install smolagentsUI
🚀Quick Start
In this demo, we build a Code Agent to analyze the public breast cancer dataset. The agent has access to a Python interpreter. All actions are executed via Python code. The agent can load a dataset from disk, perform exploratory data analysis, build machine learning models, and visualize results. For more information about Code Agents, please refer to the Smolagents documentation.
We first define a custom tool that loads a dataset as a pandas DataFrame. The agent will use this tool to access the breast cancer dataset.
from smolagents import Tool
import pandas as pd
class DataLoaderTool(Tool):
name = "data_loader"
description = """ Get breast cancer dataset as pandas.DataFrame. """
inputs = {}
output_type = "object"
def __init__(self, df: pd.DataFrame):
super().__init__()
self.df = df.copy()
def forward(self) -> pd.DataFrame:
return self.df
We then create an instance of the tool with the locally stored breast cancer dataset.
df = pd.read_csv('./demo/data/breast-cancer.data.csv')
data_loader_tool = DataLoaderTool(df=df)
Next, we prepare a model instance using a locally served gpt-oss-120b as the LLM backend.
from smolagents import CodeAgent, OpenAIModel
model = OpenAIModel(model_id="openai/gpt-oss-120b",
api_key="",
api_base="http://localhost:8000/v1")
We create a Code Agent with the data loader tool. For data analysis tasks, we authorize additional Python libraries such as pandas, numpy, sklearn, tableone, matplotlib, and PIL for the agent to use. We add some additional instructions to the agent's system prompt to ensure that all outputs are returned via the final_answer function. Adjust this per your specific use case.
instructions = """
Specific Instructions:
1. Do not save any files to disk. All outputs should be returned via `final_answer` function which is the ONLY way users can see your outputs.
2. Users might not see your intermediate reasoning steps, so make sure to explain your thoughts clearly in the `final_answer` function.
3. If your output is an object,
- it is highly encouraged to pass a List to the `final_answer` function with a friendly and helpful explanatory text and the requested output (e.g., Markdown text, Dict, PIL iamge, matplotlib image, pandas dataframe...), for example, `final_answer(["<Your explanation and thoughts in Markdown>", df.head(), img])`
- always check your output object by printing its type and content summary before passing to `final_answer` function to avoid errors. For example, you can use `print(type(your_object))` and `print(your_object)` to check the type and content of your output object.
4. Communication is key. If you need clarification or more information from the user, ask clarifying questions via the `final_answer` function before taking actions.
5. If the task requires writing long code. Do not try to write the whole code at once. Instead, break down the code into smaller snippets, functions, or classes and implement them one by one, testing each part before moving on to the next. This is to avoid overwhelming the execution environment and causing memory issues.
"""
agent = CodeAgent(tools=[data_loader_tool],
model=model, executor_type='local',
additional_authorized_imports = ["pandas", "numpy.*", "tableone", "scipy", "scipy.*", "sklearn", "sklearn.*", "statsmodels", "statsmodels.*", "matplotlib", "matplotlib.*", "PIL", "PIL.*"],
instructions=instructions,
stream_outputs=True)
Now, we start the web UI server with a persistent chat history storage (SQLite database file). If this is the first time, a SQLite database file will be created in the specified path. If the storage_path parameter is omitted, the chat history will be stored in memory only (non-persistent).
import smolagentsUI
# Create or load chat history from the specified SQLite database file
smolagentsUI.serve(agent, host="0.0.0.0", port=5000, storage_path="./chat_history/mychat.db")
# For in-memory chat history (non-persistent), leave out `storage_path` parameter
# smolagentsUI.serve(agent, host="0.0.0.0", port=5000)
Metadata
Release files for smolagentsUI 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| smolagentsui-0.1.4.tar.gz | 29.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| smolagentsui-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 59.7 kB
Release files / smolagentsui-0.1.4.tar.gz
| Download URL | smolagentsui-0.1.4.tar.gz |
|---|---|
| Size | 29.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d045a7907fe36ad69ff903b0cb99da3627b9e0bd3d33046f6ad84b03eddc77ef
|
|
BLAKE2b-256 checksum How to use checksums |
540f767e83243a524bee414644d3ea09527cb4bdb306620789f1f9b44a28f24b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.11.8 Linux/6.8.0-90-generic
|
Release files / smolagentsui-0.1.4-py3-none-any.whl
| Download URL | smolagentsui-0.1.4-py3-none-any.whl |
|---|---|
| Size | 30.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d9e83099e77500402680fdcfeafd33721e57e0fb4b61bdbdc2498f43941dbe6b
|
|
BLAKE2b-256 checksum How to use checksums |
dfd7a788087d175f876cf3ddfcb0243ce32407d8e3b6922b5a128c7457e21076
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.11.8 Linux/6.8.0-90-generic
|
Security for smolagentsUI 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.