LLM-powered web automation library with autonomous agents
Project description
webtask
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pywebtask-0.19.1.tar.gz.
File metadata
- Download URL: pywebtask-0.19.1.tar.gz
- Upload date:
- Size: 68.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d13d9d6df8b6f953909f73a6c33be667963f8cb4b1cbca7e6761bd6922fa0c59
|
|
| MD5 |
f7fba2e4cc158076c55337fd3c1a4454
|
|
| BLAKE2b-256 |
c09005521117bb9ce7b4becfcd96e9b4aac98cfaee194c9a5a4444ea6d6f44b4
|
Provenance
The following attestation bundles were made for pywebtask-0.19.1.tar.gz:
Publisher:
publish.yml on steve-z-wang/webtask
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pywebtask-0.19.1.tar.gz -
Subject digest:
d13d9d6df8b6f953909f73a6c33be667963f8cb4b1cbca7e6761bd6922fa0c59 - Sigstore transparency entry: 716135214
- Sigstore integration time:
-
Permalink:
steve-z-wang/webtask@e7de60a140fbf03ad7e181065697ffe21e61f12d -
Branch / Tag:
refs/tags/v0.19.1 - Owner: https://github.com/steve-z-wang
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e7de60a140fbf03ad7e181065697ffe21e61f12d -
Trigger Event:
push
-
Statement type:
File details
Details for the file pywebtask-0.19.1-py3-none-any.whl.
File metadata
- Download URL: pywebtask-0.19.1-py3-none-any.whl
- Upload date:
- Size: 100.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b24ce33dcffe672e0fa9a6988edaf72a8c6a7abd56cdd509ed700b94a8a9b30
|
|
| MD5 |
3e1379c5449087623efd7d549d25f9bc
|
|
| BLAKE2b-256 |
cd809f0d721f1e549f104c1548febb66cc27fd68a5148ae19aa1f5039339f396
|
Provenance
The following attestation bundles were made for pywebtask-0.19.1-py3-none-any.whl:
Publisher:
publish.yml on steve-z-wang/webtask
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pywebtask-0.19.1-py3-none-any.whl -
Subject digest:
3b24ce33dcffe672e0fa9a6988edaf72a8c6a7abd56cdd509ed700b94a8a9b30 - Sigstore transparency entry: 716135235
- Sigstore integration time:
-
Permalink:
steve-z-wang/webtask@e7de60a140fbf03ad7e181065697ffe21e61f12d -
Branch / Tag:
refs/tags/v0.19.1 - Owner: https://github.com/steve-z-wang
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e7de60a140fbf03ad7e181065697ffe21e61f12d -
Trigger Event:
push
-
Statement type: