-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.py
More file actions
44 lines (35 loc) · 1.33 KB
/
cli.py
File metadata and controls
44 lines (35 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
"""
cli.py — Interactive CLI for the Weather Activity Agent
Usage:
python cli.py # Interactive mode
python cli.py "Fremont, CA" # One-shot with default question
python cli.py "Tokyo" "rainy day activities"
"""
import sys
from agent import run_agent
def interactive_mode():
print("\n🌤️ Weather Activity Agent (LangGraph + Qwen)")
print("=" * 45)
print("Type 'quit' to exit\n")
while True:
location = input("📍 Enter location (e.g. 'Fremont, CA'): ").strip()
if location.lower() in ("quit", "exit", "q"):
break
if not location:
continue
question = input("💬 What do you want to know? [press Enter for default]: ").strip()
if not question:
question = "What activities do you recommend for today's weather?"
try:
run_agent(question, location)
except Exception as e:
print(f"\n❌ Error: {e}")
print("Make sure Ollama is running: ollama serve")
print("\n" + "-" * 45 + "\n")
if __name__ == "__main__":
if len(sys.argv) == 1:
interactive_mode()
elif len(sys.argv) == 2:
run_agent("What activities do you recommend for today's weather?", sys.argv[1])
elif len(sys.argv) >= 3:
run_agent(sys.argv[2], sys.argv[1])