Template Interpolation – Variable Substitution Syntax
Template interpolation is how AgetnticOS transitions access and transform token data. Using ${...} syntax, you can reference input token fields, metadata, and build dynamic outputs in Map templates, HTTP bodies, LLM prompts, and more.
Access Paths
Templates use hierarchical paths to access token data and metadata:
Common Access Patterns
// Access user data fields
"${input.data.orderId}" // → "ORD-123"
"${input.data.amount}" // → 99.99
"${input.data.customer.name}" // → "John" (nested)
"${input.data.items[0].sku}" // → "SKU-001" (array access)
// Access token metadata
"${input._meta.id}" // → "uuid-abc-123"
"${input._meta.name}" // → "order-token-1"
"${input._meta.parentId}" // → "place-uuid"
"${input._meta.type}" // → "Leaf"
// Static values (no interpolation)
"status": "processed" // → "processed"
"version": 2 // → 2
Usage in Different Transitions
Map Transition Templates
"action": {
"type": "map",
"template": {
"orderId": "${input.data.orderId}",
"total": "${input.data.amount}",
"status": "processed",
"_processedAt": "${now()}",
"_sourceToken": "${input._meta.id}"
}
}
HTTP Request Body
"action": {
"type": "http",
"method": "POST",
"url": "https://api.example.com/orders/${input.data.orderId}",
"headers": {
"X-Request-Id": "${input._meta.id}"
},
"body": {
"amount": "${input.data.amount}",
"customer": "${input.data.customerName}"
}
}
LLM Prompts
"action": {
"type": "llm",
"systemPrompt": "You are a helpful assistant.",
"userPrompt": "Summarize this review: '${input.data.reviewText}' written by ${input.data.author}"
}
Agent Instructions
"action": {
"type": "agent",
"nl": "Analyze the file ${input.data.filename} in ${input.data.repository} for security issues"
}
Token Structure Reference
Understanding the token structure is key to correct template paths:
// Token structure returned by ArcQL
{
"data": {
"orderId": "ORD-123",
"amount": 99.99,
"status": "active",
"customer": {
"name": "John",
"email": "john@example.com"
}
},
"_meta": {
"id": "7f34a312-8cc2-4a1b-...",
"name": "order-token-1",
"parentId": "place-uuid-456",
"type": "Leaf"
}
}
Why Hierarchical (Not Flattened)
AgetnticOS preserves the hierarchical token structure in templates. This design choice provides:
- No collision risk – User data can have any property name including
name,id,type - Explicit structure – Clear separation between user data and system metadata
- Mirrors ArcQL – Template paths match the actual data structure
- Supports deep nesting –
${input.data.address.city}works naturally
Summary
- Syntax – Use
${...}for interpolation - User data – Access via
${input.data.fieldName} - Metadata – Access via
${input._meta.id},${input._meta.name} - Nested access – Use dot notation for deep paths
- Works in – Map templates, HTTP bodies/URLs, LLM prompts, Agent instructions
Template interpolation is the glue that connects your tokens to transition actions – mastering it unlocks powerful data transformation and routing patterns.