lifeos-agent / verify.py
Dhanushkumarps
initial commit: LifeOS environment and Streamlit UI
13ceb89
Raw
History Blame Contribute Delete
1.79 kB
"""verification test for Section 5 build"""
import sys
sys.path.insert(0, ".")
# Test all imports
from data.sample_tasks import SAMPLE_TASKS, SAMPLE_CALENDAR, SAMPLE_PREFERENCES, SAMPLE_ENERGY_PROFILE, TRAINING_SCENARIOS
print(f"[OK] data.sample_tasks: {len(SAMPLE_TASKS)} tasks, {len(TRAINING_SCENARIOS)} training scenarios")
from utils.prompts import PLANNER_SYSTEM_PROMPT, CRITIC_LLM_PROMPT, MEMORY_RETRIEVAL_PROMPT
print("[OK] utils.prompts: 3 prompts loaded")
from agents.reward import calculate_reward, explain_reward
print("[OK] agents.reward: calculate_reward, explain_reward")
from agents.critic import rule_based_critic, critic_agent, _parse_time, _slot_duration_mins
print("[OK] agents.critic: rule_based_critic, critic_agent, helpers")
from agents.planner import planner_agent, _heuristic_schedule
print("[OK] agents.planner: planner_agent, _heuristic_schedule")
from agents.memory import MemoryAgent
print("[OK] agents.memory: MemoryAgent")
from orchestrator import run_lifeos, format_plan_for_display
print("[OK] orchestrator: run_lifeos, format_plan_for_display")
from utils.plot_rewards import plot_reward_curve
print("[OK] utils.plot_rewards: plot_reward_curve")
from env.lifeos_env import LifeOSEnv
print("[OK] env.lifeos_env: LifeOSEnv")
print()
print("=== Quick functional test ===")
env = LifeOSEnv(SAMPLE_TASKS, SAMPLE_CALENDAR, SAMPLE_PREFERENCES, SAMPLE_ENERGY_PROFILE)
state = env.reset()
print(f"reset() OK tasks={len(state['tasks'])} days={len(state['calendar'])}")
plan = _heuristic_schedule(state)
_, reward, done, info = env.step({"plan": plan})
print(f"step() OK reward={reward:.1f} issues={len(info['issues'])} done={done}")
env.render()
explanation = explain_reward(info["issues"], plan, state)
print("explain_reward OK:")
print(explanation)