How amogharajsandur/newton-ai-agent works
Newton AI Agent is a Chrome extension and FastAPI service that detects Newton School tasks, sends them to a selected LLM, and applies the returned answer. The documented workflow includes portal identity capture, question extraction, solving, and submission; the backend also records users and solve attempts. The repository contains task-history API code, but the sampled application entry point mounts only the solve router. The dashboard source shown is a Vite starter screen, not evidence of the documented future usage dashboard.
Main entry points: solve.py Solve endpoint · background.js Solve dispatch · content.js Task detection · solver.py Prompt and validation
Components 18
Chrome extension
- Provider settings
extension/src/options.js - JWT capture
extension/src/auth_bridge.js - Task detection
extension/src/content.js - Editor bridge
extension/src/page_bridge.js - Solve dispatch
extension/src/background.js - Extension popup
extension/src/popup.js
Solve backend
- FastAPI entry
backend/app/main.py - Solve endpoint
backend/app/routes/solve.py - Request models
backend/app/models/schemas.py - Prompt and validation
backend/app/services/solver.py - Config and encryption
backend/app/config.py
Identity and records
- Supabase client
backend/app/db/supabase.py - Supabase records
backend/app/db/schema.sql - Task history API
backend/app/routes/tasks.py
LLM providers
- Selected LLM
Other components
- Student
- Newton portal
- Dashboard starter
dashboard/src/App.tsx
Connections 21
- Student → Newton portal: uses
README.md - Student → Provider settings: configures
README.md - Newton portal → JWT capture: sends authenticated requests
extension/src/auth_bridge.js - JWT capture → Task detection: dispatches identity
extension/src/auth_bridge.js - Newton portal → Task detection: provides task page
README.md - Task detection → Editor bridge: requests editor access
README.md - Task detection → Solve dispatch: sends question
README.md - Provider settings → Solve dispatch: supplies provider settings
README.md - Solve dispatch → FastAPI entry: POST /solve
README.md - FastAPI entry → Solve endpoint: mounts router
backend/app/main.py - Solve endpoint → Request models: validates request
backend/app/routes/solve.py - Solve endpoint → Config and encryption: encrypts key
backend/app/routes/solve.py - Solve endpoint → Supabase client: upserts and logs
backend/app/routes/solve.py - Solve endpoint → Prompt and validation: calls solver
backend/app/routes/solve.py - Prompt and validation → Selected LLM: dispatches prompt
backend/app/services/solver.py - Selected LLM → Prompt and validation: returns response
backend/app/services/solver.py - Supabase client → Supabase records: accesses records
- Task history API → Supabase client: queries task records
backend/app/routes/tasks.py - Solve endpoint → Solve dispatch: returns answer
README.md - Solve dispatch → Newton portal: fills and submits
README.md - Student → Dashboard starter: can open