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

# How to Download Files

> Learn how to download files and documents using the Narada Python SDK

## Download Files with Narada SDK

The Narada Python SDK makes it easy to download files and documents during automation tasks. When you ask Narada to download content, it automatically saves files to your local Downloads folder with an organized directory structure.

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

## How to Download Files with the SDK

<Steps>
  <Step title="Basic File Download">
    Use the SDK to download files with a simple command:

    ```python theme={null}
    import asyncio

    from narada import Agent, BrowserEnvironment

    async def main() -> None:
        env = BrowserEnvironment()
        agent = Agent(environment=env)

        try:
            # Download the current page
            response = await agent.run(
                prompt='download the current page'
            )

            print("Download completed!")
            print("Response:", response.text)
        finally:
            await env.close()

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

    <Note>
      The SDK automatically handles file organization and download management for you.
    </Note>
  </Step>

  <Step title="Download with GIF Recording">
    Optionally record the download process as a GIF for debugging:

    ```python highlight={11} theme={null}
    import asyncio

    from narada import Agent, BrowserEnvironment

    async def main() -> None:
        env = BrowserEnvironment()
        agent = Agent(environment=env)

        try:
            # Download with GIF recording
            response = await agent.run(
                prompt='navigate to the research paper and download the PDF',
                generate_gif=True  # Record the download process
            )

            print("Download completed with GIF recording!")
            print("Response:", response.text)
        finally:
            await env.close()

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

    <Check>
      The GIF recording helps you see exactly how the download process worked.
    </Check>
  </Step>

  <Step title="Automatic Directory Creation">
    Narada automatically creates a directory structure for your downloads:

    1. **Main Directory**: `Narada Downloads` in your machine's Downloads folder
    2. **Request Directory**: Directory named after your `request_id` from the [SDK response](/documentation/getting-started-with-sdk)
    3. **File**: Downloaded content saved as a `.pdf` file

    <Check>
      If the `Narada Downloads` directory doesn't exist, it will be created automatically.
    </Check>
  </Step>

  <Step title="Find Your Downloaded File">
    Navigate to your Downloads folder and look for:

    ```
    Downloads/
    └── Narada Downloads/
        └── req_abc123def456/
            └── downloaded_page.pdf
    ```

    Each download request gets its own directory named after the `request_id` for easy correlation with your SDK calls.
  </Step>
</Steps>

## Download Organization

<CardGroup cols={2}>
  <Card title="PDF Format" icon="file-pdf">
    All downloaded pages and documents are saved as PDF files for universal
    compatibility.
  </Card>

  <Card title="Request Correlation" icon="folder">
    Each download directory is named after the `request_id` from the [SDK response](/documentation/getting-started-with-sdk), allowing you to easily track which SDK request generated which files.
  </Card>

  <Card title="Automatic Naming" icon="tag">
    Files are automatically named based on the page title or content type.
  </Card>
</CardGroup>

## Example Use Cases

* **Research**: Download academic papers or articles for offline reading
* **Documentation**: Save important web pages for reference
* **Archiving**: Create local copies of web content for backup
* **Processing**: Download files for further automated processing

<Tip>
  You can download any page that's currently visible in your browser. Just make
  sure the page has fully loaded before sending the download command.
</Tip>
