Apache Burr (TypeScript)
TypeScript implementation of Apache Burr - a framework for building applications that make decisions (chatbots, agents, simulations, etc.) from simple building blocks.
Status
π§ Work in Progress - This is an active port of the Python implementation. APIs may change.
Structure
packages/burr-core/ - Core library (state machine, actions, application)examples/ - TypeScript examplestests/ - Integration tests
Getting Started
# Install dependencies
npm install
# Build all packages
npm run build
# Run tests
npm test
Documentation
See the main Burr documentation for concepts and guides. TypeScript-specific documentation coming soon.
Compatibility
This implementation aims to match the Python version's core functionality with TypeScript idioms and best practices.
Feature Parity
State API
| Feature | Python | TypeScript | Notes |
|---|
State() constructor | β
| β
| |
state.get(key) | β
| β
| TS throws on missing key; Python returns None |
state.get(key, default) | β
| β | Python supports default values |
state["key"] access | β
| β | Python dict syntax; TS uses get() |
state.has(key) / key in state | β
| β
| |
state.keys() | β
| β
| |
state.getAll() | β
| β
| |
state.update(**kwargs) | β
| β
| Python uses kwargs; TS uses object |
state.append(key=val) | β
| β
| Python: multiple keys; TS: single key |
state.extend(key=vals) | β
| β
| Python: multiple keys; TS: single key |
state.increment(key=delta) | β
| β
| Python: multiple keys; TS: single key |
state.subset(*keys) | β
| β
| TS version is strict (throws on missing keys) |
state.merge(other) | β
| β
| |
state.wipe(delete/keep) | β
| β | Delete operations not yet implemented |
state.serialize() | β
| β
| Basic JSON serialization |
state.deserialize() | β
| β
| Basic JSON deserialization |
| Custom field serialization | β
| β | register_field_serde() not implemented |
| Typing system | β
| β | Python has pluggable typing; TS uses generics |
| Type safety | β | β
| TS has compile-time type checking |
Actions
| Feature | Python | TypeScript | Notes |
|---|
@action decorator | β
| β | TS uses action() function instead |
Action class | β
| β
| |
action() helper function | β
| β
| Primary way to create actions in TS |
reads / writes specification | β
| β
| Uses Zod schemas in TS |
inputs specification | β
| β
| Uses Zod schemas in TS |
| Sync actions | β
| β | TS is async-only |
| Async actions | β
| β
| All TS actions are async |
| Streaming actions | β
| β | Not yet implemented |
| Action validation (inputs/reads/writes) | β
| β
| Runtime validation with Zod |
result type specification | β
| β
| Uses Zod schemas in TS |
| Separate run/update phases | β
| β
| |
| Single-step actions | β
| β | TS requires separate run/update |
Application
| Feature | Python | TypeScript | Notes |
|---|
ApplicationBuilder | β
| β
| |
Application.step() | β
| β
| Async only in TS |
Application.run() | β
| β
| Async only in TS |
Application.iterate() | β
| β
| Async generator in TS |
Application.astep() | β
| β | TS step() is always async |
Application.arun() | β
| β | TS run() is always async |
Application.aiterate() | β
| β | TS iterate() is always async |
| Initial state | β
| β
| |
| Entrypoint specification | β
| β
| |
| Halt conditions (before/after) | β
| β
| haltBefore / haltAfter |
| Application state access | β
| β
| app.state property |
| Initial state access | β | β | Removed for Python parity |
| Application ID | β
| β
| uid in Python, appId in TS |
| Partition key | β
| β
| |
| Sequence ID access | β
| β
| Stored in state.executionMetadata.sequenceId |
| ForkβLaunchβGatherβCommit pattern | β | β
| TS uses 4-phase execution with defense-in-depth validation |
| Framework metadata in state | β
| β
| TS: appMetadata/executionMetadata, Python: __* fields |
| Application context | β
| β | Not yet implemented |
has_next_action() | β
| β | Not yet implemented |
get_next_action() | β
| β | Internal in TS |
update_state() | β
| β | Not yet implemented |
reset_to_entrypoint() | β
| β | Not yet implemented |
| Streaming actions | β
| β | Not yet implemented |
visualize() | β
| β | Not yet implemented |
| Parent/spawning pointers | β
| β | Not yet implemented |
Graph
| Feature | Python | TypeScript | Notes |
|---|
Graph class | β
| β
| |
GraphBuilder | β
| β
| |
| Transitions (unconditional) | β
| β
| |
| Conditional transitions | β
| β
| Function-based conditions |
| Default/fallback transitions | β
| β
| |
| Action tags | β
| β | Not yet implemented |
| Graph validation | β
| β | Not yet implemented |
| Cycle detection | β
| β | Not yet implemented |
| Graph visualization | β
| β | Not yet implemented |
getTransitionsFrom() | β
| β
| |
getAction() | β
| β
| |
hasAction() | β
| β
| |
Persistence
| Feature | Python | TypeScript | Notes |
|---|
Persister interface | β
| β | Not yet implemented |
| In-memory persister | β
| β | Not yet implemented |
| File-based persister | β
| β | Not yet implemented |
| SQLite persister | β
| β | Not yet implemented |
| PostgreSQL persister | β
| β | Not yet implemented |
| Redis persister | β
| β | Not yet implemented |
| MongoDB persister | β
| β | Not yet implemented |
| Custom persisters | β
| β | Not yet implemented |
| State snapshots | β
| β | Not yet implemented |
| State history | β
| β | Not yet implemented |
Lifecycle & Hooks
| Feature | Python | TypeScript | Notes |
|---|
| Lifecycle hooks interface | β
| β | Not yet implemented |
| Pre-run hooks | β
| β | Not yet implemented |
| Post-run hooks | β
| β | Not yet implemented |
| Pre-action hooks | β
| β | Not yet implemented |
| Post-action hooks | β
| β | Not yet implemented |
| Error hooks | β
| β | Not yet implemented |
| Multiple hooks composition | β
| β | Not yet implemented |
Tracking & Observability
| Feature | Python | TypeScript | Notes |
|---|
| Tracking client | β
| β | Not yet implemented |
| Local tracking | β
| β | Not yet implemented |
| Remote tracking | β
| β | Not yet implemented |
| S3 tracking | β
| β | Not yet implemented |
| Tracing/spans | β
| β | Not yet implemented |
| OpenTelemetry integration | β
| β | Not yet implemented |
Integrations
| Feature | Python | TypeScript | Notes |
|---|
| Hamilton integration | β
| β | Not yet implemented |
| LangChain integration | β
| β | Not yet implemented |
| Haystack integration | β
| β | Not yet implemented |
| Pydantic integration | β
| β | Not yet implemented |
| Streamlit integration | β
| β | Not yet implemented |
| Ray integration | β
| β | Not yet implemented |
| Custom integrations | β
| β | Not yet implemented |
Core Abstractions
| Feature | Python | TypeScript | Notes |
|---|
| Operation/StateDelta pattern | β
| β
| Implemented for state mutations |
| Immutable state | β
| β
| |
| Copy-on-write optimization | β
| β
| Uses structuredClone |
| Generic type support | β | β
| TypeScript generics provide type safety |
| Serializable operations | β
| β
| Operations can be serialized to JSON |
| Async-first design | β | β
| All TS actions/execution is async |
| Schema validation (Zod) | β | β
| TS uses Zod for runtime validation |
| Framework metadata in state | β
| β
| appMetadata / executionMetadata |
Legend
- β
Implemented - Feature is available and tested
- π§ Partial - Feature is partially implemented or in progress
- β Not Implemented - Feature not yet available
Implementation Priority
Phase 1 (β
COMPLETED):
- β
State API core operations
- β
State immutability & operations (update, append, extend, increment, subset)
- β
Strict subset validation (throws on missing keys)
- β
Basic serialization
- β
Actions with Zod validation
- β
Application & ApplicationBuilder
- β
Graph & transitions
- β
Execution engine (step/run/iterate)
- β
ForkβLaunchβGatherβCommit execution pattern
- β
Defense-in-depth validation
- β
Framework metadata (appMetadata/executionMetadata)
- β
Halt conditions (haltBefore/haltAfter)
- β
Error propagation with context
Phase 2 (Current - Core Extensions):
- Streaming actions
- Lifecycle hooks (pre/post action)
- Application context (dependency injection)
- Graph validation & cycle detection
Phase 3 (Future - Developer Experience):
- Action tags
- Helper methods (reset_to_entrypoint, has_next_action, etc.)
- Graph visualization
- Better error messages
Phase 4 (Long Term - Production Features):
- Persistence adapters
- Tracking & observability
- Parent/spawning pointers
- Integrations (LangChain, etc.)