Metadata-Version: 2.4
Name: coreason_navigator
Version: 0.1.0
Summary: coreason-navigator
License: # The Prosperity Public License 3.0.0
         
         Contributor: CoReason, Inc.
         
         Source Code: https://github.com/CoReason-AI/coreason_navigator
         
         ## Purpose
         
         This license allows you to use and share this software for noncommercial purposes for free and to try this software for commercial purposes for thirty days.
         
         ## Agreement
         
         In order to receive this license, you have to agree to its rules.  Those rules are both obligations under that agreement and conditions to your license.  Don't do anything with this software that triggers a rule you can't or won't follow.
         
         ## Notices
         
         Make sure everyone who gets a copy of any part of this software from you, with or without changes, also gets the text of this license and the contributor and source code lines above.
         
         ## Commercial Trial
         
         Limit your use of this software for commercial purposes to a thirty-day trial period.  If you use this software for work, your company gets one trial period for all personnel, not one trial per person.
         
         ## Contributions Back
         
         Developing feedback, changes, or additions that you contribute back to the contributor on the terms of a standardized public software license such as [the Blue Oak Model License 1.0.0](https://blueoakcouncil.org/license/1.0.0), [the Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0.html), [the MIT license](https://spdx.org/licenses/MIT.html), or [the two-clause BSD license](https://spdx.org/licenses/BSD-2-Clause.html) doesn't count as use for a commercial purpose.
         
         ## Personal Uses
         
         Personal use for research, experiment, and testing for the benefit of public knowledge, personal study, private entertainment, hobby projects, amateur pursuits, or religious observance, without any anticipated commercial application, doesn't count as use for a commercial purpose.
         
         ## Noncommercial Organizations
         
         Use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization, or government institution doesn't count as use for a commercial purpose regardless of the source of funding or obligations resulting from the funding.
         
         ## Defense
         
         Don't make any legal claim against anyone accusing this software, with or without changes, alone or with other technology, of infringing any patent.
         
         ## Copyright
         
         The contributor licenses you to do everything with this software that would otherwise infringe their copyright in it.
         
         ## Patent
         
         The contributor licenses you to do everything with this software that would otherwise infringe any patents they can license or become able to license.
         
         ## Reliability
         
         The contributor can't revoke this license.
         
         ## Excuse
         
         You're excused for unknowingly breaking [Notices](#notices) if you take all practical steps to comply within thirty days of learning you broke the rule.
         
         ## No Liability
         
         ***As far as the law allows, this software comes as is, without any warranty or condition, and the contributor won't be liable to anyone for any damages related to this software or this license, under any kind of legal claim.***
License-File: LICENSE
License-File: NOTICE
Author: Gowtham A Rao
Author-email: gowtham.rao@coreason.ai
Requires-Python: >=3.11
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Requires-Dist: aiofiles (>=23.2.1,<24.0.0)
Requires-Dist: anyio (>=4.4.0,<5.0.0)
Requires-Dist: fastmcp (>=2.14.3,<3.0.0)
Requires-Dist: httpx (>=0.28.1)
Requires-Dist: loguru (>=0.7.2,<0.8.0)
Requires-Dist: markdownify (>=1.2.2,<2.0.0)
Requires-Dist: pillow (>=12.1.0,<13.0.0)
Requires-Dist: playwright (==1.56.0)
Requires-Dist: pydantic (>=2.12.5,<3.0.0)
Requires-Dist: readability-lxml (>=0.8.4.1,<0.9.0.0)
Project-URL: Documentation, https://github.com/CoReason-AI/coreason_navigator
Project-URL: Homepage, https://github.com/CoReason-AI/coreason_navigator
Project-URL: Repository, https://github.com/CoReason-AI/coreason_navigator
Description-Content-Type: text/markdown

# coreason-navigator

[![License](https://img.shields.io/badge/license-Prosperity%203.0-blue)](https://prosperitylicense.com/versions/3.0.0)
[![CI](https://github.com/CoReason-AI/coreason_navigator/actions/workflows/ci.yml/badge.svg)](https://github.com/CoReason-AI/coreason_navigator/actions)
[![Code Style: Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Documentation](https://img.shields.io/badge/docs-product%20requirements-green)](docs/product_requirements.md)

**coreason-navigator** is the "Eyes and Hands" of the CoReason platform for the World Wide Web. It bridges the gap between modern AI agents and legacy web interfaces using State-of-the-Art (SOTA) "Computer Use" techniques.

## Features

-   **Visual Navigation:** Agents use a headless browser (Playwright) to "see" and interact with webpages just like a human, bypassing the need for fragile API integrations.
-   **Vision-Language Model (VLM) Integration:** Uses screenshots and Accessibility Trees (AX Tree) to ground LLM intent into precise screen coordinates.
-   **Robust Orchestration:** Handles dynamic content, session persistence, and stealth techniques (e.g., User-Agent rotation) to avoid detection.
-   **Set-of-Marks (SoM):** Overlays numeric tags on interactive elements to improve VLM accuracy.
-   **Content Extraction:** Converts noisy webpages into clean Markdown for LLM consumption.
-   **Safety First:** Includes rate limiting, domain allowlisting, and PII input protection.

## Installation

```bash
pip install coreason-navigator
```

Or install from source:

```bash
git clone https://github.com/CoReason-AI/coreason_navigator.git
cd coreason_navigator
pip install .
```

You will also need to install Playwright browsers:

```bash
playwright install chromium
```

## Usage

Here is a simple example of how to use the `PlaywrightNavigator`:

```python
import asyncio
from coreason_navigator.driver import PlaywrightNavigator
from coreason_navigator.types import GotoAction, ClickAction

async def main():
    # Initialize the navigator (headless by default)
    navigator = PlaywrightNavigator(headless=True)

    try:
        # Launch the browser
        await navigator.launch()

        # Navigate to a URL
        print("Navigating to example.com...")
        state = await navigator.navigate("https://example.com")
        print(f"Title: {state.title}")

        # Take a screenshot (base64 encoded)
        # print(state.screenshot_base64[:50] + "...")

        # Extract content
        content = await navigator.extract_content(format="markdown")
        print("Page Content Summary:")
        print(content[:200])

    finally:
        # Always close resources
        await navigator.close()

if __name__ == "__main__":
    asyncio.run(main())
```

## Architecture

1.  **Observe:** Captures screenshot and Accessibility Tree.
2.  **Orient:** Maps user intent to screen coordinates using VLM.
3.  **Decide:** Formulates browser actions (Click, Type, Scroll).
4.  **Act:** Executes actions via Playwright.

## License

This software is proprietary and dual-licensed.
Licensed under the [Prosperity Public License 3.0](https://prosperitylicense.com/versions/3.0.0).
Commercial use beyond a 30-day trial requires a separate license.

