Declarative agent orchestration for engineering teams
Project description
"To achieve great things, two things are needed: a plan and not quite enough time." — Leonard Bernstein
Orchestrate any AI coding agent. Any model. One command.
Bernstein takes a goal, breaks it into tasks, assigns them to AI coding agents running in parallel, verifies the output, and merges the results. When agents succeed, the janitor merges verified work into main. Failed tasks retry or route to a different model.
No framework to learn. No vendor lock-in. Agents are interchangeable workers. Swap any agent, any model, any provider. The task scheduler is plain Python. No LLM calls in selection, retry, or reap decisions.
pipx install bernstein
cd your-project && bernstein init
bernstein -g "Add JWT auth with refresh tokens, tests, and API docs"
$ bernstein -g "Add JWT auth"
[manager] decomposed into 4 tasks
[agent-1] claude-sonnet: src/auth/middleware.py (done, 2m 14s)
[agent-2] codex: tests/test_auth.py (done, 1m 58s)
[verify] all gates pass. merging to main.
Also available via pip, uv tool install, brew, dnf copr, and npx bernstein-orchestrator. See install options.
Wall of fame
"lol, good luck, keep vibecoding shit that you have no idea about xD" — PeaceFirePL, Reddit
Supported agents
Bernstein auto-discovers installed CLI agents. Mix them in the same run. Cheap local models for boilerplate, heavier cloud models for architecture.
17 CLI coding agents plus a generic wrapper for anything with --prompt.
| Agent | Models | Install |
|---|---|---|
| Claude Code | Opus 4, Sonnet 4.6, Haiku 4.5 | npm install -g @anthropic-ai/claude-code |
| Codex CLI | GPT-5, GPT-5 mini | npm install -g @openai/codex |
| Gemini CLI | Gemini 2.5 Pro, Gemini Flash | npm install -g @google/gemini-cli |
| Cursor | Sonnet 4.6, Opus 4, GPT-5 | Cursor app |
| Aider | Any OpenAI/Anthropic-compatible | pip install aider-chat |
| Amp | Amp-managed | npm install -g @sourcegraph/amp |
| Cody | Sourcegraph-hosted | npm install -g @sourcegraph/cody |
| Continue | Any OpenAI/Anthropic-compatible | npm install -g @continuedev/cli (binary: cn) |
| Goose | Any provider Goose supports | See Goose docs |
| IaC (Terraform/Pulumi) | Any provider the base agent uses | Built-in |
| Kilo | Kilo-hosted | See Kilo docs |
| Kiro | Kiro-hosted | See Kiro docs |
| Ollama + Aider | Local models (offline) | brew install ollama |
| OpenCode | Any provider OpenCode supports | See OpenCode docs |
| Qwen | Qwen Code models | npm install -g @qwen-code/qwen-code |
| Cloudflare Agents | Workers AI models | bernstein cloud login |
| Generic | Any CLI with --prompt |
Built-in |
Any adapter also works as the internal scheduler LLM. Run the entire stack without any specific provider:
internal_llm_provider: gemini # or qwen, ollama, codex, goose, ...
internal_llm_model: gemini-2.5-pro
[!TIP] Run
bernstein --headlessfor CI pipelines. No TUI, structured JSON output, non-zero exit on failure.
Quick start
cd your-project
bernstein init # creates .sdd/ workspace + bernstein.yaml
bernstein -g "Add rate limiting" # agents spawn, work in parallel, verify, exit
bernstein live # watch progress in the TUI dashboard
bernstein stop # graceful shutdown with drain
For multi-stage projects, define a YAML plan:
bernstein run plan.yaml # skips LLM planning, goes straight to execution
bernstein run --dry-run plan.yaml # preview tasks and estimated cost
How it works
- Decompose. The manager breaks your goal into tasks with roles, owned files, and completion signals.
- Spawn. Agents start in isolated git worktrees, one per task. Main branch stays clean.
- Verify. The janitor checks concrete signals: tests pass, files exist, lint clean, types correct.
- Merge. Verified work lands in main. Failed tasks get retried or routed to a different model.
The orchestrator is a Python scheduler, not an LLM. Scheduling decisions are deterministic, auditable, and reproducible.
Cloud execution (Cloudflare)
Bernstein can run agents on Cloudflare Workers instead of locally. The bernstein cloud CLI handles deployment and lifecycle.
- Workers. Agent execution on Cloudflare's edge, with Durable Workflows for multi-step tasks and automatic retry.
- V8 sandbox isolation. Each agent runs in its own isolate, no container overhead.
- R2 workspace sync. Local worktree state syncs to R2 object storage so cloud agents see the same files.
- Workers AI (experimental). Use Cloudflare-hosted models as the LLM provider, no external API keys required.
- D1 analytics. Task metrics and cost data stored in D1 for querying.
- Vectorize. Semantic cache backed by Cloudflare's vector database.
- Browser rendering. Headless Chrome on Workers for agents that need to inspect web output.
- MCP remote transport. Expose or consume MCP servers over Cloudflare's network.
bernstein cloud login # authenticate with Bernstein Cloud
bernstein cloud deploy # push agent workers
bernstein cloud run plan.yaml # execute a plan on Cloudflare
A bernstein cloud init scaffold for wrangler.toml and bindings is planned.
Capabilities
Core orchestration. Parallel execution, git worktree isolation, janitor verification, quality gates (lint, types, PII scan), cross-model code review, circuit breaker for misbehaving agents, token growth monitoring with auto-intervention.
Intelligence. Contextual bandit router for model/effort selection. Knowledge graph for codebase impact analysis. Semantic caching saves tokens on repeated patterns. Cost anomaly detection (burn-rate alerts). Behavior anomaly detection with Z-score flagging.
Controls. HMAC-chained audit logs, policy engine, PII output gating, WAL-backed crash recovery (experimental multi-worker safety), OAuth 2.0 PKCE. SSO/SAML/OIDC support is in progress.
Observability. Prometheus /metrics, OTel exporter presets, Grafana dashboards. Per-model cost tracking (bernstein cost). Terminal TUI and web dashboard. Agent process visibility in ps.
Ecosystem. MCP server mode, A2A protocol support, GitHub App integration, pluggy-based plugin system, multi-repo workspaces, cluster mode for distributed execution, self-evolution via --evolve (experimental).
Full feature matrix: FEATURE_MATRIX.md
How it compares
| Feature | Bernstein | CrewAI | AutoGen [^autogen] | LangGraph |
|---|---|---|---|---|
| Orchestrator | Deterministic code | LLM-driven | LLM-driven | Graph + LLM |
| Works with | Any CLI agent (17 adapters) | Python SDK classes | Python agents | LangChain nodes |
| Git isolation | Worktrees per agent | No | No | No |
| Verification | Janitor + quality gates | No | No | Conditional edges |
| Cost tracking | Built-in | No | No | No |
| State model | File-based (.sdd/) | In-memory + SQLite checkpoint | In-memory | Checkpointer |
| Self-evolution | Built-in | No | No | No |
| Declarative plans (YAML) | Yes | Yes | No | Partial (JSON config) |
| Model routing per task | Yes | No | No | Manual |
| MCP support | Yes | Yes | Yes (client) | Yes (client + server) |
| Agent-to-agent chat | Bulletin board | Yes | Yes | No |
| Web UI | TUI + web dashboard | Yes | Yes | Yes (Studio + LangSmith) |
| Cloud hosted option | Yes (Cloudflare) | Yes | No | Yes |
| Built-in RAG/retrieval | Yes (codebase FTS5 + BM25) | Yes | Yes | Yes |
Last verified: 2026-04-17. See full comparison pages for detailed feature matrices.
[^autogen]: AutoGen is in maintenance mode; successor is Microsoft Agent Framework 1.0.
Monitoring
bernstein live # TUI dashboard
bernstein dashboard # web dashboard
bernstein status # task summary
bernstein ps # running agents
bernstein cost # spend by model/task
bernstein doctor # pre-flight checks
bernstein recap # post-run summary
bernstein trace <ID> # agent decision trace
bernstein run-changelog --hours 48 # changelog from agent-produced diffs
bernstein explain <cmd> # detailed help with examples
bernstein dry-run # preview tasks without executing
bernstein dep-impact # API breakage + downstream caller impact
bernstein aliases # show command shortcuts
bernstein config-path # show config file locations
bernstein init-wizard # interactive project setup
bernstein debug-bundle # collect logs, config, and state for bug reports
bernstein fingerprint build --corpus-dir ~/oss-corpus # build local similarity index
bernstein fingerprint check src/foo.py # check generated code against the index
Install
| Method | Command |
|---|---|
| pip | pip install bernstein |
| pipx | pipx install bernstein |
| uv | uv tool install bernstein |
| Homebrew | brew tap chernistry/bernstein && brew install bernstein |
| Fedora / RHEL | sudo dnf copr enable alexchernysh/bernstein && sudo dnf install bernstein |
| npm (wrapper) | npx bernstein-orchestrator |
Editor extensions: VS Marketplace · Open VSX
Contributing
PRs welcome. See CONTRIBUTING.md for setup and code style.
Support
If Bernstein saves you time: GitHub Sponsors
Contact: forte@bernstein.run
Star History
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bernstein-1.8.6.tar.gz.
File metadata
- Download URL: bernstein-1.8.6.tar.gz
- Upload date:
- Size: 1.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41be57709abc8d5246ab13a6e79e598f773ccc413c8a42f88785736b61f5f2af
|
|
| MD5 |
c20cfc547fe4965fe973313a1ffb64fc
|
|
| BLAKE2b-256 |
1dd467b71568ecf499147fbf85d590a5cc41bf630e55536e3b47296ac498c2ce
|
Provenance
The following attestation bundles were made for bernstein-1.8.6.tar.gz:
Publisher:
auto-release.yml on chernistry/bernstein
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bernstein-1.8.6.tar.gz -
Subject digest:
41be57709abc8d5246ab13a6e79e598f773ccc413c8a42f88785736b61f5f2af - Sigstore transparency entry: 1338575989
- Sigstore integration time:
-
Permalink:
chernistry/bernstein@72265f28c1ce5bd5585e736b655c4af5a7b214d4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/chernistry
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
auto-release.yml@72265f28c1ce5bd5585e736b655c4af5a7b214d4 -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file bernstein-1.8.6-py3-none-any.whl.
File metadata
- Download URL: bernstein-1.8.6-py3-none-any.whl
- Upload date:
- Size: 1.1 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e88a54b02cbda28893ce0b0f2ce6511dbe38a5b477928f09f13ea020c9218657
|
|
| MD5 |
3e37833e272645544115b0881df166ba
|
|
| BLAKE2b-256 |
2a0e027148d7f585ecaacaa2e52e0d738e8d017e34d0fac2c3403e27138139d6
|
Provenance
The following attestation bundles were made for bernstein-1.8.6-py3-none-any.whl:
Publisher:
auto-release.yml on chernistry/bernstein
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bernstein-1.8.6-py3-none-any.whl -
Subject digest:
e88a54b02cbda28893ce0b0f2ce6511dbe38a5b477928f09f13ea020c9218657 - Sigstore transparency entry: 1338575990
- Sigstore integration time:
-
Permalink:
chernistry/bernstein@72265f28c1ce5bd5585e736b655c4af5a7b214d4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/chernistry
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
auto-release.yml@72265f28c1ce5bd5585e736b655c4af5a7b214d4 -
Trigger Event:
workflow_run
-
Statement type: