kweo for Python
Drive your real, signed-in kweo browser and use your own AI from Python.
import kweo
k = kweo.connect() # finds kweo on this computer
tab = k.open("https://github.com/notifications")
print(tab.text()) # the page, as you see it — you're signed in
print(tab.ask("Which of these need my review?")) # your AI, about this page
- Your sessions, not a headless robot. Scripts work in your kweo — Gmail, banking, LinkedIn, internal dashboards — already signed in, past bot walls, no cookies to export.
- Your AI, without keys in code. Claude (through Claude Code), your ChatGPT or Copilot plan, Gemini, API keys, OpenCode's free models, on-device models: whatever you connected in kweo. kweo speaks the OpenAI API, so LangChain, LlamaIndex, CrewAI and the OpenAI SDK work too.
- kweo's agent as a function.
k.agent.run("…")hands a whole job to kweo's agent and returns its answer (or the JSON you asked for). - Safe by default. Localhost only, a key per app, the same safety checks as kweo's agent (risky clicks follow your autonomy setting, blocked sites stay blocked), saved passwords are typed by kweo and never reach Python, and everything a script does is in kweo's activity log.
No dependencies — standard library only, Python 3.9+.
Install
pip install https://kweo.ai/downloads/kweo-5.0.0-py3-none-any.whl
kweo 5.0 or later must be running. Its API is on by default (Settings → Developers). kweo writes its address and a key to ~/.kweo/api.json, readable only by you, so kweo.connect() needs no arguments. To use another key, set KWEO_API_KEY (and KWEO_URL), or pass kweo.connect(key=…).
Pages
tab = k.open("https://news.ycombinator.com") # a new background tab
tab = k.active_tab() # …or the one you're looking at
for t in k.tabs(): print(t.id, t.title, t.url)
tab.goto("https://example.com") # waits for the page to settle
tab.text(find="price") # visible text (optionally just matching lines)
tab.elements(interactive=True) # [N] role "name" — buttons, links, fields
tab.links(match="*/item?id=*") # [{"text", "url"}]
tab.screenshot("page.png", full_page=True)
tab.pdf("page.pdf")
tab.evaluate("document.title") # JavaScript (needs the "script" permission)
Acting
Name an element by its visible text ("Sign in"), its [N] index from elements(), or an Element. kweo prefers the control you mean: the text box over its label, the button over its caption. When two different controls really match, you get KweoAmbiguous listing them, and you add role= or nth=.
tab.type("Search", "wireless earbuds", submit=True)
tab.click("Add to cart")
tab.fill({"Email": "ada@example.com", "Name": "Ada"}, submit="Continue")
tab.select("Country", "India")
tab.press("Escape")
tab.scroll("down")
tab.wait(text="Order placed", seconds=30)
tab.fill_password("Password", submit=True) # your saved password — never seen by Python
tab.upload("Attach resume", "~/Documents/cv.pdf")
Every action goes through kweo's safety checks. A risky click (pay, delete, send) may ask you first, depending on Settings → AI & models → Agent autonomy. If you decline, Python gets KweoPermissionError.
AI on a page
tab.ask("What's the cheapest option and its delivery date?")
rows = tab.extract({"title": str, "points": int, "comments": int}, many=True)
from pydantic import BaseModel
class Order(BaseModel):
number: str
total: float
status: str
orders = k.open("https://www.amazon.in/your-orders").extract(Order, many=True) # list[Order]
extract accepts a dict of types, a Pydantic model, a dataclass, a TypedDict, or a JSON schema. model= picks the AI. Without it, kweo uses the one you chose in kweo.
Your AI, from anywhere
k.ai.chat("Write a haiku about browsers") # your default model
k.ai.chat("Plan my week", model="claude-code:opus") # Claude Code, a chosen model
k.ai.chat("Classify: ...", json={"label": str, "score": float}) # parsed JSON
for piece in k.ai.chat("Tell me a story", stream=True): print(piece, end="")
k.ai.models() # what's connected
OpenAI-compatible: base URL http://127.0.0.1:7333/v1, any kweo key.
from openai import OpenAI
client = OpenAI(base_url="http://127.0.0.1:7333/v1", api_key=k.key) # or k.ai.openai()
client.chat.completions.create(model="default", messages=[{"role": "user", "content": "Hi"}])
Model names:
default: your pick in kweo.claude-code,claude-code:opus,:sonnet,:haiku.opencodeandopencode:<provider/model>.- kweo's own ids for everything else:
chatgpt:…,copilot:…,openai:gpt-4o,google:…,local:….
Tool calling works with every model. Claude Code and OpenCode get it through kweo's emulation, enforced with a JSON schema on Claude Code. response_format (JSON mode / JSON schema) works too.
Agents
run = k.agent.run("Find my last 3 Amazon orders and their totals",
url="https://www.amazon.in/your-orders",
output={"orders": [{"date": str, "total": float}]})
print(run.status, run.output) # done {'orders': [...]}
run = k.agent.start("Compare prices for 'AirPods Pro' on three shops") # don't wait
for event in run.events(): print(event) # steps as they happen
run.stop()
The agent is kweo's own, running on Claude Code or OpenCode (engine=, model=). It works in a tab you can watch. If it needs you (a login, a CAPTCHA), it asks in kweo and the run waits (status == "waiting").
Workflows, routines, downloads, events
k.workflows.list()
k.workflows.run("Weekly report", week="2026-W48")
k.routines.run("Morning inbox")
k.downloads()
k.wait_for_download(timeout=120)
for ev in k.events(): print(ev["type"], ev.get("tab")) # tab.opened / navigated / loaded / closed, download.*
LangChain / LangGraph
pip install langchain-openai langgraph
from kweo.langchain import chat_model, kweo_tools
from langgraph.prebuilt import create_react_agent
agent = create_react_agent(chat_model("claude-code"), kweo_tools())
agent.invoke({"messages": [("user", "What's in my GitHub notifications?")]})
kweo_tools() gives the agent one tab of its own: open_page, read_page, list_elements, click, type_text, page_links, extract_from_page, ask_about_page, run_browser_agent. Any MCP-capable framework can also connect to kweo's MCP server at http://127.0.0.1:7333/mcp.
Async
from kweo.aio import connect
k = await connect()
tab = await k.open("https://example.com")
print(await tab.text())
The kweo command
kweo status
kweo tabs
kweo text https://example.com --find price
kweo ask "What is this page about?" --url https://example.com
kweo chat "Summarize this:" - < notes.txt
kweo extract https://news.ycombinator.com --shape '{"title":"str","points":"int"}' --many
kweo run "Find a 4-star hotel in Lisbon under €150 for next Friday" --url https://booking.com
kweo shot https://example.com -o page.png --full
kweo workflows ; kweo workflow "Weekly report" -p week=2026-W48
Keys and permissions
The This computer key (in ~/.kweo/api.json) can do everything, the same as you. For a tool you don't fully trust, make a key in Settings → Developers → New key with only what it needs:
| Permission | Allows |
|---|---|
browse |
List and open tabs, go to pages, read text, elements and links, screenshots, downloads |
act |
Click, type, fill, select, press keys, upload, close tabs |
script |
Run JavaScript in pages |
ai |
Models, chat completions, ask/extract on pages |
agent |
Run kweo's agent |
workflows |
Run workflows and routines |
Revoke a key at any time. Ghost (private) windows and kweo's own pages are never reachable from scripts.
Errors
All errors are kweo.KweoError, with .status, .code and .message. The subclasses:
KweoNotRunning: kweo isn't open, or its API is off.KweoAuthError: the key is missing or wrong.KweoPermissionError: the key lacks the permission, the site is blocked, or you declined the action.KweoNotFound: no such tab, element, model, run or workflow.KweoAmbiguous: several elements match..details["candidates"]lists them.KweoTimeout: kweo didn't answer in time.
HTTP API
Everything above is plain HTTP and JSON on http://127.0.0.1:7333/v1 with Authorization: Bearer <key>, so any language works. See https://kweo.ai/developers for the full reference.
Apache-2.0 · https://kweo.ai/developers
Metadata
Release files for kweo 5.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kweo-5.0.0-py3-none-any.whl | Python 3 | none | any | Details for kweo-5.0.0-py3-none-any.whl |
Release files / kweo-5.0.0-py3-none-any.whl
| Download URL | kweo-5.0.0-py3-none-any.whl |
|---|---|
| Size | 29.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d01f43d11a09c578514ffdfdb7d94322b558beb7b11708ec0e4a902c69e060ea
|
|
BLAKE2b-256 checksum How to use checksums |
31a35772d63e03d920e536cbfc74b99c45bcc37967e1b65003efb16206a3c1d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|
Security for kweo 5.0.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.