oss_gpt.py
Run the Example
1
Set up your virtual environment
2
Install dependencies
3
Export your Cerebras OpenAI-compatible API key
4
Run the example
Save the code above as
oss_gpt.py, then run:Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Use gpt-oss-120b on the Cerebras OpenAI-compatible endpoint with WebSearchTools.
"""
Cerebras Openai Oss Gpt
=======================
Cookbook example for `cerebras_openai/oss_gpt.py`.
"""
from agno.agent.agent import Agent
from agno.models.cerebras.cerebras_openai import CerebrasOpenAI
from agno.tools.websearch import WebSearchTools
# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------
agent = Agent(
model=CerebrasOpenAI(
id="gpt-oss-120b",
),
tools=[WebSearchTools()],
markdown=True,
)
# Print the response in the terminal
agent.print_response("Whats happening in France?")
# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
pass
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activate
uv venv --python 3.12
.venv\Scripts\activate
Install dependencies
uv pip install -U agno cerebras-cloud-sdk ddgs openai
Export your Cerebras OpenAI-compatible API key
export CEREBRAS_API_KEY="your_cerebras_api_key_here"
$Env:CEREBRAS_API_KEY="your_cerebras_api_key_here"
Run the example
oss_gpt.py, then run:python oss_gpt.py
Was this page helpful?