HeadlinesBriefing favicon HeadlinesBriefing.com

AI Subroutines: Browser Automation Tools That Run Inside Webpages

Hacker News •
×

We built AI Subroutines in rtrvr.ai. Record a browser task once, save it as a callable tool, and replay it at zero token cost with zero LLM inference delay. The subroutine executes deterministically, composed of network calls and DOM interactions like clicks and types. The key innovation? Scripts run inside the webpage itself, not through proxies or headless workers. This preserves auth, CSRF tokens, and TLS sessions automatically, eliminating manual certificate installations or separate auth stacks.

The system captures ~300 network requests during recording, scoring them based on first-party origin, temporal correlation to user actions, and payload structure. Volatile GraphQL operation IDs trigger DOM-only fallbacks to prevent silent failures. The top five requests get combined with DOM actions into a 12,000-character context window for code generation. This ranking system ensures reliability when sites change endpoints or authentication schemes.

Subroutines function as callable tools in the agent's toolkit. A sheet of 500 Instagram URLs can trigger 500 Subroutines with one LLM call to select parameters. Each replay uses deterministic scripts, not repeated LLM inferences, avoiding token costs and non-determinism. The rtrvr.* helper namespace provides DOM interaction shortcuts while maintaining authentication context.

This approach solves the core problem of browser agent reliability. Unlike out-of-process tools that break with auth changes, rtrvr.ai's in-page execution propagates session context automatically. Developers can now build bulk automation tools without maintaining complex auth infrastructure or risking fragile selectors. The technology enables practical applications like CRM synchronization and bulk social media outreach where previous agent systems failed.