Skip to main content

webtask

PyPI version Tests License: MIT Documentation

Easy-to-use LLM-powered browser automation — from autonomous tasks to element-level control.

Why webtask?

  • Natural language tasks: agent.do("add 3 items to cart")
  • Natural language selectors: agent.select("the search input")

See Features for more.

Demo

await agent.do("add 3 Flat-Head Wood Screws to the cart")

Demo

View full example

Quick Start

Install webtask and Playwright:

pip install pywebtask
playwright install chromium

Then run your first automation:

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

When to use webtask?

Use webtask when you know what you want to automate but don't want to deal with how (finding selectors, handling dynamic DOM, etc.).

Not ideal for:

  • High-volume scraping (use Scrapy, requests)
  • Fully autonomous agents for complex, open-ended tasks

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.

License

MIT

Metadata

Release files for pywebtask 0.27.0

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

Source distribution (sdist)

Source distribution for pywebtask 0.27.0
File Size Uploaded Provenance Actions
pywebtask-0.27.0.tar.gz 67.3 kB With provenance Details for pywebtask-0.27.0.tar.gz

Built distribution (wheel)

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

Total release size: 166.1 kB

Release files / pywebtask-0.27.0.tar.gz

Download URL pywebtask-0.27.0.tar.gz
Size 67.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3a7ae8f31fc466166a252fffb80f114476b9f670fb78c1926689f675b74bb950
BLAKE2b-256 checksum
How to use checksums
a2614f4f41c704c24ecbfe6319b65f5de70e4faf2d589b4d5a6dd1c44237020b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Dec 13, 2025.

Transparency log

Release files / pywebtask-0.27.0-py3-none-any.whl

Download URL pywebtask-0.27.0-py3-none-any.whl
Size 98.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
85d141d8f464e729ab7b75a54c8042cc67d3536e4d2e856c68ad80e004c46fb4
BLAKE2b-256 checksum
How to use checksums
2bd8099d3ccc303ef6ac3de89d84678fd042aa915c8a53f2c75e605f9fc73414
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Dec 13, 2025.

Transparency log

Security for pywebtask 0.27.0

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 pywebtask-0.27.0.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 Dec 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.

Release history Release notifications | RSS feed

This release

0.27.0 This release

2 release files Full provenance

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