A visual graph builder for creating Burr workflows with an intuitive drag-and-drop interface. Build complex state machine workflows visually and export them as boilerplate Burr Graph in Python.
from typing import Tuple
from burr.core import State, default, when
from burr.core.action import action
from burr.core.graph import GraphBuilder
@action(reads=[], writes=[])
def prompt(state: State, prompt: str) -> Tuple[dict, State]:
"""This is a stub implementation. Please complete this action with your business logic."""
return {}, state
@action(reads=[], writes=[])
def check_safety(state: State) -> Tuple[dict, State]:
"""This is a stub implementation. Please complete this action with your business logic."""
return {}, state
@action(reads=[], writes=[])
def decide_mode(state: State) -> Tuple[dict, State]:
"""This is a stub implementation. Please complete this action with your business logic."""
return {}, state
@action(reads=[], writes=[])
def unsafe_response(state: State) -> Tuple[dict, State]:
"""This is a stub implementation. Please complete this action with your business logic."""
return {}, state
@action(reads=[], writes=[])
def generate_code(state: State, model: str) -> Tuple[dict, State]:
"""This is a stub implementation. Please complete this action with your business logic."""
return {}, state
@action(reads=[], writes=[])
def answer_question(state: State, model: str) -> Tuple[dict, State]:
"""This is a stub implementation. Please complete this action with your business logic."""
return {}, state
@action(reads=[], writes=[])
def generate_poem(state: State, model: str) -> Tuple[dict, State]:
"""This is a stub implementation. Please complete this action with your business logic."""
return {}, state
@action(reads=[], writes=[])
def prompt_for_more(state: State) -> Tuple[dict, State]:
"""This is a stub implementation. Please complete this action with your business logic."""
return {}, state
def create_burr_graph():
"""Create the Burr graph for the project."""
return (
GraphBuilder()
.with_actions(
prompt,
check_safety,
decide_mode,
unsafe_response,
generate_code,
answer_question,
generate_poem,
prompt_for_more,
)
.with_transitions(
("prompt", "check_safety", default),
("check_safety", "decide_mode", when(safe=True)),
("check_safety", "unsafe_response", default),
("decide_mode", "generate_code", when(mode="generate_code")),
("decide_mode", "answer_question", when(mode="answer_question")),
("decide_mode", "generate_poem", when(mode="generate_poem")),
("decide_mode", "prompt_for_more", default),
("generate_code", "prompt", default),
("answer_question", "prompt", default),
("generate_poem", "prompt", default),
("unsafe_response", "prompt", default),
("prompt_for_more", "prompt", default),
)
.build()
)
graph = create_burr_graph()
if __name__ == "__main__":
print("Burr graph created successfully.")
print(graph)
# You can now use `graph` in your Burr application.- Visual Workflow Design: Create Burr workflows using an intuitive ReactFlow-based interface
- Node Types: Support for input nodes (parameters) and action nodes
- Smart Code Generation: Automatically generates Python code with proper action signatures including input parameters
- Example Gallery: Pre-built workflow examples to get you started quickly
- Real-time Editing: Edit node labels and descriptions directly in the graph
- Export Options: Export workflows as Python code or JSON format
- Input Node Intelligence: Input nodes are treated as parameters to target actions, not separate actions
- Visual Flow Indicators: Edges display arrow heads pointing to target nodes for clear flow direction
- Keyboard Shortcuts: Quick node creation with Cmd+Click (action nodes) and Cmd+Right-Click (input nodes)
- Node.js 18+
- npm or yarn
- Python 3.11+ (for running generated Burr workflows)
- Clone the repository:
git clone <repository-url>
cd burr_graph_builder- Install frontend dependencies:
npm install- Install Python dependencies (optional, for testing generated workflows):
uv sync- Start the development server:
npm start- Open your browser and navigate to
http://localhost:3000
- Start Building: Begin by adding nodes to the canvas using keyboard shortcuts
- Add Action Nodes: Cmd+Click anywhere on the canvas to create action nodes (Burr actions)
- Add Input Nodes: Cmd+Right-Click anywhere on the canvas to create input nodes (parameters)
- Connect Nodes: Draw edges between nodes to define the workflow flow (edges show arrow heads pointing to target nodes)
- Add Conditions: For conditional edges, add condition labels for decision logic
- Appearance: Mid-gray dashed rectangles with white backgrounds
- Purpose: Represent parameters/inputs to actions
- Naming Convention: Use format like "input: prompt" or "input: model"
- Code Generation: Become parameters in the target action function signature
- Appearance: Colored solid rectangles with pastel backgrounds
- Purpose: Represent Burr actions that perform business logic
- Code Generation: Become
@actiondecorated functions
The application includes a streaming chatbot workflow example that demonstrates:
- Input parameters (prompt, model)
- Safety checking
- Conditional logic for different response modes
- Return loops for continuous interaction
When you export your workflow, the application generates:
- Action Functions: Each action node becomes a Burr action with proper parameters:
@action(reads=[], writes=[])
def prompt(state: State, prompt: str) -> Tuple[dict, State]:
"""This is a stub implementation. Please complete this action with your business logic."""
return {}, state- Graph Builder: A function that constructs the Burr graph with all transitions:
def create_burr_graph():
"""Create the Burr graph for the project."""
return (
GraphBuilder()
.with_actions(prompt, check_safety, decide_mode, ...)
.with_transitions(
("prompt", "check_safety", default),
("check_safety", "decide_mode", when(safe_true=True)),
# ... more transitions
)
.build()
)- Stub Documentation: All generated functions include docstrings indicating they need completion
- Use descriptive names like "input: user_message" or "input: model_name"
- Connect input nodes directly to the action nodes that need those parameters
- Input nodes don't need outgoing connections to multiple nodes
- Use clear, action-oriented names like "validate_input", "generate_response"
- Add descriptions to document what each action should do
- Consider the data flow between actions
- Use descriptive condition names like "is_safe", "mode_generate_code"
- Group related conditional edges for better organization
- Always provide a default path for unmatched conditions
- Generates complete Burr workflow code
- Includes all necessary imports
- Creates stub functions ready for implementation
- Preserves workflow structure and conditions
- Exports workflow definition as structured JSON
- Useful for version control and sharing
- Can be imported back into the graph builder
npm start- Start development servernpm run build- Build for productionnpm test- Run testsnpm run eject- Eject from Create React App (use with caution)
- Frontend: React 18 + TypeScript + Create React App
- Graph Library: @xyflow/react (ReactFlow)
- UI Components: Material-UI (MUI)
- Styling: CSS-in-JS with MUI's sx prop
src/
├── components/
│ ├── CustomNode.tsx # Node rendering component
│ ├── CustomEdge.tsx # Edge rendering component
│ ├── GraphBuilder.tsx # Main graph interface
│ ├── ExampleGallery.tsx # Example workflows gallery
│ └── ConfirmLoadExampleDialog.tsx
├── data/
│ └── examples.ts # Pre-built workflow examples
├── utils/
│ ├── BurrCodeGenerator.ts # Python code generation
│ ├── GraphExporter.ts # JSON export functionality
│ └── ExampleLoader.ts # Example loading utilities
└── App.tsx # Main application component
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
The generated Python code is designed to work seamlessly with Burr:
- Install Burr:
pip install burr[start] - Use Generated Code: Copy the exported Python code to your project
- Implement Actions: Replace stub implementations with your business logic
- Run Workflow: Use Burr's execution engine to run your workflow
Example integration:
from burr.core import Application
# Your generated create_burr_graph function
graph = create_burr_graph()
# Create and run application
app = Application.from_graph(
graph=graph,
initial_state={},
)
# Execute the workflow
action, result, state = app.run(halt_after=['final_action'])This project is licensed under the MIT License - see the LICENSE file for details.

