oxylabs.py
"""
Oxylabs
=============================
Demonstrates oxylabs.
"""
import asyncio
import os
from agno.agent import Agent
from agno.models.google import Gemini
from agno.tools.mcp import MCPTools
# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------
async def run_agent_prompt():
async with MCPTools(
command="uvx oxylabs-mcp",
env={
"OXYLABS_USERNAME": os.getenv("OXYLABS_USERNAME"),
"OXYLABS_PASSWORD": os.getenv("OXYLABS_PASSWORD"),
},
) as server:
agent = Agent(
model=Gemini(api_key=os.getenv("GEMINI_API_KEY")),
tools=[server],
instructions=["Use MCP tools to fulfill the requests"],
markdown=True,
)
await agent.aprint_response(
"Go to oxylabs.io, look for career page, "
"go to it and return all job titles in markdown format. "
"Don't invent URLs, start from one provided."
)
# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
asyncio.run(run_agent_prompt())
Run the Example
1
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activate
uv venv --python 3.12
.venv\Scripts\activate
2
Install dependencies
uv pip install -U "agno[mcp]" google-genai
3
Prepare uvx
Install uv, then verify
uvx is available:uvx --version
4
Export environment variables
export GEMINI_API_KEY="your_gemini_api_key_here"
export OXYLABS_PASSWORD="your_oxylabs_password_here"
export OXYLABS_USERNAME="your_oxylabs_username_here"
$Env:GEMINI_API_KEY="your_gemini_api_key_here"
$Env:OXYLABS_PASSWORD="your_oxylabs_password_here"
$Env:OXYLABS_USERNAME="your_oxylabs_username_here"
5
Run the example
Save the code above as
oxylabs.py, then run:python oxylabs.py