Copy
Ask AI
"""
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
Copy
Ask AI
# Clone and setup repo
git clone https://github.com/agno-agi/agno.git
cd agno/cookbook/91_tools/mcp
# Create and activate virtual environment
./scripts/demo_setup.sh
source .venvs/demo/bin/activate
# Export relevant API keys
export GEMINI_API_KEY="***"
export OXYLABS_PASSWORD="***"
export OXYLABS_USERNAME="***"
python oxylabs.py