Initial commit: University Playwright Codegen Agent

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
yangxiaoyu-crypto
2025-12-09 16:38:33 +08:00
commit 46915964e1
32 changed files with 3091 additions and 0 deletions

48
test_run.py Normal file
View File

@ -0,0 +1,48 @@
#!/usr/bin/env python
"""Quick test script to run the agent."""
import os
# Load environment variables from User scope
import ctypes
from ctypes import wintypes
def get_user_env(name):
"""Get user environment variable on Windows."""
try:
import winreg
with winreg.OpenKey(winreg.HKEY_CURRENT_USER, r"Environment") as key:
return winreg.QueryValueEx(key, name)[0]
except Exception:
return os.environ.get(name)
# Set environment variables
api_key = get_user_env("ANTHROPIC_API_KEY")
base_url = get_user_env("ANTHROPIC_BASE_URL")
if api_key:
os.environ["ANTHROPIC_API_KEY"] = api_key
if base_url:
os.environ["ANTHROPIC_BASE_URL"] = base_url
print(f"API Key set: {bool(api_key)}")
print(f"Base URL: {base_url}")
# Run the agent
from university_agent import GenerationEngine, GenerationRequest, Settings
settings = Settings()
print(f"Using model: {settings.anthropic_model}")
engine = GenerationEngine(settings)
request = GenerationRequest(
target_url="https://www.stanford.edu",
campus_name="Stanford",
assumed_language="English",
max_depth=3, # Increased depth to reach individual profiles
max_pages=30, # More pages to explore
)
print("Starting generation...")
result = engine.generate(request, capture_snapshot=True)
print(f"Script saved to: {result.script_path}")
print(f"Project slug: {result.plan.project_slug}")