Getting Started
Train browser agents on realistic, deterministic playgrounds built from your recordings.
What is Trayn?
Browser agents need to practice on real websites — but real websites change constantly (A/B tests, inventory, auth walls). Hand-built clones take months and don't match production.
Trayn turns a single recorded workflow into a fully interactive playground — same screens, same buttons, same behavior. Every time. Forever. Then your agent trains on it and learns from its mistakes.
| Approach | Realistic | Deterministic | Scales |
|---|---|---|---|
| Live websites | Yes | No | — |
| Hand-built clones | No | Yes | No |
| Trayn | Yes | Yes | Yes |
Installation
The SDK requires Playwright. Install browsers after:
Quick Start
Install the browser extension
Install the Trayn browser extension (Chrome or Firefox). This captures your workflow — every screen state and every interaction.
Record a workflow
Navigate to any website and click Record in the extension. Complete the workflow you want your agent to learn — searching, clicking, filling forms, anything. When done, hit Stop.
View in the Trayn app
Open app.trayn.ai. Your recordings appear in the timeline. Trayn processes each recording:
- Anonymize — All personal data (names, emails, avatars) is detected and replaced entirely offline in your browser before anything is stored.
- Create playground — Trayn generates a hyper-realistic, fully interactive clone of the original application. Every button, input, dropdown, and navigation works as an agent would expect on the real site — not a replay, but a standalone environment.
- Generate task — AI analyzes the recording and creates a task definition with goal text, verifiers, and expected actions.
Train your agent
Point the CLI at the playground. The SDK fetches the task, launches a browser, runs your agent, grades it, and stores memories for learning.
Authentication
On first run, the CLI prompts for your email. This links runs to your Trayn account.
CLI Reference
| Flag | Type | Default | Description |
|---|---|---|---|
--url | string | — | Playground URL (primary workflow) |
--agent | string | trayn | Agent to use (trayn or openclaw) |
--max-steps | number | 5 | Maximum actions per task |
--reps | number | 3 | Repetitions (rep 1 = baseline, rep 2+ = with memory) |
--headless | boolean | false | Run browser without UI |
--verbose | boolean | false | Show accessibility tree previews |
--debug | boolean | false | Enable debug logging |
--grader-endpoint | string | Trayn API | Custom grading endpoint (or none to skip) |
--session-id | string | auto | Override session ID |
--confirm | boolean | false | Review and edit the task before running |
Examples
Run against a recorded playground with visible browser:
Use the OpenClaw agent instead of the built-in TraynAgent:
Programmatic Usage
Pluggable Architecture
Every layer of the SDK is replaceable via dependency injection. Swap any adapter to customize behavior:
| Adapter | Interface | Default | Docs |
|---|---|---|---|
| Grading | GraderAdapter | HttpGraderAdapter (Trayn API) | Grading |
| Retrieval | RetrieverAdapter | DefaultRetriever (IoU + cosine) | Retrieval |
| Storage | StorageAdapter | Cloud storage (built-in) | Storage |
| Embeddings | EmbeddingAdapter | GoogleEmbeddingAdapter | Embeddings |