LLM-powered web automation library with autonomous agents
Project description
webtask
Easy-to-use LLM-powered browser automation — from autonomous tasks to element-level control.
Why webtask?
- High-level tasks: Describe what you want done — the agent figures out the steps
- Low-level control: Select any element with natural language — no CSS/XPath selectors needed
Demo
await agent.do("add 3 Flat-Head Wood Screws to the cart")
Installation
pip install pywebtask
playwright install chromium
Quick Start
from webtask import Webtask
from webtask.integrations.llm import Gemini
wt = Webtask()
agent = await wt.create_agent(
llm=Gemini(model="gemini-2.5-flash"),
wait_after_action=1.0,
)
await agent.goto("https://practicesoftwaretesting.com")
await agent.wait(3)
# select: pick elements with natural language
search = await agent.select("the search input")
await search.fill("pliers")
# do: simple or complex tasks — agent figures out the steps
await agent.do("click search and add the first product to cart")
# extract: get structured data from the page
price = await agent.extract("the cart total price")
# verify: check conditions
assert await agent.verify("cart has 1 item")
Features
Four core operations
await agent.do("click search and add first product to cart") # Autonomous tasks
element = await agent.select("the search input") # Element selection
data = await agent.extract("the cart total", MySchema) # Data extraction
assert await agent.verify("cart has 1 item") # Verification
Stateful agents — Agent remembers context across tasks
await agent.do("Add pliers to cart")
await agent.do("Add a hammer too") # Remembers previous action
agent.clear_history() # Reset when needed
Two modes — DOM-based or pixel-based interaction
agent = await wt.create_agent(llm=llm, mode="dom") # Element IDs (default)
agent = await wt.create_agent(llm=llm, mode="pixel") # Screen coordinates
Browser integration — Works with new or existing browsers
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
Error handling — Handle task failures gracefully
try:
await agent.do("Add item to cart")
except TaskAbortedError as e:
print(f"Task failed: {e}")
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)
You can also use your own LLM by implementing the LLM interface. See the custom LLM guide.
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.26.0.tar.gz.
File metadata
- Download URL: pywebtask-0.26.0.tar.gz
- Upload date:
- Size: 67.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6717b7d1b3e0264c5a121c92ea7793de2b968b99a84ab6a053f49a6496168c9e
|
|
| MD5 |
1dc55345cc41b7c2e596aa260f49f6ef
|
|
| BLAKE2b-256 |
af7bdb18725e4554a53733216005fbdcf61c47a495aaaacbd2c4c4ac74aae448
|
Provenance
The following attestation bundles were made for pywebtask-0.26.0.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.26.0.tar.gz -
Subject digest:
6717b7d1b3e0264c5a121c92ea7793de2b968b99a84ab6a053f49a6496168c9e - Sigstore transparency entry: 744994224
- Sigstore integration time:
-
Permalink:
steve-z-wang/webtask@076e3cf3af8e1b908d451bafd1b2d292af1c47ac -
Branch / Tag:
refs/tags/v0.26.0 - Owner: https://github.com/steve-z-wang
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@076e3cf3af8e1b908d451bafd1b2d292af1c47ac -
Trigger Event:
release
-
Statement type:
File details
Details for the file pywebtask-0.26.0-py3-none-any.whl.
File metadata
- Download URL: pywebtask-0.26.0-py3-none-any.whl
- Upload date:
- Size: 98.5 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 |
85bd09fbe5b7a412d0ab518001594be87e2024884cc07d5881163ba1b7999653
|
|
| MD5 |
3a2d8337afaa6cf2a9d87e9e477e64ed
|
|
| BLAKE2b-256 |
dc0ae4df0b8cf23ca28994076c54aced03f8a9188c93d072256ca46cb9b282bd
|
Provenance
The following attestation bundles were made for pywebtask-0.26.0-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.26.0-py3-none-any.whl -
Subject digest:
85bd09fbe5b7a412d0ab518001594be87e2024884cc07d5881163ba1b7999653 - Sigstore transparency entry: 744994247
- Sigstore integration time:
-
Permalink:
steve-z-wang/webtask@076e3cf3af8e1b908d451bafd1b2d292af1c47ac -
Branch / Tag:
refs/tags/v0.26.0 - Owner: https://github.com/steve-z-wang
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@076e3cf3af8e1b908d451bafd1b2d292af1c47ac -
Trigger Event:
release
-
Statement type: