Code
gcs_file_input.py
Usage
1
Set up your virtual environment
2
Set up Vertex AI
3
Install dependencies
4
Run Agent
Save the code above as
gcs_file_input.py, then run:Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Pass files to Gemini straight from Google Cloud Storage with a gs:// URL and Vertex AI.
"""GCS file input with Gemini.
Pass files directly from Google Cloud Storage (gs://) without downloading.
Supports files up to 2GB. Requires Vertex AI authentication.
"""
from agno.agent import Agent
from agno.media import File
from agno.models.google import Gemini
agent = Agent(
model=Gemini(
id="gemini-3.5-flash",
vertexai=True,
),
markdown=True,
)
agent.print_response(
"Summarize this document and extract key insights.",
files=[
File(
url="gs://cloud-samples-data/generative-ai/pdf/2312.11805v3.pdf",
mime_type="application/pdf",
)
],
)
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activate
uv venv --python 3.12
.venv\Scripts\activate
Set up Vertex AI
gcloud auth application-default login
export GOOGLE_CLOUD_PROJECT="your-project-id"
export GOOGLE_CLOUD_LOCATION="us-central1"
Install dependencies
uv pip install -U google-genai agno
Run Agent
gcs_file_input.py, then run:python gcs_file_input.py
Was this page helpful?