| --- |
| title: Agent 101 |
| emoji: π€ |
| colorFrom: indigo |
| colorTo: pink |
| sdk: gradio |
| sdk_version: 5.9.1 |
| app_file: app.py |
| python_version: "3.11" |
| pinned: false |
| license: apache-2.0 |
| short_description: LLM side-by-side with and without tool access. |
| --- |
| |
| # Agent 101 |
|
|
| A tiny demo to show what "giving an LLM tools" actually does. |
|
|
| Both sides of the app call the **same model** via the HF Inference Providers |
| API (default: `meta-llama/Llama-3.1-8B-Instruct`). The left side runs the |
| model plain. The right side hands it a small toolkit (calculator, weather |
| lookup, unit converter, course-notes search, CS/ML dictionary) and runs an |
| agent loop. |
|
|
| Try a question the plain LLM can't answer β e.g. `What is 4729 times 8314?` |
| or `How much hotter is Delhi than Bangalore right now?`. The plain model |
| will guess or refuse; the agent will reach for the right tool, execute it, |
| and answer from the real data. |
|
|
| Because inference is delegated to HF Inference Providers, this Space runs |
| fine on **free CPU Basic** hardware β no GPU required. |
|
|
| Based on the Week 12 lab for CS 203 (Software Tools and Techniques for AI) |
| at IIT Gandhinagar. The full Colab is at |
| [`lecture-demos/week12/colab-notebooks/01-agents-from-scratch.ipynb`](https://github.com/nipunbatra/stt-ai-teaching/blob/master/lecture-demos/week12/colab-notebooks/01-agents-from-scratch.ipynb) |
| in the course repo. |
|
|
| ## Running locally |
|
|
| ```bash |
| pip install -r requirements.txt |
| export HF_TOKEN=hf_... |
| python app.py |
| ``` |
|
|
| To swap the backing model: |
|
|
| ```bash |
| export MODEL_ID="Qwen/Qwen2.5-72B-Instruct" # or any tool-capable chat model |
| ``` |
|
|
| ## Deploy to HF Spaces |
|
|
| ```bash |
| git init |
| git remote add origin https://huggingface.co/spaces/Nipun/agent-101 |
| git add . |
| git commit -m "Initial commit: Agent 101" |
| git push -u origin main |
| ``` |
|
|
| Then set the `HF_TOKEN` secret in the Space's Settings β Variables and Secrets. |
| CPU Basic (free) is enough β no GPU needed. |
|
|