A command-line AI agent that can book doctor appointments, manage users, check weather, search the web, and look up stock information — all powered by a local LLM (Ollama) and a SQLite database.
You chat with an AI assistant in your terminal. The assistant has access to tools it can call automatically:
| Tool | Description |
|---|---|
insert_user |
Register a new patient |
get_user |
Look up a patient by ID |
insert_appointment |
Book a doctor appointment |
get_appointments |
List appointments for a patient |
get_weather |
Get current weather for a city |
search_web |
Search the internet |
get_ticker_info |
Fetch stock ticker details |
get_company_profile |
Get a company summary |
| … and more | Financial tools for dividends, analyst recommendations, etc. |
When you say something like "I want to see a doctor tomorrow at 5 PM", the agent figures out which tool to call and executes it against the SQLite database.
support_agent/
├── agent.py # Core Agent class (chat loop, tool execution)
├── cli.py # Click-based CLI (ask / chat commands)
├── db.py # SQLite database connection & table creation
├── llm_client.py # HTTP client for the Ollama LLM API
├── schemas.py # Pydantic models (ToolCall, ChatResponse, etc.)
├── tools.py # @tool decorator + built-in tools (weather, web, stocks)
├── util.py # Converts Python functions → LLM tool payloads
├── seed_data.py # Populate the database with sample data
├── .env # Environment variables (API keys) — not committed
├── .gitignore
├── models/
│ ├── __init__.py
│ ├── user.py # insert_user, get_user tools
│ └── appointment.py # insert_appointment, get_appointments tools
└── venv/ # Python virtual environment (not committed)
- Python 3.10+
- Ollama running locally (default:
http://localhost:11434)- Pull a model:
ollama pull qwen3.5:latest
- Pull a model:
- (Optional) A Tavily API key for web search — set in
.env
cd support_agentpython -m venv venv
# Windows
venv\Scripts\activate
# macOS / Linux
source venv/bin/activatepip install -r requirements.txtThis single requirements.txt includes both CLI and API server dependencies (FastAPI, Uvicorn, SSE).
Create a .env file in the project root:
TAVILY_API_KEY=your_tavily_api_key_here
python db.pyThis creates clinic.db with users and appointments tables.
python seed_data.pySeed complete: 10 new users, 17 new appointments.
Running it again is safe — duplicates are skipped:
Seed complete: 0 new users, 0 new appointments.
Interactive chat:
python cli.py chatSingle question:
python cli.py ask "What is the weather in Mumbai?"You can launch both the FastAPI backend and Next.js UI with one command.
# Optional: first-time install
./run.ps1 -Install
# Subsequent runs
./run.ps1chmod +x run.sh
./run.sh --install # first time only
./run.sh # subsequent runsServices:
- API: http://localhost:8000 (FastAPI/uvicorn)
- UI: http://localhost:3000 (Next.js)
The UI streams the agent’s execution trace (reasoning → tool → SQL → result → response) in real time.
$ python cli.py chat
Agent chat started. Type 'exit' or 'quit' to end the session.
You> Book an appointment with Dr. Ramesh Kumar on April 25 at 3pm for a headache
Calling tool: insert_appointment with {'user_id': 1, 'doctor_name': 'Dr. Ramesh Kumar', 'appointment_date': '2026-04-25 15:00', 'reason': 'headache'}
Your appointment with Dr. Ramesh Kumar has been booked for April 25, 2026 at 3:00 PM.
You> Show my appointments
Calling tool: get_appointments with {'user_id': 1}
Here are your upcoming appointments:
1. Dr. Ramesh Kumar — April 18, 2026 at 10:00 AM (General checkup)
2. Dr. Sunita Verma — April 20, 2026 at 2:30 PM (Blood test follow-up)
3. Dr. Ramesh Kumar — April 25, 2026 at 3:00 PM (Headache)
You> What's the weather in Delhi?
Calling tool: get_weather with {'city': 'Delhi'}
Delhi: ☀️ +38°C
You> exit
Goodbye!
You can run the app inside a Docker container — no need to install Python or dependencies on your machine.
docker build -t support-agent .docker run -it support-agentdocker run -it support-agent python cli.py ask "What is the weather in Mumbai?"docker run -it support-agent python seed_data.pyBy default the database lives inside the container and is lost when the container is removed. To keep it across runs, mount a volume:
docker run -it -v support-agent-data:/app support-agentOr bind-mount a local folder:
docker run -it -v ./data:/app support-agentNote: The container connects to Ollama on your host machine. If Ollama runs on
localhost:11434, you may need to use--network host(Linux) orhost.docker.internal(Windows/macOS) so the container can reach it.
- Change the LLM model: pass
--model <name>tochatorask. - Change the system prompt: pass
--instruction "...". - Add new tools: create a function in
tools.pyor a new file undermodels/, decorate it with@tool, and import the module incli.py.