September 3, 2025
"The show must go on", and so must the effort to fill every seat. Broadway production companies hate empty seats. Every day, they slash ticket prices on the TDF website, sometimes by up to 80%. But hunting for these deals manually means constantly refreshing pages and hoping you catch the best discounts before they disappear. For showgoers with flexible schedules, it'd be a more efficient use of your time to simply get alerted when there's a deal that’s too good to pass up. That’s where Trigger.dev and Anchor Browser star in this show.
Trigger.dev is a job scheduling and workflow automation tool for JavaScript developers. With Trigger, you will be able to automatically invoke a script that performs recurring checks, for example requests to the TDF website for new tickets everyday at 5pm ET. Within the script, we’ll call the Anchor Browser API, which will provide the backend browser and agentic interaction capabilities to make sense of the latest ticket results displayed. That way you’ll never miss a great deal again.
Read on to learn exactly how we’ll hunt for Broadway deals using Trigger.dev and Anchor Browser.
What is Trigger.dev?
Trigger.dev is an open-source framework that solves a common serverless problem: running reliable background jobs. That means seamlessly executing background jobs that can be long running, anticipate failures, and handle retries. Instead of building separate infrastructure, you write background jobs directly in your existing codebase using their SDK.
The magic happens through "Tasks" declared to Trigger.dev. Tasks are wrappable functions that automatically handle code execution, logging, and state management. When your job runs, Trigger.dev orchestrates the execution by calling your code multiple times as needed, storing progress after each successful task so nothing gets lost if something fails. Think of it as giving your serverless functions extra capabilities to get the job done no matter the conditions: they can now run for hours, mitigate failures, and pick up exactly where they left off.
Built specifically for JavaScript and TypeScript developers, Trigger.dev currently supports Next.js and serverless platforms like Vercel. Start using Trigger.dev by defining tasks using familiar async/await syntax and then schedule your jobs.
What is Anchor Browser?
Anchor Browser is an agentic browser API for automating web-based tasks, built to meet the highest reliability requirements and demands of complex enterprise workflows. It provides the highest-level of security and browser interaction capabilities, including the option to install extensions and use OS-level commands on the browser. Think of Anchor Browser like a modern API for legacy interfaces. Plus, with a developer-focus from day one, you’ll find numerous quickstarts, SDK examples, and example use cases in the Anchor Browser documentation.
Why Trigger.dev and Anchor Browser work well together
For our goal of consistently monitoring a web page for changing content and parsing the results, Trigger.dev and Anchor Browser work seamlessly together. The scheduling of the task and code execution is handled in the background automatically by Trigger.dev. Then, within each execution, Anchor Browser is called on to visit the target url and invoke a computer-using agent that inspects the webpage and returns a response. Using both tools together provides a best-in-class reliability setup: Trigger.dev is able to restart the job in an unlikely event that the Anchor Browser API is unavailable, and the Anchor Browser API is able to perform multiple attempts at fetching the target URL in case any one request fails. Anchor Browser also supports an up-to-date JavaScript SDK that makes writing your scripts fast and easy.
In our example for monitoring TDF for discount Broadway tickets, we’ll write a Trigger.dev task that calls on Anchor Browser’s agentic browsing capabilities. Our task definition to Anchor will be in natural language just like talking with a human friend. Then an agent from Anchor Browser will return a response with any show tickets that are heavily discounted for tonight’s showtimes.
Project Setup
Prerequisites
Before we dive into the code, you'll need:
Node.js (version 16 or higher)
A Trigger.dev account - Sign up at https://trigger.dev for their free tier
Anchor Browser API access - Get your API key from the Anchor Browser dashboard
Dependencies installation
Initialize a new Node.js project and install the required packages from Anchor Browser and Trigger.dev:
Environment configuration
Create a .env file in your project root with the following variables:
Make sure to add .env to your .gitignore file to keep your API keys secure:
Since Anchor Browser uses browser automation libraries under the hood, we need to configure Trigger.dev to handle these dependencies properly by excluding them from the build bundle.
Configure Trigger.dev's trigger.config.ts
for browser automation dependencies:
Core Monitoring Job
Create a new file within your project subfolder for trigger.dev functions, src/trigger/broadway-monitor.ts
. Below is our Broadway ticket monitor task that runs daily at 5pm ET:
How It Works
Scheduling
The cron: "0 21 * * *"
expression runs our job daily at 9pm UTC (5pm ET), perfect timing for identifying last-minute ticket releases.
Anchor Browser Integration
Instead of complex web scraping, we use Anchor Browser's agentic capabilities guided by a natural language prompt. The AI agent navigates the TDF website, understands the page structure, and extracts exactly what we need.
Because Anchor Browser's AI agent interactions are driven by browser sessions, we make sure to create and cleanup browser sessions explicitly to ensure reliable connections and prevent timeouts. This approach eliminates the connection timeout issues that can happen with implicit session management.
Smart Filtering
Our prompt specifically asks for the single cheapest show ticket available, so we get a ticket for the lowest possible price.
Error Handling
If Anchor Browser encounters issues, Trigger.dev automatically retries the job with exponential backoff.
The beauty of this approach is its simplicity. Anchor Browser handles all the complexity of:
Loading dynamic JavaScript content
Parsing different page layouts
Handling anti-bot measures
Extracting structured data from unstructured HTML
Meanwhile, Trigger.dev ensures our job runs reliably every day, even if there are temporary network issues or API timeouts.
Processing and Analysis
Smart Deal Selection with AI Prompts
The key advantage of using Anchor Browser's agentic approach is that complex filtering logic gets handled through natural language instructions rather than brittle CSS Anchor selectors or XPath expressions. Our prompt asks the AI agent to do all the heavy lifting.
Intelligent Filtering
The AI agent automatically identifies the "Broadway Shows" section and understands that these are today's available shows only.
Price Comparison
Instead of writing JavaScript to compare prices, we let the AI find the cheapest ticket directly. It handles parsing different price formats and comparing values.
Structured Output
The AI returns a single formatted string, e.g. Show: The Lion King, Price: $55, Time: 7:00 PM
with exactly the data we need, eliminating the need for additional processing steps.
Timing Logic
Since we're checking at 5pm, any shows still available will naturally be for later that evening, so no additional time filtering is needed.
Testing and Ongoing Development
Run the Trigger.dev development server from your project root directory:
This will register your new task with Trigger.dev and you'll be able to view it in your Trigger.dev dashboard.
Next, trigger a test run: In your Trigger.dev dashboard (or via CLI), you can manually trigger your Broadway monitor task to test it without waiting for the 5pm schedule.
Once the test executes, check the logs in Trigger.dev. Watch the console output from your dev server to see:
If Anchor Browser successfully connects
Whether it can navigate to the TDF website
What data it returns
Any errors in the process
Finally, verify the output from your Trigger.dev task. Your task should log something like:
Handling Edge Cases
The AI agent from Anchor Browser naturally handles scenarios that would break traditional scrapers:
No shows available: Returns appropriate message instead of failing
Website layout changes: Adapts to new page structures automatically
Sold out performances: Excludes them from results
Dynamic pricing: Captures real-time prices as they update
This approach eliminates the need for complex JavaScript logic to find the best deal. The AI agent does the comparison and selection for us, making our code simpler and easier to write.
Troubleshooting Common Issues
Automatic Retries
Both services handle failures gracefully. Trigger.dev retries failed jobs up to 3 times, while Anchor Browser includes built-in retry logic for browser navigation issues.
Anti-Bot Resilience
The AI agent from Anchor Browser naturally adapts to website changes and appears more human-like than traditional scrapers, reducing detection risk.
Network Stability
Anchor Browser maintains consistent IP addresses during sessions when Sticky IP Sessions are enabled and handles appropriate request timing, preventing issues with websites that flag suspicious behavior.
Conclusion
We've built a reliable Broadway deal hunter that runs automatically every day at 5pm, combining Trigger.dev's scheduling reliability with Anchor Browser's intelligent web automation. No more manual refreshing or missed opportunities. Just consistent monitoring that finds the best last-minute ticket deals.
Want to take this project one step further? Extend the foundation by adding email notifications when great deals are found, or integrate with Slack for group alerts.
Now you’ll never miss a Broadway deal again. Set up your monitoring job and let automation handle the ticket hunting so you simply focus on choosing whether or not to take up the last minute Broadway deal.