Skip to main content
This tutorial builds a provider search tool for Grow Therapy — a therapy marketplace that handles insurance credentialing for providers. We combine structured output with deterministic rerun to build a fast, repeatable search pipeline.

What you’ll build

A script that:
  1. Searches Grow Therapy’s provider directory with filters (location, insurance, specialty)
  2. Extracts therapist profiles with ratings and availability
  3. Caches the search so you can sweep across geographies or specialties instantly

Setup

import asyncio
import json
from pydantic import BaseModel
from browser_use_sdk.v3 import AsyncBrowserUse

client = AsyncBrowserUse()

1. Define the output schema

class Provider(BaseModel):
    name: str
    title: str
    specialties: list[str]
    insurance_plans: list[str]
    rating: float | None = None
    next_available: str | None = None

class ProviderSearch(BaseModel):
    providers: list[Provider]
    total_found: int | None = None
    location: str
    specialty: str

2. Create a workspace

workspace = await client.workspaces.create(name="grow-therapy-search")

3. Search for providers

result = await client.run(
    "Go to growtherapy.com and search for therapists in {{New York}} "
    "who specialize in {{anxiety}} and accept insurance. "
    "Return the first 5 provider profiles as JSON.",
    workspace_id=str(workspace.id),
    output_schema=ProviderSearch,
)

for p in result.output.providers:
    print(f"{p.name} ({p.title})")
    print(f"  Specialties: {', '.join(p.specialties)}")
    print(f"  Rating: {p.rating}")
    print(f"  Next available: {p.next_available}")
    print()

4. Sweep across locations and specialties

After the first run caches the search flow, sweep across different parameters at $0 LLM cost:
locations = ["Los Angeles", "Chicago", "Houston", "Miami"]
specialties = ["depression", "trauma", "ADHD"]

for location in locations:
    for specialty in specialties:
        result = await client.run(
            f"Go to growtherapy.com and search for therapists in {{{{{location}}}}} "
            f"who specialize in {{{{{specialty}}}}} and accept insurance. "
            f"Return the first 5 provider profiles as JSON.",
            workspace_id=str(workspace.id),
            output_schema=ProviderSearch,
        )
        count = len(result.output.providers)
        print(f"{location} / {specialty}: {count} providers found")

Summary

StepWhat happensCost
First searchAgent navigates Grow Therapy, caches the flow~$0.10
12 cached sweeps (4 cities x 3 specialties)Script reruns with new params$0 LLM each
Site layout changeAuto-healing regenerates the script~$0.10
Therapy platforms have dynamic UIs that can change frequently. Auto-healing ensures your cached scripts stay working without manual maintenance.

Next steps

  • Structured output — Learn more about extracting typed data with Pydantic and Zod schemas.
  • Human in the loop — Let a human review or interact with the browser mid-task, useful for auth flows or approving results before continuing.
  • Deterministic rerun — Deep dive into how caching and auto-healing work.