BeaverFlow is a minimal agent workflow framework that makes research automate and systematic:
BeaverFlow does two things on purpose:
- It defines a practical AI ↔ Codex agent loop that can handle non-trivial engineering tasks while keeping
taskandacceptanceas separate truths. - It defines a lightweight multi-agent composition model (
A->B,A and B,loop(...)) so workflows can be assembled like building blocks.
The core split is intentional:
agent.pyruns one agent and enforcestask,acceptance, and optionalmindset.agent_workflow.pycomposes multiple agents with a small workflow DSL such asA->B,A and B, andloop(A->B, 3).
taskandacceptancestay separate.mindsetis optional. If omitted,agent.pyuses its built-in default engineering mindset.loop(...)is mechanical repetition. It does not stop early.- Workflow-side agent definitions use class style only:
A = Agent(
name="A",
script="./agent.py",
workspace=WORKSPACE,
task=A_TASK,
acceptance=A_ACCEPTANCE,
)Required fields:
namescriptworkspacetaskacceptance
Optional fields include mindset, max_rounds, reset, dry_run, ai_model, codex_model, and codex_timeout_s.
When an agent runs, BeaverFlow writes runtime state under the shared workspace:
<workspace>/
.agents/<agent-id>/...
.workflow/shared/<channel>/...
These runtime directories are intentionally ignored by Git.
- Python 3.10+
openaiPython packagecodexCLI available inPATH- the environment needed by your own task
Create a virtual environment and install dependencies:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtRun the minimal sample in dry-run mode:
python3 agent_workflow_sample.pyIt prints the commands that would be executed. To run it for real, set DRY_RUN = False in agent_workflow_sample.py and make sure your OpenAI and Codex environment is ready.
BeaverFlow needs both:
OPENAI_API_KEYcodexCLI inPATH
npm install -g @openai/codex
codex --version
which codexexport OPENAI_API_KEY="your_api_key_here"
echo "${OPENAI_API_KEY:+set}"python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtDry run:
python3 agent_workflow_sample.pyReal run:
- Set
DRY_RUN = Falseinagent_workflow_sample.py - Run again:
python3 agent_workflow_sample.pySingle agent:
python3 agent.py \
--workspace ./demo_ws \
--task "Implement feature X" \
--acceptance "All tests pass"codex: command not found: make sure npm global bin is inPATH.- OpenAI auth error: check
OPENAI_API_KEY. - Only prints commands:
DRY_RUNis stillTrue.
Supported workflow expressions:
A->B
A and B
loop(B, 20)
loop(A->B, 3)
A->loop(B, 20)
Semantics:
A->B: runA, thenB, on the same channelA and B: run both branches and write a branch manifestloop(X, n): runXexactlyntimes
There is no retry primitive in the current design.
A small writer/checker demo. It bootstraps one toy spec file under demo_ws and shows the basic loop shape.
An automatic alpha/feature research project.
At the workflow layer, Agent.task, Agent.acceptance, and Agent.mindset are rendered as text templates. The workflow writes them into .workflow/rendered/... and then passes them to agent.py via @file arguments.
At the CLI layer, agent.py itself supports both inline text and @path for --task, --acceptance, and --mindset.
This repository is released under the MIT License.