|
| 1 | +--- |
| 2 | +title: "Notte" |
| 3 | +--- |
| 4 | + |
| 5 | +[Notte](https://www.notte.cc/) is an AI agent framework that enables you to build sophisticated browser automation tasks. By integrating with Kernel, you can run Notte agents with cloud-hosted browsers using Chrome DevTools Protocol (CDP). |
| 6 | + |
| 7 | +## Adding Kernel to existing Notte implementations |
| 8 | + |
| 9 | +If you already have a Notte implementation, you can easily switch to using Kernel's cloud browsers by connecting via CDP. |
| 10 | + |
| 11 | +### 1. Install the Kernel SDK |
| 12 | + |
| 13 | +```bash |
| 14 | +uv pip install kernel |
| 15 | +``` |
| 16 | + |
| 17 | +### 2. Initialize Kernel and create a browser |
| 18 | + |
| 19 | +Import the libraries and create a cloud browser session: |
| 20 | + |
| 21 | +```python |
| 22 | +from kernel import Kernel |
| 23 | +from notte_sdk import NotteClient |
| 24 | + |
| 25 | +# Initialize clients |
| 26 | +kernel_client = Kernel(api_key="your-kernel-api-key") |
| 27 | +notte_client = NotteClient(api_key="your-notte-api-key") |
| 28 | + |
| 29 | +# Create a browser on Kernel |
| 30 | +kernel_browser = kernel_client.browsers.create() |
| 31 | +``` |
| 32 | + |
| 33 | +### 3. Connect Notte to Kernel's CDP endpoint |
| 34 | + |
| 35 | +Use Kernel's CDP URL to create a Notte session: |
| 36 | + |
| 37 | +```python |
| 38 | +# Connect Notte to Kernel's browser via CDP |
| 39 | +with notte_client.Session(cdp_url=kernel_browser.cdp_ws_url) as session: |
| 40 | + # Create an agent with a task |
| 41 | + agent = notte_client.Agent(session=session, max_steps=10) |
| 42 | + |
| 43 | + # Run your automation task |
| 44 | + result = agent.run( |
| 45 | + task="extract pricing plans from https://www.notte.cc" |
| 46 | + ) |
| 47 | +``` |
| 48 | + |
| 49 | +### 4. Clean up the browser session |
| 50 | + |
| 51 | +After your automation completes, clean up the Kernel browser: |
| 52 | + |
| 53 | +```python |
| 54 | +kernel_client.browsers.delete_by_id(kernel_browser.session_id) |
| 55 | +``` |
| 56 | + |
| 57 | +## Complete example script |
| 58 | + |
| 59 | +Here's a complete, runnable script that demonstrates the full integration: |
| 60 | + |
| 61 | +```python |
| 62 | +from kernel import Kernel |
| 63 | +from notte_sdk import NotteClient |
| 64 | +import os |
| 65 | +from dotenv import load_dotenv |
| 66 | + |
| 67 | +# Load environment variables from .env file |
| 68 | +load_dotenv() |
| 69 | + |
| 70 | +def main(): |
| 71 | + # Initialize clients |
| 72 | + kernel_api_key = os.getenv("KERNEL_API_KEY") |
| 73 | + notte_api_key = os.getenv("NOTTE_API_KEY") |
| 74 | + |
| 75 | + if not kernel_api_key: |
| 76 | + raise ValueError("KERNEL_API_KEY not found in environment variables") |
| 77 | + if not notte_api_key: |
| 78 | + raise ValueError("NOTTE_API_KEY not found in environment variables") |
| 79 | + |
| 80 | + kernel_client = Kernel(api_key=kernel_api_key) |
| 81 | + notte_client = NotteClient(api_key=notte_api_key) |
| 82 | + |
| 83 | + # Create a headful browser on Kernel |
| 84 | + print("Creating browser session on Kernel...") |
| 85 | + kernel_browser = kernel_client.browsers.create() |
| 86 | + # print(kernel_browser.browser_live_view_url) |
| 87 | + |
| 88 | + try: |
| 89 | + # Connect Notte to Kernel's browser via CDP |
| 90 | + print("Connecting Notte to Kernel browser...") |
| 91 | + with notte_client.Session(cdp_url=kernel_browser.cdp_ws_url) as session: |
| 92 | + # Create an agent with a task |
| 93 | + agent = notte_client.Agent(session=session, max_steps=10) |
| 94 | + |
| 95 | + # Run your automation task |
| 96 | + result = agent.run( |
| 97 | + task="extract pricing plans from https://www.notte.cc" |
| 98 | + ) |
| 99 | + |
| 100 | + print(f"Task completed: {result.answer}") |
| 101 | + |
| 102 | + except Exception as e: |
| 103 | + print(f"Error during automation: {e}") |
| 104 | + |
| 105 | + finally: |
| 106 | + # Always clean up the browser session |
| 107 | + kernel_client.browsers.delete_by_id(kernel_browser.session_id) |
| 108 | + print("Browser session cleaned up") |
| 109 | + |
| 110 | +if __name__ == "__main__": |
| 111 | + main() |
| 112 | +``` |
| 113 | + |
| 114 | +## Benefits of using Kernel with Notte |
| 115 | + |
| 116 | +- **No local browser management**: Run agents without installing or maintaining browsers locally |
| 117 | +- **Scalability**: Launch multiple browser sessions in parallel for concurrent tasks |
| 118 | +- **Cloud infrastructure**: Leverage Kernel's optimized browser infrastructure |
| 119 | +- **Stealth mode**: Built-in anti-detection features for web scraping |
| 120 | +- **Session control**: Programmatic control over browser lifecycle |
| 121 | + |
| 122 | +## Next steps |
| 123 | + |
| 124 | +- Learn about [creating browsers](/browsers/create-a-browser) on Kernel |
| 125 | +- Check out [live view](/browsers/live-view) for debugging your automations |
| 126 | +- Learn about [stealth mode](/browsers/stealth) for avoiding detection |
| 127 | +- Explore [session persistence](/browsers/persistence) for maintaining browser state |
0 commit comments