Verifiable Logic.
Host-Core Symbiosis.
Heddle strictly separates declarative orchestration (Control Plane) from imperative execution (Data Plane). By mediating Python steps via zero-copy Arrow memory, it ensures logic is verifiable, auditable, and performant.
import "io/http" as http
import "std/transform" as transform
import "std/log" as log
// 1. Define the shape of your data
// Schemas are enforced at compile-time for zero-runtime overhead
schema User = {
id: int,
name: string,
email: string,
active: bool
}
// 2. Define an atomic step
// Steps are pure functions that operate on immutable Arrow frames
step fetch_users -> User = http.get {
url: "https://api.example.com/users"
}
// 3. Define the main workflow
workflow process_active_users {
fetch_users
| transform.filter { condition: "active == true" }
| ( // 4. Use first-class PRQL for transformation
// Zero-copy projections on the underlying Arrow batch
from input
select id, name, email
)
| log.info { message: "Processed active users" }
}Functional Flow, Imperative Steps
Heddle resolves the conflict between imperative business operations and functional data lineage. Atomic steps encapsulate side effects within the Host Environment, while workflows define a strict, declarative topology. This structure ensures the logic graph is deterministic and amenable to static analysis.
// 1. Import imperative logic from the Python Host Environment
// These bindings execute via Ray, allowing full access to PyTorch/TensorFlow
import "fhub.dev/deeplearning/models" as ml
import "std/database" as db
// 2. Define steps that wrap this logic
step load_model = ml.load_fraud_model {
model_path: "/models/v1/fraud.bin"
}
step run_prediction = ml.predict_fraud {
// 'load_model' is automatically injected as a dependency
model: load_model
}
// 3. Compose them in a clean, functional pipeline
workflow process_payment {
// The data source (e.g., http.post) is piped in
input_payment
| run_prediction ? handle_model_failure
| db.write_results
}First-Class Data Transformation
Integrates Pipeline Relational Query Language (PRQL) for compile-time validated transformations. Data streams inject directly into the relational engine, executing joins and aggregations as optimized, type-safe nodes within the logic graph.
import "std/database" as db
import "stream/kafka" as kafka
import "std/dashboard" as dash
step users_read = db.query { sql: "SELECT * FROM users" }
step events_read = kafka.read { topic: "user_events" }
workflow user_analytics {
// 'events_read' output is piped into the PRQL block
let users_table = users_read
events_read
| ( // Join stream against the database table
from input
join users_table (user_id == id)
group {users_table.country} (
aggregate { event_count = count }
)
)
| dash.update_analytics
}Declarative Error Handling
Decouples exception management from the execution path using the monadic ? operator. Fault tolerance strategies are defined as distinct topological branches, eliminating imperative try/catch complexity and preserving logic clarity.
import "std/error" as error
import "std/log" as log
step process_data = external.api_call { ... }
// Define a handler: a dedicated pipeline for errors
handler log_and_swallow = error.handler {
log.error { message: "API call failed, continuing." }
}
// Define a handler: a dedicated pipeline for errors
handler log_workflow = error.handler {
log.error { message: "API call failed, continuing." }
}
workflow main_pipeline ? log_workflow {
// If process_data fails, Heddle executes the 'log_and_swallow' handler
process_data ? log_and_swallow
}Engineered for Resilience & Performance
A high-performance runtime architecture leveraging the Ray ecosystem for robust, distributed execution.
Host-Core Architecture
Heddle Core manages orchestration state, while the Python Host executes logic. This symbiosis delivers low-latency control without sacrificing Python ecosystem compatibility.
Zero-Copy Memory Model
Uses Apache Arrow to pass data by reference between actors. This eliminates serialization overhead, maximizing throughput for data-intensive applications.
Time-Travel Debugging
Data frames are immutable. The runtime persists execution history, enabling chronological traversal of the DAG to inspect state at any specific node.
Efficient Distributed Execution
The RayStreamEngine optimizes throughput via dynamic micro-batching and backpressure. Workflows automatically scale across multi-node clusters.
Integrates With Your Stack
Functions as the Agentic Intermediate Layer—a deterministic execution engine for AI Agents.
Agentic Intermediate Layer
Provides a verifiable interface between probabilistic AI agents and deterministic infrastructure. Ensures agent-generated plans are type-safe and structurally sound.
Extensible Connectivity
Features a standard library for common protocols (SQL, Kafka, HTTP). The import system allows encapsulation of arbitrary Python code as typed Heddle steps.