Skip to content

nikoidm123/Colab-Agent-Bridge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Colab Agent Bridge

A Chrome extension and local Python server bridge that allows remote reading, writing, and execution of Google Colab notebook cells directly from your local machine or an AI Agent.

Features

  • Read Cells: Extract code from any cell in the Colab notebook.
  • Write Cells: Inject code into specific cells.
  • Run Cells: Trigger execution of specific cells remotely.
  • Local Server Bridge: Uses a lightweight Python HTTP server to queue commands and receive results from the Chrome extension.
  • Bypasses API Limitations: Works directly through the browser's DOM and Monaco Editor, requiring no official API access.

Architecture

  1. Python Server (server.py): Acts as a command queue. AI Agents or local scripts send HTTP POST requests (/command) to enqueue actions.
  2. Chrome Extension (main-world.js): Runs in the context of the Colab page. It polls the local server for commands, executes them using the Colab UI and Monaco Editor instances, and sends the results back via HTTP POST (/result).

Installation

1. Load the Chrome Extension

  1. Open Google Chrome and go to chrome://extensions/.
  2. Enable Developer mode (toggle in the top right corner).
  3. Click Load unpacked and select the colab-extension folder.

2. Start the Local Server

Run the Python bridge server locally:

python server.py

The server will start on http://localhost:8765.

3. Open Google Colab

Open any Google Colab notebook in your browser. The extension will automatically connect to the local server.

Usage (API)

Send commands to the local server using HTTP POST requests.

Send a Command

import requests

payload = {
    "action": "run_cell", # Available actions: 'read_cell', 'write_cell', 'run_cell'
    "index": 0,           # Cell index (0-based)
    "code": "print('Hello from Agent!')" # Required only for 'write_cell'
}

requests.post("http://localhost:8765/command", json=payload)

Disclaimer

This tool is intended for educational purposes and personal automation. It relies on the DOM structure of Google Colab, which may change over time.

License

MIT License

About

Ekstensi Chrome cerdas yang berfungsi sebagai jembatan remote. Memungkinkan AI Agent atau skrip lokal untuk membaca, menulis, dan mengeksekusi sel Google Colab secara otomatis tanpa API resmi.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages