Steadfast
Skip to content
Initializing search
getsteadfast/steadfast
Examples
Documentation
Why an open-core SaaS exists
Project layout
Contributing
License
Getting started
Auth & sessions
Anti-detection
Blog
Examples
Documentation
Why an open-core SaaS exists
Project layout
Contributing
License
Steadfast¶
Browser agents that don't lose their sessions.
Steadfast is a Python library for running headless-browser automation<br>across multiple accounts and platforms — with anti-detection, session<br>persistence, and per-account isolation built in.
⚠️ Status: pre-alpha. APIs may shift before v0.1.0. Pin a commit if<br>you depend on this in production today.
Why Steadfast?¶
Every browser-agent platform — Stagehand, Browser Use, Skyvern, Anchor<br>Browser, Hyperbrowser — has the same #1 customer complaint:
"My agent gets logged out every 4 hours."
That's a solved problem. Steadfast solves it like this:
Feature<br>Steadfast<br>Vanilla Playwright<br>Stagehand / Browser Use
Per-account fingerprint isolation<br>partial
Anti-detect init scripts built in<br>partial
Cookie import from browser extension<br>manual<br>manual
Session capture via VNC (manual login)
Session persistence across runs<br>manual<br>partial
Sticky viewport + UA + proxy per account<br>manual
Old-reddit + new-reddit auto-fallback
Quickstart¶
bash<br>pip install steadfast-browser # dist name on PyPI<br>playwright install chromium
Note on the name: the package is installed as steadfast-browser<br>on PyPI (the bare steadfast name was taken by an unrelated 2023<br>package), but it imports as steadfast — so pip install steadfast-browser,<br>then from steadfast import ... in your code.
```python<br>import asyncio<br>from pathlib import Path<br>from steadfast import AntiDetect, BrowserManager, BrowserManagerConfig<br>from steadfast.platforms import Twitter
async def main():<br>bm = BrowserManager(<br>BrowserManagerConfig(profiles_dir=Path("./profiles")),<br>AntiDetect(),<br>await bm.start()
twitter = Twitter(bm, account_key="my_twitter")<br>await twitter.import_cookies(open("twitter_cookies.json").read())<br>assert await twitter.ensure_logged_in()
result = await twitter.post("Hello from Steadfast!")<br>print(result.url)
await bm.shutdown()
asyncio.run(main())<br>```
That's it. No login flow, no captcha solver, no session-expiry handling<br>in your code. The cookies you imported keep working for weeks.
What's in v0.1.0¶
Platforms¶
Platform<br>Auth<br>Post<br>Reply / Comment<br>Like / Upvote<br>Health check
Twitter / X<br>cookies / login
LinkedIn<br>cookies / login<br>✅ (comment)
Reddit<br>cookies / login<br>✅ (comment)<br>✅ (upvote)
Core library¶
BrowserManager — Playwright pool with per-account contexts, concurrency limits, lifecycle helpers.
AntiDetect — sticky proxies, sticky user agents, sticky viewports, human-like delays + clicks + typing, plus anti-automation init scripts injected into every context.
RemoteDisplay — optional virtual-display + VNC server for manual-login flows on headless servers.
PostResult — slotted dataclass returned by every post/reply/comment.
Exception hierarchy¶
python<br>SteadfastError<br>├── BrowserError # Playwright launch / context creation<br>├── ProxyError # proxy pool issues<br>└── PlatformError # base for platform-specific errors<br>├── LoginFailed<br>├── RateLimited<br>└── AccountSuspended
Examples¶
See examples/ for runnable scripts:
File<br>Demonstrates
01_twitter_post.py<br>Simplest possible post
02_linkedin_with_cookies.py<br>Cookie import + post (recommended auth pattern)
03_reddit_comment.py<br>old.reddit / new.reddit auto-fallback
04_session_save_restore.py<br>Sessions survive BrowserManager restart
05_multi_account.py<br>Two accounts running concurrently on one BM
Documentation¶
Getting started — install, first run, troubleshooting
Auth & sessions — the wedge, explained
Anti-detection — what's in the init script and why
Why an open-core SaaS exists¶
The library above runs anywhere. But running it at scale — many tenants,<br>each with many accounts, with observability, retries, scheduling, and<br>session-rescue automation — is operational work most engineers don't want<br>to write.
The hosted version of Steadfast does that part, billed monthly. More info<br>at (coming soon).
Project layout¶
steadfast/<br>__init__.py # public exports<br>browser_manager.py # Playwright pool<br>anti_detect.py # proxies, UAs, viewports, human-like helpers<br>exceptions.py # error hierarchy<br>remote_display.py # Xvfb + x11vnc for manual-login flows<br>_log.py # KV-rendering logging adapter<br>utils.py # small helpers (utcnow, async_retry, ...)<br>platforms/<br>twitter.py<br>linkedin.py<br>reddit.py<br>_models.py # PostResult dataclass<br>tests/ # 85 tests,
Contributing¶
Bug reports + PRs welcome on GitHub. Before submitting:
bash<br>pip install -e ".[dev]"<br>ruff check steadfast/ tests/<br>pytest -q
The full test suite runs in under one second and doesn't require launching<br>a real browser — most of the real-browser code paths are tested via the<br>examples on real platforms.
License¶
Apache 2.0 with Commons Clause —...