Why multi-language?
Different languages excel at different tasks:- TypeScript/JavaScript: Fast API endpoints, web integrations, real-time features
- Python: Data science, machine learning, complex algorithms, existing Python libraries
How it works
Motia’s iii engine automatically discovers and connects Steps regardless of language. Steps communicate through queue events - no special configuration needed.Real-world example: ChessArena.ai
ChessArena.ai is a production app combining TypeScript and Python: TypeScript Steps:- HTTP APIs for user interactions
- Real-time streaming of chess moves
- WebSocket connections
- State management
- Stockfish chess engine integration
- Move quality analysis
- Position evaluation
- Complex chess logic
Python with machine learning
Use Python for ML tasks:TypeScript with web APIs
Use TypeScript for modern web APIs:Language-agnostic patterns
Queue communication
All languages enqueue events the same way:State management
State works identically across languages:Logging
Consistent logging across languages:Project structure
Organize multi-language projects:Dependencies
Manage dependencies per language: TypeScript/JavaScript:Performance considerations
- TypeScript Steps start faster (cold start ~50ms)
- Python Steps better for CPU-intensive tasks
- Both languages share the same queue and state infrastructure
- No serialization overhead between Steps
Related concepts
Workflows
Build multi-step workflows
Background jobs
Process work across languages
AI agents
Combine TS APIs with Python ML
State management
Share state across languages