Skip to main content

LLM-powered web automation library with autonomous agents

Project description

webtask

PyPI version Tests License: MIT Documentation

Easy to use LLM-powered web automation.

Installation

pip install pywebtask
playwright install chromium

Quick Start

from webtask import Webtask
from webtask.integrations.llm import Gemini
import os

wt = Webtask()

llm = Gemini(model="gemini-2.5-flash", api_key=os.getenv("GEMINI_API_KEY"))
agent = await wt.create_agent(llm=llm)

await agent.goto("practicesoftwaretesting.com")

await agent.do("Add 2 Flat-Head Wood Screws to the cart")

verdict = await agent.verify("the cart contains 2 items")
if verdict:
    print("Success!")

Features

Simple or complex tasks - From single actions to multi-step workflows:

# Simple action
await agent.do("Click the login button")

# Complex multi-step task
await agent.do("Go to the product page, find the blue shirt, add it to cart, and proceed to checkout")

Stateful agents - Remember context across multiple tasks:

await agent.do("Go to practicesoftwaretesting.com and add 2 Flat-Head Wood Screws to the cart")
await agent.do("Add 5 Cross-head screws to the cart")
await agent.do("Go to the cart page and verify the items")

Verification - Simple boolean checks with natural language:

verdict = await agent.verify("the cart contains 7 items")
if verdict:
    print("Success!")

Data extraction - Extract information from pages:

# Simple extraction returns string
price = await agent.extract("total price")
print(f"Price: {price}")

# Structured extraction with Pydantic schema
from pydantic import BaseModel

class ProductInfo(BaseModel):
    name: str
    price: float
    in_stock: bool

product = await agent.extract("product information", ProductInfo)
print(f"{product.name}: ${product.price}")

Error handling - Catch failures gracefully:

from webtask import TaskAbortedError, VerificationAbortedError, ExtractionAbortedError

try:
    await agent.do("Add item to cart")
except TaskAbortedError as e:
    print(f"Task failed: {e}")

Easy integration - Multiple ways to create agents:

# Create with new browser
agent = await wt.create_agent(llm=llm)

# Use existing browser
agent = await wt.create_agent_with_browser(llm=llm, browser=browser)

# Use existing context
agent = wt.create_agent_with_context(llm=llm, context=context)

# Use existing page
agent = wt.create_agent_with_page(llm=llm, page=page)

TODO

  • Unlimited context - Compact conversation history with LLM for extended sessions
  • Computer Use model integration - Pixel-based interaction with Claude Computer Use
  • Mind2Web benchmark - Evaluation on Mind2Web dataset

Links

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pywebtask-0.19.2.tar.gz (68.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pywebtask-0.19.2-py3-none-any.whl (100.0 kB view details)

Uploaded Python 3

File details

Details for the file pywebtask-0.19.2.tar.gz.

File metadata

  • Download URL: pywebtask-0.19.2.tar.gz
  • Upload date:
  • Size: 68.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pywebtask-0.19.2.tar.gz
Algorithm Hash digest
SHA256 e9cbcfa03d81aff5acfd8f7c68c2d43b07d40e6524b90dccce9338bb08a657d5
MD5 d31dae9da03fa904a6a5c149eb075e14
BLAKE2b-256 02dababb960817a564c1c679276db9c71b115e159adf2dd3d6ae10a866e030a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pywebtask-0.19.2.tar.gz:

Publisher: publish.yml on steve-z-wang/webtask

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pywebtask-0.19.2-py3-none-any.whl.

File metadata

  • Download URL: pywebtask-0.19.2-py3-none-any.whl
  • Upload date:
  • Size: 100.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pywebtask-0.19.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d29745d702b698420cee678ebca87b2394cb099876f9f4a06db098c54f096e60
MD5 5088f66650f9433be4b02c89466b14a0
BLAKE2b-256 f0263e816c605b441b045bb648efd6d9ffe521458e62515a8f33ce19a9f945f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pywebtask-0.19.2-py3-none-any.whl:

Publisher: publish.yml on steve-z-wang/webtask

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page