Cond8 is a composable programming model and execution engine for authoring, testing, and deploying dataflow-oriented workflows in TypeScript. It introduces an actor-director architecture where behavior is decomposed into pure, stateless functions ("actors") and orchestrated by composition layers ("directors"). Cond8 emphasizes testability, observability, and compositionality, making it a viable foundation for interpretable, auditable software pipelines. This whitepaper presents the theoretical motivation, system design, and implementation details of Cond8 as a lightweight, pragmatic alternative to traditional imperative programming for workflow logic.
Modern software systems increasingly rely on pipelines of side-effectful processes that must be reliable, composable, testable, and observable. These workflows span domains ranging from data processing and ETL to microservice orchestration and AI agent behavior trees.
Existing solutions tend to fall into two camps:
- Imperative code: often verbose, brittle, hard to reuse or reason about.
- Declarative configuration: e.g., YAML pipelines, which lack expressive power and runtime visibility.
Cond8 seeks a middle ground: it offers declarative composition of typed imperative logic using a structured, testable abstraction: the actor-director model.
An actor is a stateless (or internally stateful) pure function that operates on a conduit — a proxy for shared state. Actors follow a unified contract and are wrapped using createRole, which injects metadata and enables test instrumentation.
const increment = createRole('name of Actor')(c8 => {
const current = c8.var('count', 0);
c8.var('count', current + 1);
});Actors are intended to be single-responsibility, composable, and independently testable.
Directors orchestrate a sequence of actors into a pipeline, defining input mapping (.init) and output projection (.fin).
const director = createDirector('name of Director')(increment, increment)
.init(input => ({ conduit: input }))
.fin(readonly => readonly.var('count'));Directors expose .test() methods for injecting metadata, validating outputs, and simulating execution.
Every execution run is observed by a recorder object, which tracks state transitions, lifecycle events, errors, and metadata. This enables full transparency and auditability.
Cond8 is designed for developers who need:
- Compositional units of behavior
- Full testability without external test runners
- Observable execution for debugging, monitoring, or analysis
- Runtime control and instrumentation hooks
It draws inspiration from:
- Redux-style state updates
- Actor models
- Functional composition
- Testing-first software engineering practices
Cond8 introduces a flexible lifecycle system:
onEnter,onExit, andonErrorcan be implemented viaLifecycleBlueprintclasses- Events are collected via a
Vacuumand passed through the recorder
This enables extension points for telemetry, tracing, logging, or behavior modification.
Cond8 has been used in workflows including:
- Business rule evaluation
- Form logic engines
- Agent pipelines with side effects
- Auditable approval flows
- ETL step orchestration
Its test-first design and recorder abstraction make it ideal for systems where correctness and traceability are paramount.
| Feature | Cond8 | LangChain | YAML Pipelines | RxJS |
|---|---|---|---|---|
| Compositional Units | ✅ | ❌ Flat config | ✅ | |
| Testable | ✅ | ❌ | ✅ | |
| Observable | ✅ Recorder | ❌ | ❌ | |
| Runtime Control | ✅ | ❌ | ❌ | |
| Typesafe | ✅ | ❌ |
Cond8 provides a pragmatic balance between declarative clarity and imperative power.
Cond8 is implemented in TypeScript and published as @cond8/core. The core modules include:
CoreInfra/: Actor and director factoriesCoreDomain/: Lifecycle and state abstractionsRecorder/: Execution observer and error handlerMetadata/: Test hooks and mock filters
It supports:
- Execution via
.test()or.call() - Custom recorders and lifecycles
- In-process execution only (no external runtime dependencies)
- Integration with visualization tools (React Flow, Monaco)
- Streaming execution API
- First-class support for Small Language Models (SLMs)
- HTML response recording for LLM-based systems
- AST-first virtual file system
Cond8 offers a testable, composable, observable alternative to imperative glue code and declarative YAML. Its actor-director architecture enables clean separation of concerns and introspectable workflows, making it a strong foundation for building systems where correctness, traceability, and modularity matter.
We invite collaborators, sponsors, and contributors to help refine and extend Cond8 as a new standard for declarative orchestration in TypeScript environments.
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/