Example prompt
We have a browser script at ./integration.ts that automates going to Hacker News and getting the first 10 posts. Convert it to direct network scripts instead. Use the Libretto skill.The agent runs the existing script, examines the captured network log, identifies the API endpoints that return the data, and rewrites the integration to call them directly from within the browser context.
The process
Run the existing script and capture traffic
.libretto/sessions/<session>/network.jsonl.Examine the network log
Run a site security review
Before committing to a network-first approach, the agent checks whether direct API calls are safe on this site:
- Is there enterprise bot protection (Akamai, PerimeterX, Cloudflare)?
- Is
window.fetchmonkey-patched to inspect call stacks? - Does the site do API-level monitoring?
Choose the right network approach
- In-browser fetch
- Passive interception
Call endpoints from within the browser’s JavaScript context. The requests share the browser’s cookies, TLS fingerprint, and origin — they look identical to requests the site’s own code would make.Use this when the site has no bot protection and
fetch is not monkey-patched.When to use direct network calls
The network approach is the default preference for new integrations. Use it when:- The site exposes a usable JSON API
- You need to paginate deeply (fetching page 50 without clicking “next” 49 times)
- You want data the UI doesn’t display (hidden fields, metadata, IDs)
- Speed and reliability matter more than DOM fidelity
When not to use the network approach
Security analysis
The Libretto skill includes a site-security review reference that guides your agent through checking for bot protection services, fetch interception, and challenge flows. The agent uses this to produce a Site Assessment Summary before choosing an integration strategy:Related guides
One-shot script generation
Start from scratch — give your agent a goal and let it build the workflow.
Debugging workflows
Reproduce failures and fix broken automations interactively.