Agent with GCS File Input
Pass files to Gemini straight from Google Cloud Storage with a gs:// URL and Vertex AI.
Code
"""GCS file input with Gemini.
Pass files directly from Google Cloud Storage (gs://) without downloading.
Requires Vertex AI authentication. File limits depend on the selected model.
"""
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",
)
],
)Gemini 3.5 Flash accepts PDFs of up to 50 MB through Cloud Storage. Other media have different limits; see the model specifications.
Usage
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activateSet up Vertex AI
gcloud auth application-default login
export GOOGLE_CLOUD_PROJECT="your-project-id"
export GOOGLE_CLOUD_LOCATION="global"Install dependencies
uv pip install -U google-genai agnoRun Agent
Save the code above as gcs_file_input.py, then run:
python gcs_file_input.py