You should have completed the Installation and Authentication sections before proceeding. If you haven’t, please complete them first.

How the Narada SDK Works

The Narada Python SDK provides a streamlined way to automate browser tasks using natural language commands.

Browser Management

The SDK automatically opens and manages browser windows, eliminating manual setup.
All prompts must start with /Operator to invoke the web agent.

Built-in Error Handling

The SDK includes automatic retry mechanisms and helpful error messages for common issues.

Demo: Narada SDK in Action

Watch this demonstration of the complete SDK workflow:
This video demonstrates the complete workflow from initializing the SDK, through automatic browser execution, to receiving results.

How It Works

  1. SDK Initialization - The SDK automatically handles browser setup and extension communication
  2. Browser Execution - Your automation commands are executed in the managed browser window
  3. Results - Get your automation results directly in your Python code
  4. Automatic Cleanup - The SDK manages browser windows and cleans up resources

Your First SDK Automation

Let’s start with a simple example that demonstrates the core SDK functionality:
1

Basic SDK Setup

Create a Python script with the basic SDK initialization:
import asyncio
from narada import Narada

async def main() -> None:
    # Initialize the Narada client
    async with Narada() as narada:
        # Open a new browser window and initialize the Narada UI agent
        window = await narada.open_and_initialize_browser_window()

        print("Browser window opened successfully!")
        print(f"Window ID: {window.id}")

if __name__ == "__main__":
    asyncio.run(main())
This creates a basic browser window that’s ready for automation tasks.
2

Run Your First Automation

Now let’s add a simple automation task:
import asyncio
from narada import Narada

async def main() -> None:
    async with Narada() as narada:
        window = await narada.open_and_initialize_browser_window()

        # Run a simple automation task
        response = await window.agent(
            prompt='search for "software engineering jobs" on Google and tell me how many results you find'
        )

        print("Automation completed!")
        print("Response:", response.text)

if __name__ == "__main__":
    asyncio.run(main())
The first time you run this, the SDK will guide you through any missing setup steps interactively. The SDK remembers your setup, so this only happens once.
3

Add Advanced Features

Enhance your automation with additional features:
import asyncio
from narada import Narada

async def main() -> None:
    async with Narada() as narada:
        window = await narada.open_and_initialize_browser_window()

        # Run automation with advanced features
        response = await window.agent(
            prompt='search for "software engineering jobs in Berkeley" and count how many results you find',
            # Generate a GIF to see the automation in action
            generate_gif=True,
            # Clear chat history for a fresh start
            clear_chat=True
        )

        print("Response:", response.text)
        print("GIF saved to your Downloads folder!")

if __name__ == "__main__":
    asyncio.run(main())
When generate_gif=True, the SDK automatically saves a GIF of the automation process to your Downloads folder. Read more about GIFs.

Advanced SDK Features

Structured Output with Pydantic Models

Extract structured data from your automation tasks:
import asyncio
from narada import Narada
from pydantic import BaseModel, Field

# Define your data structure
class JobSearchResult(BaseModel):
    total_jobs: int = Field(description="Total number of job listings found")
    location: str = Field(description="The location searched")
    top_company: str = Field(description="Name of the first company in results")

async def main() -> None:
    async with Narada() as narada:
        window = await narada.open_and_initialize_browser_window()

        # Use structured output to extract specific data
        response = await window.agent(
            prompt='search for "software engineering jobs in Berkeley" and extract the job count, location, and first company name',
            output_schema=JobSearchResult,
            generate_gif=True
        )

        # Access structured data
        job_data = response.structured_output
        print(f"Found {job_data.total_jobs} jobs in {job_data.location}")
        print(f"Top company: {job_data.top_company}")

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

Error Handling

The SDK includes built-in error handling, but you can add custom handling:
import asyncio
from narada import Narada, NaradaTimeoutError, NaradaInitializationError

async def main() -> None:
    try:
        async with Narada() as narada:
            window = await narada.open_and_initialize_browser_window()

            response = await window.agent(
                prompt='search for "AI research papers" and summarize the first result',
                timeout=60  # 60 second timeout
            )

            print("Response:", response.text)

    except NaradaTimeoutError:
        print("Task timed out. Try with a simpler prompt or longer timeout.")
    except NaradaInitializationError:
        print("Browser initialization failed. Check your extension setup.")
    except Exception as e:
        print(f"An error occurred: {e}")

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

Next Steps

Ready to go deeper? Explore all available parameters and advanced options for the agent method

Troubleshooting

What’s Next?

Need Help?

The SDK is designed to be intuitive and self-guiding. Don’t hesitate to experiment with different prompts and features!