An intelligent website analysis tool built with OpenAI Agents SDK and GPT-5 vision that captures website screenshots and provides concise two-sentence summaries of web pages.
- πΌοΈ Automated Screenshot Capture: Uses Playwright with headless Chromium
- π€ GPT-5 Vision Analysis: Leverages OpenAI's latest vision model for intelligent page analysis
- π― Focused Output: Exactly two sentences summarizing page purpose and key elements
- π§ Modular Architecture: Clean separation of tools, agents, and configuration
- π Cookie Consent Handling: Optional automatic consent button clicking
- βοΈ Configurable: Customizable viewport sizes, wait conditions, and timeouts
agent_tool/
βββ src/
β βββ agents/
β β βββ website_analyzer.py # Main agent implementation
β βββ tools/
β β βββ screenshot.py # Playwright screenshot tool
β βββ config/
β β βββ settings.py # Configuration management
β βββ cli.py # CLI utilities
βββ tests/
βββ main.py # Entry point
βββ requirements.txt # Dependencies
βββ .env.example # Environment template
βββ .env # Your configuration
cd agent_tool
pip install -r requirements.txtplaywright install chromiumCopy the example environment file and add your OpenAI API key:
cp .env.example .envEdit .env and set your OpenAI API key:
OPENAI_API_KEY=your_openai_api_key_herepython main.py --validate-configpython main.pyExample interaction:
π Website Analyzer Agent
========================================
Powered by OpenAI Agents SDK + GPT-5 Vision
Ready to analyze websites! π
Type 'help' for available commands.
You: Analyze https://stripe.com
π Analyzing...
π Stripe is a financial technology platform that enables businesses to accept online payments with a clean, professional design featuring their iconic purple gradient and clear "Start now" call-to-action. The homepage emphasizes trust and simplicity with prominent customer logos, straightforward pricing information, and a streamlined navigation focused on getting started quickly.
python main.py --query "Analyze https://example.com"help- Show available commandsconfig- Display current configurationquit/exit- Exit the application
Edit .env to customize behavior:
# OpenAI Configuration
OPENAI_API_KEY=your_key_here
MODEL_NAME=gpt-5
# Screenshot Settings
DEFAULT_VIEWPORT_WIDTH=1280
DEFAULT_VIEWPORT_HEIGHT=800
DEFAULT_WAIT_UNTIL=networkidle
SCREENSHOT_TIMEOUT=30000
# Agent Settings
MAX_TURNS=3
VERBOSITY=low
REASONING_EFFORT=minimalThe agent automatically handles screenshot capture, but you can provide hints in your queries:
"Analyze https://example.com and wait for the main content to load"
"Take a full page screenshot of https://news-site.com"
For sites with cookie banners, you can mention it in your query:
"Analyze https://eu-website.com and handle cookie consent"
You can also use the components programmatically:
import asyncio
from src.agents.website_analyzer import WebsiteAnalyzerAgent
async def main():
agent = WebsiteAnalyzerAgent()
result = await agent.analyze_website("Analyze https://example.com")
print(result)
asyncio.run(main())pytest tests/src/tools/screenshot.py: Playwright-based screenshot capture with async/sync wrapperssrc/agents/website_analyzer.py: OpenAI Agents SDK agent with GPT-5 and custom toolssrc/config/settings.py: Environment-based configuration managementsrc/cli.py: Interactive command-line interface utilitiesmain.py: Application entry point with argument parsing
- Modular Architecture: Separate tools, agents, and configuration for maintainability
- Async/Sync Bridge: Playwright is async, but Agents SDK requires sync functions
- Temporary Files: Screenshots saved to temp files for GPT-5 vision input
- Error Handling: Graceful failures with two-sentence error messages
- Configuration: Environment-based settings for easy deployment
-
"Configuration error: OPENAI_API_KEY is required"
- Set your API key in the
.envfile
- Set your API key in the
-
"Screenshot capture failed: Navigation timeout"
- Increase
SCREENSHOT_TIMEOUTin.env - Site may be blocking automated access
- Increase
-
"Failed to initialize agent"
- Verify OpenAI API key has sufficient credits
- Check if
gpt-5model is available in your region
-
Playwright installation issues
- Run
playwright install chromium - On Linux: install additional dependencies with
playwright install-deps
- Run
Set environment variable for detailed logging:
export DEBUG=1
python main.py- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
MIT License - see LICENSE file for details.
- Built with OpenAI Agents SDK
- Powered by GPT-5
- Screenshot capture via Playwright