# DoNew: Your Composable Task Library
[](https://badge.fury.io/py/donew)
[](https://pypi.org/project/donew/)
[](https://pypi.org/project/donew/)
## What is DoNew?
DoNew is a Python package designed to empower AI agents to interact effortlessly with web content and documents through high-level, intuitive interfaces. It bridges the gap between advanced AI capabilities and real-world applications by offering robust tools for web automation, document processing, and autonomous task execution. Developers can build isolated tasks that integrate seamlessly with their favorite tools, composing them either horizontally as peers or vertically as nested workflows to orchestrate complex operations, all while keeping each task self-contained and extendable.
## Quick Install
```bash
pip install donew
playwright install # Install required browsers
```
## Key Features
- Task Planning & Multi-Step Operations: Organize complex workflows with clear planning and sequential execution.
- Provision Isolation: Context is isolated from the rest of the world. Each provision is a self-contained unit during runtime.
- Web Automation (DO.Browse): Leverage Playwright-based browser automation featuring smart element detection, visual debugging, and integrated knowledge graph extraction.
- Knowledge Processing: Utilize multi-model entity extraction (GLiNER), relationship mapping (GLiREL), advanced text analysis with spaCy, and robust graph storage via KuzuDB.
- Task Composition & Context Awareness: Achieve both horizontal (parallel provisions) and vertical (nested tasks) composition with comprehensive state and context management.
- Plug-and-Play Provisions: Comes with batteries included—ready-made tools such as MCP.run tasks and Restack workflows.
## Core Concepts
### Terminology
- **Doer**: A task executor that can be enacted. instance of DO.New
- **Provision**: A tool that can be used to enact a doer.
- **Realm**: The context in which a doer is enacted.
- **Envision**: The expected output of a doer.
- **Enact**: The act that triggers a doer to start its journey.
### Goals
0. Intuitive interface DO.New for task execution, DO.Browse for standalone web automation
1. Provide AI-first interfaces for web and document interaction
2. Enable autonomous decision-making and task execution
3. Maintain high reliability and performance
4. Ensure excellent developer experience
5. Support both simple and complex AI agent workflows
6. Provide batteries included provisions
7. Hide underlying complexity from the user
## Usage Guide
### 1. Creating a Task with DO.New
```python
from donew import DO
# Create a new task (doer) with a model
model = LitellmModel()
doer = DO.New(model, name='example_task', purpose='demonstrate basic usage')
```
### 2. Adding Context with realm()
```python
# Assume browser is a provision for web tasks
browser = DO.Browse(headless=False)
doer = doer.realm([browser])
```
### 3. Enforcing Output Structure with envision()
```python
from pydantic import BaseModel, Field
class Team(BaseModel):
members: list[str] = Field(description='List of team members')
# This enforces that the output should match the Team schema
constrained_doer = doer.envision(Team)
```
### 4. Kickstarting the Workflow with enact()
```python
result = constrained_doer.enact('goto https://unrealists.com and find the team')
```
## Development Setup
### Requirements
- Python 3.11+ (required for Knowledge Graph functionality)
- uv package manager (recommended over pip)
### Installation Steps
1. Clone the repository
```bash
git clone https://github.com/DONEWio/donew.git
cd donew
```
2. Install uv if you haven't already:
```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
```
3. Create and activate virtual environment:
```bash
uv venv -p python3.11
source .venv/bin/activate # On Windows: .venv\Scripts\activate
```
4. Install dependencies:
- For basic usage:
```bash
uv pip install pip
uv pip install -e ".[dev]"
```
- For Knowledge Graph functionality:
```bash
uv pip install pip
uv pip install -e "."
uv pip install -e ".[kg,dev]"
uv run -- spacy download en_core_web_md
```
5. Install Playwright browsers:
```bash
playwright install chromium
playwright install # or all browsers
```
## Testing
Run the test suite:
```bash
pytest tests/ --httpbin-url=https://httpbin.org
```
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
# Knowledge Graph Component
The Knowledge Graph component (`donew.see.graph`) provides entity and relationship extraction from text, with persistent storage in KuzuDB. This implementation is inspired by and adapted from the [GraphGeeks.org](https://live.zoho.com/PBOB6fvr6c) talk and [strwythura](https://raw.githubusercontent.com/DerwenAI/strwythura/refs/heads/main/demo.py).
## Features
- Named Entity Recognition using GLiNER
- Relationship Extraction using GLiREL
- Graph storage and querying with KuzuDB
- Text processing and chunking with spaCy
## Graph Construction
The graph is built in layers:
1. **Base Layer**: Textual analysis using spaCy parse trees
2. **Entity Layer**: Named entities and noun chunks from GLiNER
3. **Relationship Layer**: Semantic relationships from GLiREL
4. **Storage Layer**: Persistent graph storage in KuzuDB
## Usage
```python
from donew.see.graph import KnowledgeGraph
# Initialize KG (in-memory or with persistent storage)
kg = KnowledgeGraph(db_path="path/to/db") # or None for in-memory
# Analyze text
result = kg.analyze("""
OpenAI CEO Sam Altman has partnered with Microsoft.
The collaboration was announced in San Francisco.
""")
# Query the graph
ceo_relations = kg.query("""
MATCH (p:Entity)-[r:Relation]->(o:Entity)
WHERE p.label = 'Person' AND o.label = 'Company'
AND r.type = 'FOUNDER'
RETURN p.text as Founder, o.text as Company
ORDER BY Founder;
""")
Raw data
{
"_id": null,
"home_page": null,
"name": "donew",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "web automation, vision, browser, playwright, image processing, knowledge graph",
"author": null,
"author_email": "Kenan Deniz <kenan@unrealists.com>",
"download_url": "https://files.pythonhosted.org/packages/68/79/24186de23fb1e5c8aa78b703f0c55b1307b471192634872a9070249f276a/donew-0.1.8.tar.gz",
"platform": null,
"description": "# DoNew: Your Composable Task Library\n\n[](https://badge.fury.io/py/donew)\n[](https://pypi.org/project/donew/)\n[](https://pypi.org/project/donew/)\n\n## What is DoNew?\n\nDoNew is a Python package designed to empower AI agents to interact effortlessly with web content and documents through high-level, intuitive interfaces. It bridges the gap between advanced AI capabilities and real-world applications by offering robust tools for web automation, document processing, and autonomous task execution. Developers can build isolated tasks that integrate seamlessly with their favorite tools, composing them either horizontally as peers or vertically as nested workflows to orchestrate complex operations, all while keeping each task self-contained and extendable.\n\n## Quick Install\n\n```bash\npip install donew\nplaywright install # Install required browsers\n```\n\n## Key Features\n- Task Planning & Multi-Step Operations: Organize complex workflows with clear planning and sequential execution.\n- Provision Isolation: Context is isolated from the rest of the world. Each provision is a self-contained unit during runtime.\n- Web Automation (DO.Browse): Leverage Playwright-based browser automation featuring smart element detection, visual debugging, and integrated knowledge graph extraction.\n- Knowledge Processing: Utilize multi-model entity extraction (GLiNER), relationship mapping (GLiREL), advanced text analysis with spaCy, and robust graph storage via KuzuDB.\n- Task Composition & Context Awareness: Achieve both horizontal (parallel provisions) and vertical (nested tasks) composition with comprehensive state and context management.\n- Plug-and-Play Provisions: Comes with batteries included\u2014ready-made tools such as MCP.run tasks and Restack workflows.\n\n## Core Concepts\n\n### Terminology\n- **Doer**: A task executor that can be enacted. instance of DO.New\n- **Provision**: A tool that can be used to enact a doer.\n- **Realm**: The context in which a doer is enacted.\n- **Envision**: The expected output of a doer.\n- **Enact**: The act that triggers a doer to start its journey.\n\n### Goals\n0. Intuitive interface DO.New for task execution, DO.Browse for standalone web automation\n1. Provide AI-first interfaces for web and document interaction\n2. Enable autonomous decision-making and task execution\n3. Maintain high reliability and performance\n4. Ensure excellent developer experience\n5. Support both simple and complex AI agent workflows\n6. Provide batteries included provisions\n7. Hide underlying complexity from the user\n\n## Usage Guide\n\n### 1. Creating a Task with DO.New\n\n```python\nfrom donew import DO\n\n# Create a new task (doer) with a model\nmodel = LitellmModel()\ndoer = DO.New(model, name='example_task', purpose='demonstrate basic usage')\n```\n\n### 2. Adding Context with realm()\n\n```python\n# Assume browser is a provision for web tasks\nbrowser = DO.Browse(headless=False)\n\ndoer = doer.realm([browser])\n```\n\n### 3. Enforcing Output Structure with envision()\n\n```python\nfrom pydantic import BaseModel, Field\n\nclass Team(BaseModel):\n members: list[str] = Field(description='List of team members')\n\n# This enforces that the output should match the Team schema\nconstrained_doer = doer.envision(Team)\n```\n\n### 4. Kickstarting the Workflow with enact()\n\n```python\nresult = constrained_doer.enact('goto https://unrealists.com and find the team')\n```\n\n## Development Setup\n\n### Requirements\n- Python 3.11+ (required for Knowledge Graph functionality)\n- uv package manager (recommended over pip)\n\n### Installation Steps\n\n1. Clone the repository\n```bash\ngit clone https://github.com/DONEWio/donew.git\ncd donew\n```\n\n2. Install uv if you haven't already:\n```bash\ncurl -LsSf https://astral.sh/uv/install.sh | sh\n```\n\n3. Create and activate virtual environment:\n```bash\nuv venv -p python3.11\nsource .venv/bin/activate # On Windows: .venv\\Scripts\\activate\n```\n\n4. Install dependencies:\n - For basic usage:\n ```bash\n uv pip install pip\n uv pip install -e \".[dev]\"\n ```\n\n - For Knowledge Graph functionality:\n ```bash\n uv pip install pip\n uv pip install -e \".\"\n uv pip install -e \".[kg,dev]\"\n uv run -- spacy download en_core_web_md\n ```\n\n5. Install Playwright browsers:\n```bash\nplaywright install chromium\nplaywright install # or all browsers\n```\n\n## Testing\n\nRun the test suite:\n```bash\npytest tests/ --httpbin-url=https://httpbin.org\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n# Knowledge Graph Component\n\nThe Knowledge Graph component (`donew.see.graph`) provides entity and relationship extraction from text, with persistent storage in KuzuDB. This implementation is inspired by and adapted from the [GraphGeeks.org](https://live.zoho.com/PBOB6fvr6c) talk and [strwythura](https://raw.githubusercontent.com/DerwenAI/strwythura/refs/heads/main/demo.py).\n\n## Features\n\n- Named Entity Recognition using GLiNER\n- Relationship Extraction using GLiREL \n- Graph storage and querying with KuzuDB\n- Text processing and chunking with spaCy\n\n## Graph Construction\n\nThe graph is built in layers:\n\n1. **Base Layer**: Textual analysis using spaCy parse trees\n2. **Entity Layer**: Named entities and noun chunks from GLiNER\n3. **Relationship Layer**: Semantic relationships from GLiREL\n4. **Storage Layer**: Persistent graph storage in KuzuDB\n\n## Usage\n\n```python\nfrom donew.see.graph import KnowledgeGraph\n\n# Initialize KG (in-memory or with persistent storage)\nkg = KnowledgeGraph(db_path=\"path/to/db\") # or None for in-memory\n\n# Analyze text\nresult = kg.analyze(\"\"\"\nOpenAI CEO Sam Altman has partnered with Microsoft.\nThe collaboration was announced in San Francisco.\n\"\"\")\n\n# Query the graph\nceo_relations = kg.query(\"\"\"\nMATCH (p:Entity)-[r:Relation]->(o:Entity)\nWHERE p.label = 'Person' AND o.label = 'Company'\nAND r.type = 'FOUNDER'\nRETURN p.text as Founder, o.text as Company\nORDER BY Founder;\n\"\"\") \n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python package for web processing and vision tasks with browser automation capabilities",
"version": "0.1.8",
"project_urls": null,
"split_keywords": [
"web automation",
" vision",
" browser",
" playwright",
" image processing",
" knowledge graph"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "51ee5d4241cd9035ccc9ad3afd1753247a3593ef72a0abcd6d7b7de2c34a8510",
"md5": "8cbe77dc182309b495ed5d22bf1bf624",
"sha256": "1268716fe4f73ab87c71c9795547f5c1fd7f7bc458b24d1de8a84a1be57b2232"
},
"downloads": -1,
"filename": "donew-0.1.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8cbe77dc182309b495ed5d22bf1bf624",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 63757,
"upload_time": "2025-02-12T03:37:46",
"upload_time_iso_8601": "2025-02-12T03:37:46.246619Z",
"url": "https://files.pythonhosted.org/packages/51/ee/5d4241cd9035ccc9ad3afd1753247a3593ef72a0abcd6d7b7de2c34a8510/donew-0.1.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "687924186de23fb1e5c8aa78b703f0c55b1307b471192634872a9070249f276a",
"md5": "41644495542746a801b12663f0d77b63",
"sha256": "0812ab5494fb5583e6557e8ab2a923e44b54434d93e8685459560da50f980244"
},
"downloads": -1,
"filename": "donew-0.1.8.tar.gz",
"has_sig": false,
"md5_digest": "41644495542746a801b12663f0d77b63",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 70441,
"upload_time": "2025-02-12T03:37:48",
"upload_time_iso_8601": "2025-02-12T03:37:48.415491Z",
"url": "https://files.pythonhosted.org/packages/68/79/24186de23fb1e5c8aa78b703f0c55b1307b471192634872a9070249f276a/donew-0.1.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-12 03:37:48",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "donew"
}