π The AI-native web automation engine β parse, understand, and act on any website with agent-friendly data.
Traditional automation tools like Playwright and Selenium are great at clicking buttons β but terrible at helping AI agents understand the meaning of web pages.
CeSail changes that:
Think of it as the missing bridge between the messy web and intelligent AI workflows.
Hereβs CeSail + Cursor MCP in action, searching flights on Expedia:
The easiest way to get started with CeSail is to install it from PyPI:
# Install CeSail
pip install cesail
# Install Playwright browsers
playwright install
Hereβs a quick example that demonstrates CeSailβs core functionality:
import asyncio
from cesail import DOMParser, Action, ActionType
async def quick_demo():
"""Quick demonstration of CeSail's web automation capabilities."""
async with DOMParser(headless=False) as parser:
# Navigate to a website
action = Action(
type=ActionType.NAVIGATE,
metadata={"url": "https://www.example.com"}
)
await parser._action_executor.execute_action(action)
# Analyze the page and get structured data
parsed_page = await parser.analyze_page()
print(f"Found {len(parsed_page.important_elements.elements)} interactive elements")
# Take a screenshot with overlays
await parser.take_screenshot("demo_screenshot.png")
# Show available actions
print("Available actions:")
for element in parsed_page.important_elements.elements[:3]:
print(f" - {element.type}: {element.text}")
# Run the demo
asyncio.run(quick_demo())
CeSail provides a FastMCP server that enables AI assistants like Cursor to directly interact with web pages through standardized APIs. This allows you to give natural language commands to your AI assistant and have it execute web automation tasks.
pip install cesail fastmcp
playwright install
which python or which python3 in your terminal.
{
"mcpServers": {
"cesail": {
"command": "python3",
"args": ["-m", "cesail.cesail_mcp.fastmcp_server"],
"env": {
"PYTHONUNBUFFERED": "1"
},
"description": "CeSail MCP Server for comprehensive web automation and DOM parsing",
"capabilities": {
"tools": {
"listChanged": true
}
}
}
}
}
Note: This configuration has been tested with Cursor. For best performance, users should disable the get_screenshot capability as Cursor screenshots can take a while to process. To disable it, go to Cursor Settings β Tools & Integrations β MCP and disable the get_screenshot capability for the CeSail server. This should also work with other MCP-compatible agents, though it hasnβt been tested with them.
For more help setting up Cursor MCP, see: https://docs.cursor.com/en/context/mcp
python3 -m cesail.cesail_mcp.fastmcp_server
Run this command to ensure the server launches properly. You should see output indicating the server is starting up.
"Using cesail, Navigate to example.com and do a certain task"
"Using cesail, ..."
Traditional web scraping provides raw HTML, which is difficult for AI agents to interpret. CeSail solves this by:
This transformation makes it possible for AI agents to:
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Cursor β β MCP Server β β DOM Parser β
β (AI Agent) βββββΊβ (Python) βββββΊβ (Python) β
β β β β β β
β β’ Natural Lang. β β β’ FastMCP APIs β β β’ Page Analyzer β
β β’ Task Planning β β β’ Web Automationβ β β’ Action Exec. β
β β’ Execution β β β’ Screenshots β β β’ Idle Watcher β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β
β
βββββββββββββββββββ
β Web Browser β
β (Playwright) β
β β
β β’ Page Control β
β β’ DOM Access β
β β’ Screenshots β
β β’ Actions β
βββββββββββββββββββ
β
β
βββββββββββββββββββ
β JavaScript β
β Layer β
β β
β β’ Element Ext. β
β β’ Selector Gen. β
β β’ Text Analysis β
β β’ Action Ext. β
βββββββββββββββββββ
Key Architecture Points:
cesail/dom_parser/src/js/)Core DOM parsing engine that transforms raw HTML into structured, agent-friendly data.
Language: JavaScript
Features:
Key Components:
index.js: Main entry point and public APIaction-extraction.js: Extracts actionable elements and metadatafilter-elements.js: Filters and groups elements by importancescoring.js: Scores elements based on visibility and interactivityselector-extraction.js: Generates reliable CSS selectorsvisualizer.js: Visual debugging and element highlightingcache-manager.js: Performance optimization and cachingData Transformation Example:
// Raw HTML input
<button class="btn-primary" onclick="submit()">Submit Form</button>
<input type="text" placeholder="Enter email" id="email" />
// CeSail transforms to agent-friendly JSON
{
"type": "BUTTON",
"selector": "button.btn-primary",
"text": "Submit Form",
"action": "CLICK",
"importance": 0.9,
"context": "form submission",
"metadata": {
"aria-label": null,
"disabled": false,
"visible": true
}
}
Documentation: See cesail/dom_parser/src/js/README.md
cesail/dom_parser/src/py/)Orchestration layer that manages browser interactions and provides high-level APIs.
Language: Python
Features:
Key Components:
dom_parser.py: Main interface for DOM parsing and interactionpage_analyzer.py: Analyzes page structure and extracts actionable elementsaction_executor.py: Executes web actions through Playwrightidle_watcher.py: Monitors page state and waits for stabilityscreenshot.py: Captures and processes page screenshotstypes.py: Data structures and type definitionsconfig.py: Configuration management and validationactions_plugins/: Modular action implementations (navigation, interaction, input, system)Integration Example:
async with DOMParser() as parser:
# Navigate to page
await parser.navigate("https://example.com")
# Analyze page structure
parsed_page = await parser.analyze_page()
# Execute actions
await parser.click("button.btn-primary")
await parser.type("input#email", "user@example.com")
Documentation: See cesail/dom_parser/src/py/README.md
cesail/cesail_mcp/)FastMCP server that provides standardized APIs for agents to interact with transformed web data.
Language: Python
Features:
Agent-Friendly API Example:
# Agent receives structured data from CeSail
parsed_page = await parser.analyze_page()
# Get the actions data (this is what agents typically work with)
actions = parsed_page.get_actions()
# Example actions data structure
actions_data = [
{
"type": "LINK",
"selector": "2",
"importantText": "Vintage vibesCreate your weekend moodboard | Vinta | /today/best/create-your-weekend-moodboard/128099/"
},
{
"type": "LINK",
"selector": "3",
"importantText": "Summer hobbiesTry bead embroidery | Summer hobbies | /today/best/try-bead-embroidery/128240/"
},
{
"type": "SELECT",
"selector": "5",
"importantText": "search-box-input | combobox | Search | Search"
},
{
"type": "BUTTON",
"selector": "8",
"importantText": "vertical-nav-more-options-button | More options | More options"
},
{
"type": "BUTTON",
"selector": "10",
"importantText": "Sign up"
}
]
**Documentation**: See [cesail/dom_parser/src/py/README.md](/CeSail/cesail/dom_parser/src/py/) for more details about the parsed page data structure.
Usage: python3 -m cesail.cesail_mcp.fastmcp_server
cesail/simple_agent/) - WIPAI-powered web automation agent using LLM for task breakdown and execution.
Language: Python
Features:
Documentation: See cesail/simple_agent/README.md for more details.
Usage: python3 -m cesail.simple_agent.simple_agent
CeSail includes comprehensive test suites to validate functionality and demonstrate capabilities.
# Activate virtual environment
source venv/bin/activate
# Set PYTHONPATH
export PYTHONPATH=/Users/rachitapradeep/CeSail:$PYTHONPATH
# Run playground tests (great way to see CeSail in action!)
pytest cesail/dom_parser/tests/playground/test_page_analyzer_integration_pinterest.py -v -s
# Run all tests
pytest cesail/dom_parser/tests/ -v
The playground tests are an excellent way to see CeSail navigate through real websites:
These tests demonstrate CeSailβs ability to:
Documentation: See cesail/dom_parser/tests/README.md for complete testing guide and examples.
For development or advanced usage:
Prerequisites:
Installation:
git clone https://github.com/AkilaJay/cesail.git
cd cesail
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -e .
cd cesail/dom_parser
npm install
npm run build
cd ..
# Create .env file in cesail/simple_agent/ directory
echo "OPENAI_API_KEY=your_openai_api_key_here" > cesail/simple_agent/.env
playwright install
Problem: ModuleNotFoundError: No module named 'dom_parser'
Solution: Ensure youβre in the correct directory and virtual environment is activated
Problem: Browser not found or crashes Solution: Reinstall Playwright browsers:
playwright install
Problem: API key invalid or rate limited Solution: Check your API key and usage limits in the OpenAI dashboard
Problem: Screenshots fail with βTarget page closedβ error Solution: Add proper error handling and retry logic
For detailed API documentation, see the component-specific README files:
We welcome contributions! Hereβs how to get started:
git checkout -b feature/your-feature-name
cesail/
βββ cesail/ # Python package
β βββ dom_parser/ # JavaScript DOM parser
β βββ src/ # Source code
β βββ dist/ # Built files
β βββ tests/ # JavaScript tests
β βββ README.md # Component documentation
β βββ cesail_mcp/ # FastMCP server
β βββ fastmcp_server.py # Main server file
β βββ server.py # Alternative server
β βββ tests/ # MCP tests
β βββ simple_agent/ # AI web automation agent
β βββ simple_agent.py # Main agent file
β βββ llm_interface.py # LLM integration
β βββ .env # Environment variables
βββ venv/ # Python virtual environment
βββ setup.py # Python package configuration
βββ pyproject.toml # Project configuration
βββ README.md # This file
For questions, issues, or contributions:
This project is licensed under the MIT License - see the LICENSE file for details.