> ## Documentation Index
> Fetch the complete documentation index at: https://docs.narada.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Parallel Execution

> Run multiple automation tasks simultaneously with the Narada Python SDK

## 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.

<Info>
  Each browser window operates independently, so you can run completely
  different automation tasks in parallel without interference.
</Info>

## Parallel Execution Example

Watch this demonstration of running multiple automation tasks simultaneously:

<Frame>
  <iframe
    width="100%"
    height="400px"
    src="https://www.youtube.com/embed/bpy-xnSeboY"
    title="Parallel Execution Demo"
    frameBorder="0"
    allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
    allowFullScreen
    style={{
  width: "100%",
  minHeight: "400px",
  borderRadius: "0.5rem",
}}
  />
</Frame>

<Tip>
  You can also view the complete example code on GitHub:
</Tip>

<Card title="View Complete Example Code" icon="github" href="https://github.com/NaradaAI/narada-python-sdk/blob/main/examples/multiple_windows.py">
  See the full parallel execution example on GitHub
</Card>

## 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:

```python theme={null}
import asyncio
from narada import Agent, BrowserEnvironment
from pydantic import BaseModel, Field

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

async def research_company(company_name: str) -> CompanyInfo:
    """Research a single company in its own browser environment."""
    env = BrowserEnvironment()
    agent = Agent(environment=env)

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

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

        result = response.structured_output
        assert result is not None
        return result
    finally:
        await env.close()

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

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

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

if __name__ == "__main__":
    asyncio.run(main())
```

<Note>
  Each `BrowserEnvironment()` creates an independent browser target. You can also use [Cloud Browser Sessions](/documentation/cloud-browser-sessions) for parallel cloud-based execution without local Chrome.
</Note>
