Skip to main content

Multi-agent orchestration for CLI coding agents (Claude Code, Codex, Gemini CLI, and 28 more) — deterministic, declarative, zero vendor lock-in.

Project description

Bernstein

"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 in action: parallel AI agents orchestrated in real time

CI PyPI Python 3.12+ License

Website · Documentation · Getting Started · Glossary · Limitations


What is this? You tell it what you want built. It splits the work across several AI coding agents (Claude Code, Codex, Gemini CLI, and 28 more), runs the tests, and merges the code that actually passes. You come back to working code.

Install and run

One line on macOS / Linux:

curl -fsSL https://bernstein.run/install.sh | sh

Windows (PowerShell):

irm https://bernstein.run/install.ps1 | iex

Then point it at your project and set a goal:

cd your-project
bernstein init                          # creates a .sdd/ workspace
bernstein -g "Add JWT auth with refresh tokens, tests, and API docs"

What you see while it runs:

$ 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.

Why it's different

Most agent orchestrators use an LLM to decide who does what. That's non-deterministic and burns tokens on scheduling instead of code. Bernstein does one LLM call to break down your goal, then the rest — running agents in parallel, isolating their git branches, running tests, routing retries — is plain Python. Every run is reproducible. Every step is logged and replayable.

No framework to learn. No vendor lock-in. Swap any agent, any model, any provider.

Other install options: pipx install bernstein, pip install bernstein, uv tool install bernstein, brew, dnf copr, npx bernstein-orchestrator. See install options.

Supported agents

Bernstein auto-discovers installed CLI agents. Mix them in the same run. Cheap local models for boilerplate, heavier cloud models for architecture.

31 CLI agent adapters: 30 third-party wrappers 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
OpenAI Agents SDK v2 GPT-5, GPT-5 mini, o4 pip install 'bernstein[openai]'
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 --headless for 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

  1. Decompose. The manager breaks your goal into tasks with roles, owned files, and completion signals.
  2. Spawn. Agents start in isolated git worktrees, one per task. Main branch stays clean.
  3. Verify. The janitor checks concrete signals: tests pass, files exist, lint clean, types correct.
  4. 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.

Sandboxing. Pluggable SandboxBackend protocol — run agents in local git worktrees (default), Docker containers, E2B Firecracker microVMs, or Modal serverless containers (with optional GPU). Plugin authors can register custom backends through the bernstein.sandbox_backends entry-point group. Inspect installed backends with bernstein agents sandbox-backends.

Artifact storage. .sdd/ state can stream to pluggable ArtifactSink backends: local filesystem (default), S3, Google Cloud Storage, Azure Blob, or Cloudflare R2. BufferedSink keeps the WAL crash-safety contract by writing locally with fsync first and mirroring to the remote asynchronously.

Skill packs. Progressive-disclosure skills (OpenAI Agents SDK pattern): only a compact skill index ships in every spawn's system prompt, agents pull full bodies via the load_skill MCP tool on demand. 17 built-in role packs plus third-party bernstein.skill_sources entry-points.

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 · Recent features: What's New

Operator commands

Commands that eliminate the glue code most teams end up writing around their runs.

Command What it does
bernstein pr Auto-creates a GitHub PR from a completed session; body carries the janitor's gate results and token/USD cost breakdown.
bernstein from-ticket <url> Imports a Linear / GitHub Issues / Jira ticket as a Bernstein task. Label-based role + scope inference. Supports --dry-run and --run.
bernstein ticket import <url> Alias / group form of from-ticket for scripting.
bernstein remote SSH sandbox backend. remote test <host>, remote run <host> <path>, remote forget <host>. ControlMaster socket reuse for fast repeat calls.
bernstein hooks Lifecycle hooks for pre_task, post_task, pre_merge, post_merge, pre_spawn, post_spawn — shell scripts or pluggy @hookimpls. hooks list, hooks run <event>, hooks check.
bernstein chat serve --platform=telegram|discord|slack Drive runs from chat with /run, /status, /approve, /reject, /switch, /stop.
bernstein approve-tool / bernstein reject-tool Interactive mid-run tool-call approval. --latest, --id, --always.
bernstein tunnel start <port> [--provider auto|cloudflared|ngrok|bore|tailscale] One wrapper around four tunnel providers. Also tunnel list, tunnel stop <name>|--all. ControlMaster-style process reuse.
bernstein daemon install [--user|--system] [--command="..."] [--env KEY=VAL]... Installs a systemd (Linux) or launchd (macOS) unit for auto-start. Also daemon start/stop/restart/status/uninstall.

How it compares

Feature Bernstein CrewAI AutoGen [^autogen] LangGraph
Orchestrator Deterministic code LLM-driven (+ code Flows) LLM-driven Graph + LLM
Works with Any CLI agent (31 adapters) Python SDK classes Python agents LangChain nodes
Git isolation Worktrees per agent No No No
Pluggable sandboxes Worktree, Docker, E2B, Modal No No No
Verification Janitor + quality gates Guardrails + Pydantic output Termination conditions Conditional edges
Cost tracking Built-in usage_metrics RequestUsage Via LangSmith
State model File-based (.sdd/) In-memory + SQLite checkpoint In-memory Checkpointer
Remote artifact sinks S3, GCS, Azure Blob, R2 No No No
Self-evolution Built-in (experimental) No No No
Declarative plans (YAML) Yes Yes (agents.yaml, tasks.yaml) No Partial (langgraph.json)
Model routing per task Yes Per-agent LLM Per-agent model_client Per-node (manual)
MCP support Yes (client + server) Yes Yes (client + workbench) Yes (client + server)
Agent-to-agent chat Bulletin board Yes (Crew process) Yes (group chat) Yes (supervisor, swarm)
Web UI TUI + web dashboard CrewAI AMP AutoGen Studio LangGraph Studio + LangSmith
Cloud hosted option Yes (Cloudflare) Yes (CrewAI AMP) No Yes (LangGraph Cloud)
Built-in RAG/retrieval Yes (codebase FTS5 + BM25) crewai_tools autogen_ext retrievers Via LangChain

