Note: flock currently requires an API like Vivaria's Middleman.
Phases are the fundamental building blocks of workflows in flock. A phase is a Python script that:
- Receives the current state and previous operation results
- Creates new operation requests
- Specifies the updated state
- Specifies the next phase to execute
Each phase has the following signature, with no side effects:
def create_phase_request(state: BaseState) -> List[StateRequest]Where:
state: The current workflow state which includes:- Previous operation results
- Task information
- Workflow history
- Configuration settings
- Returns a list of
StateRequestobjects containing:- Operations to execute
- Next phase to run
- Updated state
Operations are the basic units of work that can be executed by the framework. Each operation has:
- A request type (e.g., bash, python, generate)
- Parameters specific to that operation
- A handler that executes the operation
- A result type that contains the operation output
Core operations include:
bash: Execute shell commandspython: Execute Python codegenerate: Generate text using AI models
flock/
├── handlers/ # Operation handlers
│ ├── base.py # Base handler definitions
│ ├── bash.py # Bash command execution
│ ├── python.py # Python code execution
│ ├── generate.py # AI model generation
│ └── ...
├── type_defs/ # Type definitions
│ ├── base.py # Core type definitions
│ ├── operations.py # Operation types
│ ├── phases.py # Phase types
│ └── states.py # State types
├── utils/ # Shared utilities
│ ├── phase_utils.py # Phase execution utilities
│ ├── state.py # State management
│ └── ...
├── workflows/ # Workflow handling
│ ├── handlers.py # HTTP request handlers
│ └── executor.py # Phase execution
-
HOOKS: Execution in run containers
- Uses pyhooks for integration with Vivaria
-
MIDDLEMAN_SIMULATED: Simulated execution
- Testing environment
- Clone the repository:
git clone https://github.com/poking-agents/flock-public.git
cd flock-public- Install dependencies:
pip install -r requirements.txt- Set up environment variables:
export MIDDLEMAN_API_URL="http://your-middleman-api-url"
export MIDDLEMAN_API_KEY="your-api-key" # Optional: will attempt to use viv config filepython main.py [--log-level DEBUG] [--mode middleman_simulated] [--workflow triframe]