How dagworks-inc/burr works
Main Components
• Core State Machine Engine – This is implemented primarily in the burr/core directory. It contains modules for actions (burr/core/action.py), application building (burr/core/application.py), graph/data flow (burr/core/graph.py), persistence (burr/core/persistence.py), serialization/deserialization (burr/core/serde.py), and state management (burr/core/state.py). This is the heart of the framework.
• CLI / Entry Point – The burr/cli package (e.g., burr/cli/__main__.py and demo_data.py) acts as the command-line launcher and demonstration executor to kick off state machine runs.
• Integrations and Extensibility – The burr/integrations package adds support for several external services and modules (e.g., Hamilton, Haystack, opentelemetry, notebook interface) as well as persisters (in burr/integrations/persisters) and serializers (in burr/integrations/serde) that can interface with external systems.
• Telemetry and Tracking – There is a dedicated telemetry layer seen in burr/telemetry.py, and an extensive tracking subsystem in burr/tracking alongside the server code (including S3 deployment) and demo data. This component captures and logs execution traces and state changes.
• Lifecycle & Visibility – Packages like burr/lifecycle and burr/visibility encapsulate lifecycle event management and the visibility (tracing/debugging) aspects so that state transitions can be monitored and analyzed easily.
• UI Component – The telemetry UI is separate from the core library and resides under the telemetry/ui directory, built with TypeScript/React. It provides an interactive real-time interface to view execution flow, logs, and metrics.
• Examples and Documentation – The examples directory and docs illustrate many use-cases, ranging from simple counter apps to complex chatbots and integrations with other libraries (e.g., Hamilton, Ray, streamlit).
Relationships and Interactions
• The CLI (or an API call) initiates an application built by the ApplicationBuilder from the core module.
• The core engine invokes ‘actions’ (Python functions decorated with @action) arranged in the state machine graph, transitioning the application’s state.
• As actions execute, state updates along with persistence (using the persisters provided in the integrations) and telemetry tracking (via the tracking modules) are recorded.
• The tracking data is then fed into the Telemetry UI for real-time monitoring and debugging.
• Integrations act as adapters: they translate calls from the core (for serialization, logging, or external API calls) into operations in external systems.
• Lifecycle and visibility components are invoked during state transitions to provide hooks and additional debugging support.
Important Architectural Patterns and Principles
• Modular State Machine Architecture – Each state machine is constructed from decoupled actions, transitions, and data flow managed by the core modules.
• Extensibility by Integration – The design emphasizes plug-and-play integrations for persistence, telemetry, and external service connections.
• Separation of Concerns – The architecture cleanly distinguishes between core logic (state management and transitions), external integrations/persistence, and the monitoring/UI layer.
• Multi-layered Approach – The design covers command-line interfaces, backend processing via the core engine, and a front-end UI for visualization, connecting through telemetry/tracking layers.
Relevant Technologies and Frameworks
• Python is the primary language with a focus on state machine and workflow orchestration.
• The Telemetry UI is built using a modern web stack (React/TypeScript), as indicated by the telemetry/ui directory.
• Integrations include support for popular tools (Hamilton, Ray, opentelemetry, etc.), hinting at interoperability with asynchronous workflows and external APIs.
• Build and test tools (GitHub Actions workflows, pre-commit configuration, etc.) are part of the supporting infrastructure.
• Clear, labeled nodes/components for:
• Core Engine (State Machine, Actions, Transitions)
• CLI / Entrypoint
• Integration Adapters (with sub-nodes for persisters, serializers, third-party integrations)
• Telemetry & Tracking Engine
• UI Dashboard Module (Telemetry UI)
• Lifecycle & Visibility (Hooks and debugging)
• Flow from CLI or application invocation → Core Engine → Action execution → State updates.
• Data persistence flows from the core engine to various integration persisters.
• Telemetry data flowing from tracking modules to the UI.