Skip to main content
Integrate recipes into applications with solid error handling, latency, and UX patterns.
The user embeds recipe calls in product code and ships features end users interact with.
Role: Build applications that use PraisonAI recipes to deliver AI-powered features to end users.

Primary Goals

  • Integrate recipes into applications with minimal friction
  • Handle errors gracefully to maintain good UX
  • Optimize latency for responsive user experiences
  • Stream results for real-time feedback

Embedded SDK

Best for Python apps - Lowest latency, direct integration

CLI Invocation

Best for scripts - Simple, language-agnostic

Local HTTP Sidecar

Best for microservices - Polyglot, HTTP-based

Plugin Mode

Best for extensions - IDE/CMS integration

Typical Workflow

1

Discover Available Recipes

2

Integrate into Application

3

Add Streaming for Better UX

4

Handle Errors Gracefully

Key Concerns

Latency Optimization

Error Recovery

User Experience

Common Patterns

Request-Response Pattern

Fire-and-Forget Pattern

Batch Processing Pattern

Troubleshooting

  • Check network latency to recipe server
  • Use streaming for perceived performance
  • Consider caching for repeated inputs
  • Profile to find bottlenecks
  • Implement retry logic with exponential backoff
  • Add circuit breaker for failing recipes
  • Log errors with context for debugging
  • Set appropriate timeouts
  • Stream large outputs instead of buffering
  • Process results incrementally
  • Clear caches periodically
  • Monitor memory usage

Security Checklist

  • Validate user input before passing to recipes
  • Don’t expose recipe errors directly to users
  • Store API keys securely (env vars, secrets manager)
  • Implement rate limiting on your API
  • Log recipe calls for audit trail
  • Sanitize recipe output before displaying

Next Steps