Template Authoring Guide
When you need a custom template
Template YAML anatomy
name: decorator # Template identifier
version: "1.0" # Version string (for your own tracking)
description: | # Optional human-readable description
Maps Python decorator annotations to v0.05 Kyvvu atomic behaviors.
rules: # Ordered list of matching rules
- id: model_call # Unique rule identifier
description: | # What this rule matches (for documentation)
AI model inference: LLM completion, chat, embedding, vision, etc.
match: # Conditions -- all must be true for this rule to fire
step_type: "step.model"
behavior: # Output fields when the rule matches
step_type: "step.model"
verb: "POST"
step_name: "{{ function_name }}"
properties:
model:
name: "{{ kwargs.model | default('unknown') }}"
provider: "{{ kwargs.provider | default('unknown') }}"
- id: unknown # Catch-all fallback rule (should be last)
match:
step_type: "step.unknown"
behavior:
step_type: "step.unknown"
step_name: "{{ function_name }}"Key
Required
Purpose
The context dict
Match semantics
Exact string matching
Nested keys (dot-path)
Regex patterns
Why rule order matters
The fallback/default rule
Property extraction
Simple lookup
Default values
Nested paths
Mapping to Kyvvu's property schema
Group
Used with
Example keys
Testing your template
Worked example: HTTP agent template
Event
Data
Step 1: Task lifecycle rules
Step 2: LLM call rule
Step 3: HTTP request rule
Step 4: Approval gate
Step 5: Fallback rule
Step 6: Test it
Next steps
Last updated
