tree: 979e098fd73b9e5241d52eea1f10d066d70f86a8 [path history] [tgz]
  1. packages/
  2. .eslintrc.json
  3. .gitignore
  4. .prettierrc.json
  5. package.json
  6. README.md
  7. tsconfig.json
typescript/README.md

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 examples
  • tests/ - 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

FeaturePythonTypeScriptNotes
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

FeaturePythonTypeScriptNotes
@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

FeaturePythonTypeScriptNotes
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

FeaturePythonTypeScriptNotes
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

FeaturePythonTypeScriptNotes
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

FeaturePythonTypeScriptNotes
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

FeaturePythonTypeScriptNotes
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

FeaturePythonTypeScriptNotes
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

FeaturePythonTypeScriptNotes
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.)