Skip to content

Usage

Minimal Example: Script Mode

The simplest usage is a with block. Nova Act opens Chrome, performs the task, and closes Chrome when the block exits.

python
from nova_act import NovaAct

with NovaAct(starting_page="https://nova.amazon.com/act/gym/next-dot/search") as nova:
    nova.act("Find flights from Boston to Wolf on Feb 22nd")

The SDK prints console log messages describing each step it takes in the browser.

Interactive / REPL Mode

Good for exploring and debugging. Open Python interactively and drive the browser step by step:

python
from nova_act import NovaAct

nova = NovaAct(starting_page="https://amazon.com")
nova.start()

nova.act("Search for wireless headphones")
nova.act("Click on the first result")
nova.act("Add it to the cart")

nova.stop()

Press Ctrl+X during an act() call to interrupt the agent and leave the browser open for further commands. Ctrl+C exits the browser entirely.

Structured Data Extraction

Use act_get with a Pydantic schema to extract typed data from any page:

python
from nova_act import NovaAct
from pydantic import BaseModel

class ProductInfo(BaseModel):
    name: str
    price: str
    rating: str

with NovaAct(starting_page="https://amazon.com/dp/B08N5WRWNW") as nova:
    result = nova.act_get(
        "Extract the product name, price, and customer rating",
        response_model=ProductInfo
    )
    print(result.response)
    # ProductInfo(name='Echo Dot (4th Gen)', price='$49.99', rating='4.7 out of 5 stars')

act_get always returns a structured response. Always use a schema when you need a typed value -- even a simple boolean.

Async Mode (Parallel Sessions)

Run multiple browser sessions concurrently using asyncio:

python
import asyncio
from nova_act.asyncio import NovaAct

async def check_price(product_url: str) -> str:
    async with NovaAct(starting_page=product_url) as nova:
        result = await nova.act_get("What is the current price?")
        return result.response

async def main():
    urls = [
        "https://amazon.com/dp/B08N5WRWNW",
        "https://amazon.com/dp/B09B8YWXDF",
    ]
    prices = await asyncio.gather(*[check_price(url) for url in urls])
    for url, price in zip(urls, prices):
        print(f"{url}: {price}")

asyncio.run(main())

Each parallel session is billed separately at $4.75 per agent hour.

Environment Variable Reference

VariablePurpose
NOVA_ACT_API_KEYAPI key for nova.amazon.com authentication
NOVA_ACT_SKIP_PLAYWRIGHT_INSTALLSet to any value to skip automatic Playwright browser install on first run

Key Constructor Parameters (NovaAct)

ParameterTypeDescription
starting_pagestrURL to open when the session starts
headlessboolRun browser without a visible window (default varies)
proxystrProxy server URL for all browser traffic
user_agentstrCustom browser user agent string

See the SDK README for the full parameter reference.