Last verified: 2026-04-19. See full comparison pages for detailed feature matrices.

The table above compares Bernstein against LLM-orchestration frameworks (they orchestrate LLM calls). The table below covers the closer category — other tools that orchestrate CLI coding agents:

Feature Bernstein ComposioHQ/agent-orchestrator emdash umputun/ralphex
Shape Python CLI + library + MCP server TypeScript CLI + local dashboard Electron desktop app Go CLI
Primary language Python TypeScript TypeScript Go
Install pipx install bernstein npm install -g @aoagents/ao .dmg / .msi / .AppImage go install / single binary
Agent adapters 31 3 (Claude Code, Codex, Aider) 24 1 (Claude Code only)
Parallel multi-agent execution Yes Yes Yes No (single sequential session)
Git worktree per agent Yes Yes Yes Optional --worktree flag
MCP server mode (exposes self as MCP) Yes (stdio + HTTP/SSE) No No No
Coordinator Deterministic Python scheduler LLM-driven Not documented Linear plan executor
HMAC-chained audit replay Yes No No No
Cross-model verifier / quality gates Yes (multi-stage) No No Multi-phase review (Claude only)
Autonomous CI-fix / PR flow No Yes No No
Visual dashboard TUI + web Web Desktop app Web (--serve)
Notification sinks Planned (v1.9) No No Telegram / Email / Slack / Webhook
Backing Solo OSS Funded (Composio.dev) YC W26 Solo OSS
License Apache 2.0 MIT Apache 2.0 MIT

Bernstein's wedge in this category: Python-native, MCP-server-first, widest adapter coverage, true multi-agent parallelism. If your stack is TypeScript and you want a product with a dashboard, Composio's @aoagents/ao is a better fit; if you want a polished desktop ADE, emdash is; if you only use Claude Code and want a single Go binary that walks a plan top-to-bottom, ralphex is. If you want a primitive that imports into Python, exposes itself over MCP to any client, runs many agents in parallel, and covers the full agent breadth (including Qwen, Goose, Ollama, OpenAI Agents SDK, Cloudflare Agents, and more) — Bernstein.

[^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 skills list    # discoverable skill packs (progressive disclosure)
bernstein skills show <name>  # print a skill body with its references
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
One-liner (macOS / Linux) curl -fsSL https://bernstein.run/install.sh | sh
One-liner (Windows) irm https://bernstein.run/install.ps1 | iex
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

The one-liner scripts check for Python 3.12+, bootstrap pipx when it's missing, fix PATH for the current session, and install (or upgrade) bernstein. They handle brew-managed macOS environments and the Windows py -3 launcher fallback. Script sources: install.sh · install.ps1.

Optional extras

Provider SDKs are optional so the base install stays lean. Pick what you need:

Extra Enables
bernstein[openai] OpenAI Agents SDK v2 adapter (openai_agents)
bernstein[docker] Docker sandbox backend
bernstein[e2b] E2B microVM sandbox backend (needs E2B_API_KEY)
bernstein[modal] Modal sandbox backend, optional GPU (needs MODAL_TOKEN_ID / MODAL_TOKEN_SECRET)
bernstein[s3] S3 artifact sink (via boto3)
bernstein[gcs] Google Cloud Storage artifact sink
bernstein[azure] Azure Blob artifact sink
bernstein[r2] Cloudflare R2 artifact sink (S3-compatible boto3)
bernstein[grpc] gRPC bridge
bernstein[k8s] Kubernetes integrations

Combine extras with brackets, e.g. pip install 'bernstein[openai,docker,s3]'.

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

Star History Chart

License

Apache License 2.0


Made with love by Alex Chernysh · GitHub · bernstein.run

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

bernstein-1.9.0.tar.gz (3.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bernstein-1.9.0-py3-none-any.whl (3.8 MB view details)

Uploaded Python 3

File details

Details for the file bernstein-1.9.0.tar.gz.

File metadata

  • Download URL: bernstein-1.9.0.tar.gz
  • Upload date:
  • Size: 3.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for bernstein-1.9.0.tar.gz
Algorithm Hash digest
SHA256 228ca9d4eb06ac00eefdff5a081498bc576a118984d4fc2ad548603044675bc1
MD5 5f43c5266e11597553e99bf4e9343c46
BLAKE2b-256 525100638b1ffa7dd818bac7de57673c446bb6b2df8663e423aef07ffc86c723

See more details on using hashes here.

File details

Details for the file bernstein-1.9.0-py3-none-any.whl.

File metadata

  • Download URL: bernstein-1.9.0-py3-none-any.whl
  • Upload date:
  • Size: 3.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for bernstein-1.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 44552b87b565b74785e531963d7070dc60064dd3a09902b9275844204cb74c26
MD5 7f8b32d315788b505585a7340aa22941
BLAKE2b-256 7060655ef6d040440de30b46c50ee41a6c12b5278f0a0c81def9fcdf6b01dda8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page