Skip to content

Commit c783a2d

Browse files
authored
Merge pull request #70 from vstorm-co/fixes/0.3.9
fix: browser tool
2 parents 8d49871 + e40ff86 commit c783a2d

4 files changed

Lines changed: 50 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,26 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.3.9] - 2026-04-12
9+
10+
### Added
11+
12+
- **Chromium auto-install (`BrowserCapability.auto_install`)** — when the Chromium binary is missing,
13+
`BrowserCapability` now automatically runs `playwright install chromium` via the current Python
14+
interpreter before the first agent run. On success the launch is retried immediately; on failure the
15+
browser degrades gracefully (tools hidden, no instructions injected) without crashing the agent.
16+
Controlled via `auto_install: bool = True` on `BrowserCapability`.
17+
18+
### Changed
19+
20+
- **`install.sh` now ships browser support out of the box** — the one-line installer now installs
21+
`pydantic-deep[cli,browser]` (was `[cli]`) and runs `playwright install chromium` automatically.
22+
New users get a fully working browser without any manual steps.
23+
- **Browser tool usage guidance**`BROWSER_INSTRUCTIONS` now includes an explicit "when to use
24+
browser vs web_search / web_fetch" section. The model is instructed to prefer the lighter
25+
`web_search` / `web_fetch` tools for information lookup and static pages, and to reserve the
26+
Playwright browser for interactive workflows (login, forms, JS-heavy SPAs, screenshots).
27+
828
## [0.3.8] - 2026-04-12
929

1030
### Added

install.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,26 @@ fi
5252
echo ""
5353

5454
# ── Step 2: install pydantic-deep ─────────────────────────────────────────────
55-
say "Installing pydantic-deep CLI..."
56-
uv tool install "pydantic-deep[cli]" --upgrade
55+
say "Installing pydantic-deep CLI (with browser support)..."
56+
uv tool install "pydantic-deep[cli,browser]" --upgrade
5757

5858
echo ""
5959

60-
# ── Step 3: verify ────────────────────────────────────────────────────────────
61-
# uv tool executables land in ~/.local/bin — add it for immediate verification
60+
# ── Step 3: install Chromium for browser automation ───────────────────────────
61+
say "Installing Chromium for browser automation..."
62+
# uv tool executables land in ~/.local/bin — ensure it's in PATH
6263
export PATH="$HOME/.local/bin:$PATH"
6364

65+
# playwright entry-point is installed alongside pydantic-deep in the same tool env
66+
if playwright install chromium 2>/dev/null; then
67+
ok "Chromium installed."
68+
else
69+
warn "Chromium install failed — run 'playwright install chromium' manually."
70+
fi
71+
72+
echo ""
73+
74+
# ── Step 4: verify ────────────────────────────────────────────────────────────
6475
if command -v pydantic-deep &>/dev/null; then
6576
VERSION="$(pydantic-deep --version 2>&1 | head -1)"
6677
ok "${VERSION} installed successfully!"

pydantic_deep/capabilities/browser.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,21 @@ async def _auto_install_chromium() -> bool:
7777

7878

7979
BROWSER_INSTRUCTIONS: str = """\
80-
You have access to a real web browser powered by Playwright. Use browser tools to:
80+
You have access to a real web browser powered by Playwright.
8181
82+
**When to use the browser (and NOT web_search / web_fetch):**
83+
- Pages that require login, authentication, or session cookies
84+
- JavaScript-heavy SPAs that don't render without JS
85+
- Interactive workflows: clicking buttons, filling forms, multi-step flows
86+
- Scraping paginated or dynamically loaded content
87+
- Visual debugging — taking screenshots to inspect UI
88+
89+
**When to use web_search / web_fetch instead:**
90+
- Looking up information, documentation, or public articles
91+
- Reading a known URL whose content is static or server-rendered
92+
- Any task that doesn't require interaction — prefer the lighter tools
93+
94+
Browser tools:
8295
- `navigate(url)` — go to a URL and read the page as Markdown
8396
- `click(selector)` — click a CSS selector or pixel coordinates 'x,y'
8497
- `type_text(selector, text)` — fill an input field

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "pydantic-deep"
3-
version = "0.3.8"
3+
version = "0.3.9"
44
description = "Batteries-included agent harness for Python — tool-calling, sandboxed execution, multi-agent teams, and unlimited context on Pydantic AI"
55
readme = "README.md"
66
keywords = [

0 commit comments

Comments
 (0)