Ollama Cloud

Run an Agno agent against Ollama Cloud's hosted gpt-oss:120b model and stream the response.

Code

from agno.agent import Agent
from agno.models.ollama import Ollama

agent = Agent(
    model=Ollama(id="gpt-oss:120b"),
)

agent.print_response("What is the capital of France?", stream=True)

Usage

Set up your virtual environment

uv venv --python 3.12
source .venv/bin/activate

Set up Ollama Cloud API Key

Sign up at ollama.com and get your API key, then export it:

export OLLAMA_API_KEY=your_api_key_here

Install dependencies

uv pip install -U ollama agno

Run Agent

Save the code above as ollama_cloud.py, then run:

python ollama_cloud.py

Key Features

  • No local setup required: Models run on Ollama's hosted infrastructure.
  • Automatic configuration: When api_key is set, the host defaults to https://ollama.com.
  • Model selection: See available cloud models in the Ollama library.