Skip to main content
Invoke recipes from any language by shelling out to the PraisonAI CLI and parsing JSON stdout.
The user spawns praisonai recipe run; stdout JSON carries the result back to the caller.
When to Use: Shell scripts, CI/CD pipelines, batch processing, or when you need language-agnostic recipe invocation without running a server.

How It Works

The CLI model spawns a subprocess to run recipes. Output is captured via stdout in JSON format for easy parsing.

Pros & Cons

  • Language-agnostic - Works from any language that can spawn processes
  • Simple JSON output - Easy to parse in any language
  • No SDK dependency - Calling app doesn’t need praisonai installed
  • Process isolation - Recipe runs in separate process
  • Easy debugging - Run commands manually to test

Step-by-Step Tutorial

1

Verify CLI Installation

If not found, install:
2

List Available Recipes

3

Get Recipe Info

4

Run Recipe with JSON Output

5

Parse Output in Your Application

Production-Ready Example

CI/CD Integration

GitHub Actions

GitLab CI

Troubleshooting

Add praisonai to your PATH or use the full path:
Ensure you’re using the --json flag and only parsing stdout:
Check stderr for error details:
Common exit codes:
  • 1: General error
  • 2: Validation error
  • 7: Recipe not found
Explicitly pass environment variables:

Security & Ops Notes

Security Considerations
  • Input sanitization: Never pass unsanitized user input directly to CLI
  • Shell injection: Use list form of subprocess.run, not shell=True
  • API keys: Pass via environment variables, not command line arguments
  • Timeouts: Always set timeouts to prevent hanging processes

CLI Reference

Next Steps