← All work
Capability · 2025

AI Agent for Automated Web Workflows (Mastra + Vercel AI SDK + Stagehand)

A leading electronic-music marketplace

Overview

An AI agent system (internally named “brain”) that automates complex web workflows for an electronic-music marketplace using the Mastra agent framework, the Vercel AI SDK and Stagehand for LLM-driven browser control. It generates and runs large batches of scripted user journeys against web interfaces with memory, persistence and reporting.

The Challenge

Exercising and operating marketplace web flows at scale, registration, purchasing, card/billing, song-buy verification, is impractical by hand. The goal was an LLM agent that can understand pages, take actions, and orchestrate thousands of structured tasks reliably.

What We Built

A TypeScript agent platform combining:

  • Mastra (@mastra/core, memory, libsql, loggers) for agent definition, memory and a LibSQL-backed store (mastra.db).
  • The Vercel AI SDK (ai, @ai-sdk/openai) plus a custom OpenAI client (llm_clients/aisdk_client.ts, customOpenAI_client.ts) for model access.
  • Stagehand (@browserbasehq/stagehand) over Browserbase and Playwright for LLM-guided browser automation with DOM-path utilities.
  • A large set of task generators, create-users, create-users-buy, create-users-card, create-users-billing, create-users-check-song-buy, create-registration-check-tasks, enrich-users, extract-logs, create_csv_report, driving and reporting on batch workflows, with @faker-js/faker and us-states-normalize for realistic data.
  • Firebase Cloud Functions (functions/) and Firestore for backend coordination, plus BentoCache and Docker packaging.

Technologies & Approach

Mastra provides agent structure and durable memory; the Vercel AI SDK abstracts the LLM layer; Stagehand+Browserbase let the agent operate real browsers via natural-language intents instead of brittle selectors. CSV-driven generators and reporting make large batch runs reproducible and auditable.

Outcome / Impact

Delivered a working AI agent capable of orchestrating large-scale, LLM-driven web automation with persistent memory and structured reporting, demonstrating modern agent tooling (Mastra + AI SDK + Stagehand) applied to real marketplace workflows.

Capabilities Demonstrated

  • Building LLM agents with the Mastra framework and Vercel AI SDK
  • AI-driven browser automation via Stagehand and Browserbase
  • Designing batch task-generation and reporting pipelines with persistent agent memory
  • Integrating agents with Firebase/Firestore backends
More work See all →