Best Practices

guidelines and optimization tips for building reliable, maintainable, and performant prai workflows

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