Skip to content

docs: fix README library example and add examples section#28

Open
ntegrals wants to merge 1 commit intomasterfrom
docs/readme-improvements
Open

docs: fix README library example and add examples section#28
ntegrals wants to merge 1 commit intomasterfrom
docs/readme-improvements

Conversation

@ntegrals
Copy link
Copy Markdown
Owner

@ntegrals ntegrals commented Apr 1, 2026

Summary

Fixes incorrect code in the README and adds missing sections.

Fixes

Library usage example was broken — used createViewport() and createModel() which don't exist in the API. Replaced with the actual working pattern:

// Before (broken)
import { Agent, createViewport, createModel } from 'open-browser'
const viewport = await createViewport({ headless: true })
const model = createModel('openai', 'gpt-4o')

// After (correct)
import { createAnthropic } from '@ai-sdk/anthropic';
import { Agent, Viewport, VercelModelAdapter } from 'open-browser';
const model = new VercelModelAdapter({ model: anthropic('claude-haiku-4-5-20251001') });
const browser = new Viewport({ headless: true });
await browser.start();

CLI default model was wrong — said gpt-4o but the actual default in run.ts is claude-haiku-4-5-20251001.

Additions

  • Examples section — links to the examples/ directory with usage instructions for basic agent, multi-provider, and visible browser mode
  • ARCHITECTURE.md link — added reference in the Development section

Test plan

  • Library example matches actual API (verified against AgentOptions interface and Viewport class)
  • CLI default model matches run.ts line 71
  • Build passes

Replace incorrect createViewport/createModel API with actual
Viewport + VercelModelAdapter usage, fix default model name,
add examples section linking to examples/, and link to ARCHITECTURE.md.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants