Spaces:
Build error
Build error
| from playwright.async_api import async_playwright | |
| from src.infrastructure.tools.registry import tool_registry | |
| async def browser_navigate(url: str) -> str: | |
| """Navigate to a URL and return the page content""" | |
| async with async_playwright() as p: | |
| browser = await p.chromium.launch(headless=True) | |
| page = await browser.new_page() | |
| await page.goto(url) | |
| content = await page.content() | |
| await browser.close() | |
| return content[:2000] # Return first 2000 chars for now | |
| tool_registry.register( | |
| name="browser_navigate", | |
| description="Navigate to a website and get its content", | |
| parameters={ | |
| "type": "OBJECT", | |
| "properties": { | |
| "url": {"type": "STRING", "description": "The URL to navigate to"} | |
| }, | |
| "required": ["url"] | |
| }, | |
| func=browser_navigate | |
| ) | |