|
Download README.md from Soha85/eduagent: direct link, hf CLI and curl.
- Browser
- Download file 3.98 kB
-
https://huggingface.co/spaces/Soha85/eduagent/resolve/main/README.md
- Command line
-
hf download hf://spaces/Soha85/eduagent/README.md
-
curl -L -o README.md https://huggingface.co/spaces/Soha85/eduagent/resolve/main/README.md
3.98 kB
metadata
title: Eduagent
emoji: π
colorFrom: red
colorTo: red
sdk: docker
app_port: 8501
tags:
- streamlit
pinned: false
short_description: Educational Agent
license: cc
π EduAgent β Educational AI Agent
A minimal but complete agentic AI tutor built with Groq + Streamlit.
Demonstrates: tool calling, multi-step agent loops, multi-turn memory, and clean UI.
What it does
| Tool | Triggered when you ask⦠|
|---|---|
explain_concept |
"What is X?", "Explain Y for a beginner" |
generate_quiz |
"Quiz me on Z", "Give me 3 questions aboutβ¦" |
solve_problem |
"Solve:", "Calculate:", "Find the derivativeβ¦" |
create_study_plan |
"Make a study plan forβ¦", "How to learn X in 4 weeks" |
You can chain them: "Explain recursion, then quiz me on it" calls two tools in one turn.
Groq API β why Groq?
- Free tier at console.groq.com β no credit card needed
- Extremely fast inference (useful for agentic loops with multiple LLM calls)
- Supports Llama 3.3 70B, Gemma 2, Mixtral, and more
Get your key: console.groq.com β API Keys β Create
π Platform setup
Streamlit Cloud (recommended)
- Fork / push this repo to GitHub
- Go to share.streamlit.io β New app
- Set main file to
app.py - Under Secrets, add:
GROQ_API_KEY = "gsk_your_key_here" - Deploy β
Hugging Face Spaces
- Create a new Space β SDK: Streamlit
- Upload
app.pyandrequirements.txt - Go to Settings β Repository secrets β Add
GROQ_API_KEY - The app reads
st.secrets["GROQ_API_KEY"]automatically β
Kaggle Notebook
# Cell 1 β install
!pip install streamlit groq pyngrok -q
# Cell 2 β set key (use Kaggle Secrets: Add-ons β Secrets)
import os
from kaggle_secrets import UserSecretsClient
os.environ["GROQ_API_KEY"] = UserSecretsClient().get_secret("GROQ_API_KEY")
# Cell 3 β run with tunnel
from pyngrok import ngrok
ngrok.set_auth_token("YOUR_NGROK_TOKEN") # free at ngrok.com
public_url = ngrok.connect(8501)
print("App URL:", public_url)
!streamlit run app.py --server.port 8501 --server.headless true
Local
pip install -r requirements.txt
export GROQ_API_KEY="gsk_..." # or set in .env
streamlit run app.py
Architecture
User input
β
βΌ
βββββββββββββββββββββββββββββββββββ
β System prompt + chat history β
β + TOOLS schema (4 tools) β
ββββββββββββββββ¬βββββββββββββββββββ
β
βΌ
Groq LLM call
β
βββββββββ΄βββββββββ
β tool_calls? β No β final answer
β Yes β
βΌ β
execute_tool() β
(second LLM call β
with focused prompt) β
β β
ββββΊ feed result back to LLM
(loop up to 5 iterations)
Extending the agent
Add a real calculator tool (no LLM needed):
# In execute_tool(), add:
if tool_name == "calculate":
import math
return str(eval(tool_args["expression"])) # use safer eval in prod
Add web search (using DuckDuckGo, free):
from duckduckgo_search import DDGS
def web_search(query):
with DDGS() as ddgs:
return "\n".join(r["body"] for r in ddgs.text(query, max_results=3))
Swap Groq for OpenAI-compatible APIs (same code, change base_url):
client = Groq(api_key=key) # Groq (default)
# client = OpenAI(api_key=key) # OpenAI
# client = OpenAI(api_key=key, # Together.ai / any OpenAI-compatible
# base_url="https://api.together.xyz/v1")