solari-cookbook README

The project's README from github.com/solari-sdk/solari-cookbook. As one markdown file: README.md.

Solari Cookbook

Short, runnable examples for Solari — cloud browsers, sandboxes, and desktops behind one API key.

Every example in this repo is a complete program you can run in under a minute. They are deliberately small: one idea each, no framework, no scaffolding to read past. Copy one into your project and change the parts you care about.

Examples

Cloud browser

Example Language What it shows
browser-quickstart-ts TypeScript Launch a browser, open a page, read it
browser-quickstart-py Python Launch a browser, open a page, read it
browser-stealth-proxy-ts TypeScript Stealth mode + residential proxy egress
browser-profiles-ts TypeScript Log in once, reuse the session forever
browser-login-handoff-ts TypeScript Hand the live session to a human to sign in, then save it
browser-session-recording-py Python Record a session, download the replay
browser-page-assertions-py Python Reject a wrong page even when navigation and screenshots succeed
browser-workers-cdp-ts TypeScript Drive a browser from a Cloudflare Worker, over raw CDP
browser-playwright-runner-ts TypeScript Run your existing Playwright suite on Solari, no local Chromium
eu-consent-evidence-ts TypeScript Pre-consent tracker evidence via raw CDP

Sandbox

Example Language What it shows
sandbox-quickstart-ts TypeScript Run a command, write and read files
sandbox-quickstart-rb Ruby Same, with no SDK and no gems — stdlib only
sandbox-code-interpreter-py Python Stateful Python kernel for agent loops
sandbox-snapshot-fork-py Python Seed a snapshot, fork clones, and verify each restored the exact file digest
sandbox-port-preview-ts TypeScript Expose a server in the VM on a public URL
sandbox-scan-untrusted-code-ts TypeScript Run untrusted code and capture what it did (audit hook)

Multi-product

One key spans all three, so an example can use more than one at once.

Example Language What it shows
form-delivery-check-ts TypeScript Submit a form in a browser, verify the lead landed in a sandbox
security-posture-review-ts TypeScript Browser and sandbox running concurrently on one key

Desktop

Example Language What it shows
desktop-computer-use-py Python Screenshot, click, and type on a Linux GUI

Applications

Bigger programs built on Solari — a CLI or a UI, its own modules, solving a whole problem rather than showing one call. See applications/.

Running an example

Each directory is self-contained.

git clone https://github.com/solari-sdk/solari-cookbook.git
cd solari-cookbook/examples/browser-quickstart-ts

npm install                          # or: pip install -r requirements.txt
export SOLARI_API_KEY=slr_live_...   # grab one at console.getsolari.com
npm start                            # or: python main.py

One slr_live_ key works across browsers, sandboxes, and desktops, and every product bills to the same balance.

Which product do I want?

Gotchas the examples encode

Things that cost you an afternoon if you meet them cold:

Contributing

New examples are welcome. Keep them small, make them run end-to-end against the real API, and put anything surprising in a comment right where it bites.

MIT licensed.

solari-cookbook (solari-sdk/solari-cookbook)

Searching Database…

这是什么?一份 Solari 的可运行小型示例程序指南。Solari 是一项通过单一 API 密钥为你提供云浏览器、沙盒和桌面虚拟机的服务。
它是一个库,还是只是一堆示例脚本?它是一组独立的示例脚本,每个文件讲一个主题,供你复制到自己的项目中使用,而不是作为包导入;每个示例都直接调用真实的 Solari API。
怎么运行其中一个示例?每个示例目录都是自包含的:打开你想要的那个(如 browser-quickstart-py 或 sandbox-quickstart-ts),配上 Solari API 密钥运行即可;一把密钥可用于浏览器、沙盒和桌面。
示例用什么语言编写?需要 API 密钥吗?示例用 TypeScript、Python 和 Ruby 编写(其中一个只使用 Ruby 标准库,无需 SDK)。运行任何一个示例都需要 Solari API 密钥。
把这些示例复制到自己的代码里有哪些坑?浏览器配置文件只恢复 cookie,不恢复 localStorage,除非你把 storageState 传入 newContext();沙盒命令不经 shell 解释,所以 run('ls -la') 会按字面名称查找对应的可执行文件;会话录制是异步上传的,停止后回放端点最多在约 30 秒内会返回 404;TypeScript SDK 无法在 Cloudflare Workers 等边缘运行时上运行,因为它打包了一个依赖 Node 的 Playwright 分支版本。
我该用云浏览器、沙盒还是桌面产品?凡是你在网页上用 Playwright 或 Puppeteer 做的事,加上隐身和托管代理,都用云浏览器;当你需要在微虚拟机中运行代码(如 LLM 的 Python 或不可信构建),且该虚拟机约一秒内可从快照启动时,用沙盒;当你需要可点击的屏幕(如计算机操作智能体或 GUI 应用)时,用桌面产品。
「applications」文件夹是做什么的?它存放基于 Solari 构建的更大程序——带自己模块、能解决完整问题的完整 CLI 或 UI,与主目录中单一主题的示例不同。
能把现有的 Playwright 测试套件跑在 Solari 上吗?可以——browser-playwright-runner-ts 演示了把测试套件连接到 Solari 的会话 CDP 端点而非本地 Chromium,这也绕过了 Playwright 受版本限制的通信协议。
sandbox 快照/派生示例演示了什么?sandbox-snapshot-fork-py 先创建一次快照,从中派生出多个克隆,并验证每个克隆恢复出的文件摘要完全一致,适合快速、可复现的智能体环境。
在 TypeScript 中关闭浏览器会让脚本挂起吗?从 @solarisdk/browser 0.1.3 起不会了——现在单独调用 browser.close() 就能干净退出;在该版本之前你还必须调用 solari.close(),否则脚本会因一个未关闭的回环监听器而挂起。
Creator
solari-sdk
Size
0.5 MB
Stars
192
Updated
CommitSep 28
Age
2mo
Commits · 90 Days