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

# GCS File Input

> Summarize a PDF straight from a Google Cloud Storage gs:// URI using Gemini on Vertex AI, with no download or re-upload.

<Warning>
  For `gemini-3.5-flash` on Vertex AI, current limits are 50 MB for PDF input through the API or Cloud Storage, 7 MB for `text/plain`, and 30 MB for Cloud Storage image input. See [Gemini 3.5 Flash model limits](https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/gemini/3-5-flash). This example's blanket 2 GB limit and additional MIME-type claims are stale.
</Warning>

```python gcs_file_input.py theme={null}
"""
Example: Analyze files directly from Google Cloud Storage (GCS).

The Gemini API now supports GCS URIs natively (up to 2GB).
No need to download or re-upload - just pass the gs:// URI directly.

Requirements:
- Vertex AI must be enabled (GCS URIs require OAuth, not API keys)
- Run: gcloud auth application-default login
- Set environment variables: GOOGLE_CLOUD_PROJECT, GOOGLE_CLOUD_LOCATION
- Your GCS bucket must be accessible to your credentials

Supported formats: PDF, JSON, HTML, CSS, XML, images (PNG, JPEG, WebP, GIF)
"""

from agno.agent import Agent
from agno.media import File
from agno.models.google import Gemini

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------

# GCS requires Vertex AI (OAuth credentials), not API keys
# Set GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION env vars
agent = Agent(
    model=Gemini(
        id="gemini-3.5-flash",
        vertexai=True,
    ),
    markdown=True,
)

# Pass GCS URI directly - no download or re-upload needed
agent.print_response(
    "Summarize this document and extract key insights.",
    files=[
        File(
            url="gs://cloud-samples-data/generative-ai/pdf/2312.11805v3.pdf",  # Sample PDF
            mime_type="application/pdf",
        )
    ],
)

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------

if __name__ == "__main__":
    pass
```

## Run the Example

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U agno google-genai
    ```
  </Step>

  <Step title="Export environment variables">
    <CodeGroup>
      ```bash Mac/Linux theme={null}
      export GOOGLE_CLOUD_LOCATION="your_google_cloud_location_here"
      export GOOGLE_CLOUD_PROJECT="your_google_cloud_project_here"
      ```

      ```bash Windows theme={null}
      $Env:GOOGLE_CLOUD_LOCATION="your_google_cloud_location_here"
      $Env:GOOGLE_CLOUD_PROJECT="your_google_cloud_project_here"
      ```
    </CodeGroup>
  </Step>

  <Step title="Authenticate with Google Cloud">
    Sign in with Application Default Credentials:

    ```bash theme={null}
    gcloud auth application-default login
    ```
  </Step>

  <Step title="Run the example">
    Save the code above as `gcs_file_input.py`, then run:

    ```bash theme={null}
    python gcs_file_input.py
    ```
  </Step>
</Steps>

Full source: [cookbook/90\_models/google/gemini/gcs\_file\_input.py](https://github.com/agno-agi/agno/blob/main/cookbook/90_models/google/gemini/gcs_file_input.py)
