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 GeminiComputerUse

wt = Webtask()
agent = await wt.create_agent(llm=GeminiComputerUse(), mode="visual")

await agent.do("Go to practicesoftwaretesting.com and 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

await agent.do("Click the login button")                            # Single action
await agent.do("Find the blue shirt, add to cart, and checkout")    # Multi-step task

Stateful agents

# Agent remembers context across tasks
await agent.do("Add 2 wood screws to cart")
await agent.do("Add 5 cross-head screws")
await agent.do("Go to cart and verify")

agent.clear_history()  # Start fresh

Three modes

agent = await wt.create_agent(llm=llm, mode="text")     # DOM-based (default)
agent = await wt.create_agent(llm=llm, mode="visual")   # Screenshots
agent = await wt.create_agent(llm=llm, mode="full")     # Both

Verification

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

Data extraction

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

product = await agent.extract("product information", ProductInfo)

Error handling

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

Easy integration

agent = await wt.create_agent(llm=llm)                                  # New browser
agent = await wt.create_agent_with_browser(llm=llm, browser=browser)    # Existing browser
agent = wt.create_agent_with_context(llm=llm, context=context)          # Existing context
agent = wt.create_agent_with_page(llm=llm, page=page)                   # Existing page

Timing control

# Set default wait time for agent
agent = await wt.create_agent(llm=llm, wait_after_action=2.0)

# Override per task
await agent.do("Click submit", wait_after_action=3.0)

# Explicit waits
await agent.wait_for_load()          # Wait for page load
await agent.wait_for_network_idle()  # Wait for network idle

Supported LLMs

from webtask.integrations.llm import Gemini, GeminiComputerUse, Bedrock

Gemini(model="gemini-2.5-flash")                                # 2.5 Flash
GeminiComputerUse(model="gemini-2.5-computer-use-preview")      # Visual mode
Bedrock(model="anthropic.claude-sonnet-4-20250514-v1:0")        # Claude 4 Sonnet (WIP)

TODO

  • 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.21.2.tar.gz (72.2 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.21.2-py3-none-any.whl (107.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pywebtask-0.21.2.tar.gz
Algorithm Hash digest
SHA256 3468c409e6f113a4bf8c01e88c283d48479a9d9708e85d611e42e4afa3371941
MD5 e2889c0d9358ddbcb7a955105aa88623
BLAKE2b-256 a80dcbc7c56d88c8cd122a7cf1caadaaefcf861c90da2b61d3deb6c8db1987af

See more details on using hashes here.

Provenance

The following attestation bundles were made for pywebtask-0.21.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.21.2-py3-none-any.whl.

File metadata

  • Download URL: pywebtask-0.21.2-py3-none-any.whl
  • Upload date:
  • Size: 107.7 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.21.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a9ca003981df2ee7f817129c84a148b3b3aa0e9dbec55d8eab998422c3327003
MD5 c827dfb8df0093b8723cfc0fbf9997bc
BLAKE2b-256 69a24d0b957b3c71f75eca983cd46e3e9218f49f2f7bffdafa63e85426db6a51

See more details on using hashes here.

Provenance

The following attestation bundles were made for pywebtask-0.21.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