Skip to main content

Overview

Templates provide pre-built AI agent workflows that can be installed, customized, and run. The default repository is agent-recipes on GitHub.
Templates support custom directories with precedence-based discovery and input sentinel protection for secure variable substitution.

Python API

Load a Template

List Available Templates

Search Templates

Install a Template

Clear Cache

Concurrent cache access

Multiple agents in the same process and multiple praisonai run invocations that share ~/.praisonai/cache/templates/ can safely call load_template(), install_template(), and clear_cache() in parallel. Since PraisonAI #3420, TemplateCache uses process-wide per-key locks and stages writes into a reserved .staging sibling directory before swapping in with an atomic os.replace(), so concurrent readers never observe a half-populated cache entry and clear() cannot rmtree a write in flight. No API change — this is a drop-in guarantee for anyone using the template cache from multi-agent or multi-process workflows.

Create Agent from Template

Create Workflow from Template

Template URI Formats

Available Templates

Custom Templates Directory

Templates can be discovered from multiple directories with precedence:

Search Path Precedence

When the same template name exists in multiple locations, the higher priority version is used.

Input Sentinel Protection

Templates use secure variable substitution that protects user input from injection:

How It Works

  1. Per-render unique sentinel - A cryptographically random token is generated for each substitution
  2. Protection phase - User-provided values containing {{...}} are replaced with sentinel tokens
  3. Substitution phase - Template variables are substituted normally
  4. Restoration phase - Sentinel tokens are replaced with original user values
This prevents:
  • Template injection attacks
  • Accidental variable resolution in user content
  • Sentinel collision attacks (unique per render)

Security

Templates support allowlists and checksum verification: