Skip to main content

Overview

The Narada Python SDK supports parallel execution, allowing you to run multiple automation tasks simultaneously across different browser windows. This feature significantly improves efficiency when you need to perform multiple independent operations.
Each browser window operates independently, so you can run completely different automation tasks in parallel without interference.

Parallel Execution Example

Watch this demonstration of running multiple automation tasks simultaneously:
You can also view the complete example code on GitHub:

View Complete Example Code

See the full parallel execution example on GitHub

How It Works

Each browser window operates independently, so you can run completely different automation tasks in parallel without interference. Use Python’s asyncio.gather to run tasks concurrently:
import asyncio
from narada import Narada
from pydantic import BaseModel, Field

class CompanyInfo(BaseModel):
    name: str = Field(description="Company name")
    valuation: str = Field(description="Company valuation")

async def research_company(narada, company_name: str) -> CompanyInfo:
    """Research a single company in its own browser window."""
    window = await narada.open_and_initialize_browser_window()

    await window.go_to_url(
        url=f"https://www.google.com/search?q={company_name}+valuation",
        new_tab=True
    )

    response = await window.agent(
        prompt=f"Extract the company name and latest valuation for {company_name}",
        output_schema=CompanyInfo
    )

    return response.output.content

async def main():
    async with Narada() as narada:
        companies = ["Apple", "Google", "Microsoft", "Amazon"]

        # Run all research tasks in parallel, each gets its own browser window
        results = await asyncio.gather(*[
            research_company(narada, name) for name in companies
        ])

        for result in results:
            print(f"{result.name}: {result.valuation}")

if __name__ == "__main__":
    asyncio.run(main())
Each call to open_and_initialize_browser_window() creates a new, independent browser window. You can also use Cloud Browser Sessions for parallel cloud-based execution without local Chrome.

Next Steps

Error Handling

Learn advanced error handling and retry mechanisms

Structured Output

Extract structured data from your parallel automation tasks

Action Trace

Capture automation workflows across multiple browser windows

Getting Started

Return to the getting started guide for basic SDK usage
Start with simple parallel tasks and gradually increase complexity as you become comfortable with the patterns.