feat(workflow): YAML workflow manifest + bernstein workflow CLI#1117
Merged
chernistry merged 2 commits intomainfrom May 8, 2026
Merged
feat(workflow): YAML workflow manifest + bernstein workflow CLI#1117chernistry merged 2 commits intomainfrom
chernistry merged 2 commits intomainfrom
Conversation
Contributor
AI Review (Gemini)PR Review: Bernstein Workflow ManifestsSummaryThis PR introduces a significant new feature to Bernstein: Archon-inspired YAML workflow manifests. This allows users to define declarative Directed Acyclic Graphs (DAGs) of agent, command, and loop nodes, offering a more structured approach than the existing goal-based execution. The implementation includes a new Pydantic v2 schema for workflow definitions |
cb73848 to
5f6fada
Compare
Adds an Archon-inspired YAML workflow surface that runs in parallel to the open-ended `bernstein run -g <goal>` entry. Manifests are validated with Pydantic v2, executed by a dedicated DAG runner, and dispatch agent-typed nodes through the existing AgentSpawner.spawn_for_tasks path so there is no parallel spawn pipeline to maintain. * core/workflows/workflow_spec.py: WorkflowSpec, WorkflowNode, LoopSpec with cycle / missing-dep / duplicate-id / kind-exclusivity validation, topological layering, and bundled+user discovery. * core/workflows/workflow_runner.py: parallel layer execution, command shellout with timeout, agent dispatch via AgentSpawner, loop predicate re-fire (max_iterations cap), fresh-context iteration via fresh task ids, and a stub for `interactive: true` that raises NotImplementedError pointing at #1110. * cli/commands/workflow_cmd.py: extended `bernstein workflow` group with `run`, `init`, and dual-mode `validate`/`list` that auto-detect manifest flavour so the legacy DSL keeps working. * templates/workflows/: 6 stock manifests (idea-to-pr, refactor-with-tests, security-review, doc-update, dependency-bump, hot-fix) shipped via the hatch wheel force-include. * tests/unit/test_workflow_spec.py: 28 cases covering parse round-trip, cycle / missing-dep / duplicate / self-dep rejection, kind-exclusivity, versioning, loop semantics, discovery, shadowing, and stock-workflow loading. * tests/integration/test_workflow_runner.py: 14 cases covering linear DAG, fan-out parallel, loop-until-pass, max_iterations exhaustion, fresh- context iteration, real-AgentSpawner dispatch, command timeout, audit emission, malformed YAML, and missing-template resolution. * README.md: new "YAML workflow manifests" section with stock-workflow table, slotted right after the install block. Closes #1108. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5f6fada to
60aef0e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
bernstein workflow run|init|validate|listsurface that runs in parallel to the open-endedbernstein run -gentrypoint, validated up-front with Pydantic v2 and dispatched through the existingAgentSpawner.spawn_for_taskspath (no parallel spawn pipeline).interactive: truestub that points at feat(orchestration): explicit human-approval gates as first-class task config #1110.Shape
src/bernstein/core/workflows/{__init__,workflow_spec,workflow_runner}.py— schema + DAG runner.src/bernstein/cli/commands/workflow_cmd.py— extended group withrun/initand dual-modevalidate/list(auto-detect manifest flavour so the legacy DSL keeps working).templates/workflows/*.yaml— 6 stock manifests, registered inpyproject.toml[tool.hatch.build.targets.wheel.force-include].tests/unit/test_workflow_spec.py+tests/integration/test_workflow_runner.py.workflowalready inDOCUMENTED_COMMANDS.Test plan
uv run pytest tests/unit/test_workflow_spec.py tests/integration/test_workflow_runner.py tests/unit/test_workflow_dsl.py tests/unit/test_readme_api_coverage.py(111 passed)uv run ruff check src/bernstein/core/workflows src/bernstein/cli/commands/workflow_cmd.py tests/unit/test_workflow_spec.py tests/integration/test_workflow_runner.py(clean)uv run ruff format --check(clean for new files)bernstein workflow list --bundled-only,bernstein workflow validate templates/workflows/idea-to-pr.yaml,bernstein workflow run idea-to-pr --dry-run,bernstein workflow init scratch-test --target /tmp/...Closes #1108.
🤖 Generated with Claude Code