|
| 1 | +from os import getenv |
| 2 | + |
| 3 | +from agno.agent import Agent |
| 4 | +from agno.tools.browserbase import BrowserbaseTools |
| 5 | + |
| 6 | +# Browserbase Configuration |
| 7 | +# ------------------------------- |
| 8 | +# These environment variables are required for the BrowserbaseTools to function properly. |
| 9 | +# You can set them in your .env file or export them directly in your terminal. |
| 10 | + |
| 11 | +# BROWSERBASE_API_KEY: Your API key from Browserbase dashboard |
| 12 | +# - Required for authentication |
| 13 | +# - Format: Starts with "bb_live_" or "bb_test_" followed by a unique string |
| 14 | + |
| 15 | +# BROWSERBASE_PROJECT_ID: The project ID from your Browserbase dashboard |
| 16 | +# - Required to identify which project to use for browser sessions |
| 17 | +# - Format: UUID string (8-4-4-4-12 format) |
| 18 | + |
| 19 | +# BROWSERBASE_BASE_URL: The Browserbase API endpoint |
| 20 | +# - Optional: Defaults to https://api.browserbase.com if not specified |
| 21 | +# - Only change this if you're using a custom API endpoint or proxy |
| 22 | + |
| 23 | +agent = Agent( |
| 24 | + name="Web Automation Assistant", |
| 25 | + tools=[BrowserbaseTools()], |
| 26 | + instructions=[ |
| 27 | + "You are a web automation assistant that can help with:", |
| 28 | + "1. Capturing screenshots of websites", |
| 29 | + "2. Extracting content from web pages", |
| 30 | + "3. Monitoring website changes", |
| 31 | + "4. Taking visual snapshots of responsive layouts", |
| 32 | + "5. Automated web testing and verification", |
| 33 | + ], |
| 34 | + show_tool_calls=True, |
| 35 | + markdown=True, |
| 36 | + debug_mode=True, |
| 37 | +) |
| 38 | + |
| 39 | +# Content Extraction and SS |
| 40 | +# agent.print_response(""" |
| 41 | +# Go to https://news.ycombinator.com and extract: |
| 42 | +# 1. The page title |
| 43 | +# 2. Take a screenshot of the top stories section |
| 44 | +# """) |
| 45 | + |
| 46 | +agent.print_response(""" |
| 47 | + Visit https://quotes.toscrape.com and: |
| 48 | + 1. Extract the first 5 quotes and their authors |
| 49 | + 2. Navigate to page 2 |
| 50 | + 3. Extract the first 5 quotes from page 2 |
| 51 | +""") |
0 commit comments