Skip to main content

DoNew: Your Composable Task Library

PyPI version PyPI - Python Version PyPI - License

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

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

  1. Intuitive interface DO.New for task execution, DO.Browse for standalone web automation
  2. Provide AI-first interfaces for web and document interaction
  3. Enable autonomous decision-making and task execution
  4. Maintain high reliability and performance
  5. Ensure excellent developer experience
  6. Support both simple and complex AI agent workflows
  7. Provide batteries included provisions
  8. Hide underlying complexity from the user

Usage Guide

1. Creating a Task with DO.New

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()

# Assume browser is a provision for web tasks
browser = DO.Browse(headless=False)

doer = doer.realm([browser])

3. Enforcing Output Structure with envision()

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()

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
git clone https://github.com/DONEWio/donew.git
cd donew
  1. Install uv if you haven't already:
curl -LsSf https://astral.sh/uv/install.sh | sh
  1. Create and activate virtual environment:
uv venv -p python3.11
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  1. Install dependencies:

    • For basic usage:
    uv pip install pip
    uv pip install -e ".[dev]"
    
    • For Knowledge Graph functionality:
    uv pip install pip
    uv pip install -e "."
    uv pip install -e ".[kg,dev]"
    uv run -- spacy download en_core_web_md
    
  2. Install Playwright browsers:

playwright install chromium
playwright install # or all browsers

Testing

Run the test suite:

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 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 talk and strwythura.

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

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;
""") 

Metadata

Release files for donew 0.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for donew 0.1.9
File Size Uploaded Provenance Actions
donew-0.1.9.tar.gz 71.7 kB With provenance Details for donew-0.1.9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for donew 0.1.9
File Interpreter ABI Platform Actions
donew-0.1.9-py3-none-any.whl Python 3 none any Details for donew-0.1.9-py3-none-any.whl

Total release size: 135.5 kB

Release files / donew-0.1.9.tar.gz

Download URL donew-0.1.9.tar.gz
Size 71.7 kB
Tags Source
SHA-256 checksum
How to use checksums
17d3d339cadee67162ea97423d48f91e06f15e7d489d70f9c0f993455d4d42cc
BLAKE2b-256 checksum
How to use checksums
b13f83e14d44019ee7afec26a6ed2e694702229b3a57fa2be2b46297744d3a77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 13, 2025.

Transparency log

Release files / donew-0.1.9-py3-none-any.whl

Download URL donew-0.1.9-py3-none-any.whl
Size 63.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1aec87fc46b3a767e393168e6434a9800737f5e13a0d2bcefd5e29d59bcf3767
BLAKE2b-256 checksum
How to use checksums
1b03ff29ad23cba789d70fde00e5e97b54f0cc56b9ef19e662bea7720c40ba4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 13, 2025.

Transparency log

Security for donew 0.1.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for donew-0.1.9.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 13, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page