How magnitudedev/magnitude works
Project type and purpose
• This is a monorepo (TurboRepo) housing an open‑source end‑to‑end testing framework (“Magnitude”) powered by AI agents.
• It exposes a CLI/test‑runner (magnitude-test), core agent logic (magnitude-core), a remote agent transport layer (magnitude-remote), and a hosted backend service (magnitude-mcp). There’s also an infra/modal folder for self‑hosting on Modal.
File structure
• Top‑level:
• packages/
– magnitude-core (agent logic, CLI entry point, recipe model)
– magnitude-test (test-case compiler, discovery, renderer, runner CLI)
– magnitude-remote (client/server for remote agent execution)
– magnitude-mcp (hosted API server + tool services)
• infra/modal (Python scripts & configs for self‑hosting on Modal)
• assets (demo gif)
• configs: package.json, turbo.json, tsconfigs, .dockerignore, .gitignore
• Patterns:
• Each package is an isolated Node/TS module.
• magnitude-test compiles and discovers *.mag.ts files, then invokes either a LocalRunner or RemoteRunner.
• LocalRunner uses magnitude-core directly; RemoteRunner communicates with magnitude-remote server.
• magnitude-mcp is a standalone Node service exposing REST/gRPC endpoints for the hosted offering.
README for additional insights
• Core features: planning agent (LLM), execution agent (visual/browser), natural‑language DSL.
• Two deployment modes: Hosted (calls mcp service + managed infra) vs Self‑hosted (deploy your own mcp/remote agent + browser infra + LLM provider).
1. Developer Workstation
• magnitude-test CLI
• Test files (*.mag.ts)
2. Local Execution Path
• magnitude-core (planning & execution agents)
• Browser Infra (Playwright / headless Chrome)
• LLM Provider (OpenAI, Anthropic, etc.)
3. Remote Execution Path (Self‑hosted)
• magnitude-test RemoteRunner
• magnitude-remote Server & Observer/Tunnel
• magnitude-core (agent logic runs in remote)
• Browser Infra & LLM Provider
4. Hosted Service Path
• magnitude-test RemoteRunner → magnitude-mcp API
• magnitude-mcp (API server, toolService)
• Managed LLM Infra (proprietary)
• Managed Browser Infra (Modal / proprietary)
5. infra/modal (optional)
• Scripts to deploy self‑hosted magnitude-remote & magnitude-core on Modal
• CLI “npx magnitude”:
• Discovers tests → compiles → invokes Runner
• LocalRunner → magnitude-core → LLM Provider & Browser → returns results
• RemoteRunner → HTTP/WebSocket → magnitude-remote Server → spawns magnitude-core + Browser → streams back events
• Hosted: RemoteRunner → magnitude-mcp API → orchestrates internal magnitude-core + Modal browser + LLM → returns logs/results
c. Architectural patterns & principles:
• Monorepo with isolated packages (clear boundaries).
• Plug‑in runner strategy (Local vs Remote).
• Separation of concerns:
• magnitude-test (test orchestration)
• magnitude-core (agent intelligence)
• magnitude-remote (transport)
• magnitude-mcp (hosted backend).
• Dependency‐injection of LLM and browser infra for self‑hosting vs managed hosting.
d. Key technologies & frameworks:
• Node.js / TypeScript, Turborepo for monorepo management
• Playwright / headless Chrome for visual execution
• REST/WebSocket for remote communication
• Modal for serverless deployment (infra/modal)
• Various LLM providers via HTTP APIs