Best Practices
guidelines and optimization tips for building reliable, maintainable, and performant prai workflows
- Schema Design: Use descriptive schemas especially using
.describe("...")
to provide context for schema fields. - Model Selection: Choose appropriate models based on task complexity and speed requirements
- Parallel Processing: Use subtasks for independent operations - see History - Subtasks
- Streaming: Use streaming for long-running content generation tasks for a better UX
- Testing: Test your workflows with mock providers during development
- Specialized Steps: Use built-in functions for data processing - see Special Step Types
- State Management: Persist workflow state when needed - see History - State Management
- Monitoring: Implement proper logging and event handling - see History - Event System