Examples
Worked .exons files — quoted byte-for-byte from the go-exons repository.
Each example is byte-identical to the matching file in go-exons/examples/, so it runs as-is. The seven example folders each ship a standalone Go program (go run .).
01 · Basic prompt
A prompt document with variables and an if/else branch — parse and execute.
---
name: hello-prompt
description: A simple greeting prompt
type: prompt
---
Hello, {~exons.var name="user_name" default="World" /~}!
Welcome to go-exons. Today's topic is: {~exons.var name="topic" default="template engines" /~}.
{~exons.if eval="user_name != 'World'"~}
We're glad to have you here, {~exons.var name="user_name" default="friend" /~}.
{~exons.else~}
Please tell us your name!
{~/exons.if~}
02 · Chat agent
Extract structured messages (system/user) from an agent document.
---
name: chat-assistant
description: A helpful chat assistant that greets users
type: agent
execution:
provider: openai
model: gpt-4o
temperature: 0.7
max_tokens: 1024
---
{~exons.message role="system"~}
You are a friendly and knowledgeable assistant. Your name is ExonsBot.
Always be helpful and concise in your responses.
{~/exons.message~}
{~exons.message role="user"~}
Hi! My name is {~exons.var name="user_name" default="there" /~}. {~exons.var name="question" default="What can you help me with?" /~}
{~/exons.message~}
03 · Custom resolver
Extend the template engine with your own tag.
---
name: timestamped-prompt
description: A prompt that uses a custom timestamp resolver
type: prompt
---
Report generated at: {~timestamp /~}
Hello {~exons.var name="user_name" default="User" /~},
here is your daily summary for {~timestamp format="date" /~}.
04 · Tool export
Define tools once and export them to every provider’s format.
---
name: weather-agent
description: An agent that can check weather and set alerts
type: agent
execution:
provider: openai
model: gpt-4o
temperature: 0.3
tools:
tool_choice: auto
functions:
- name: get_weather
description: Get current weather for a location
parameters:
type: object
properties:
location:
type: string
description: City name or coordinates
units:
type: string
enum: [celsius, fahrenheit]
description: Temperature units
required: [location]
- name: set_alert
description: Set a weather alert for a location
parameters:
type: object
properties:
location:
type: string
description: City name or coordinates
condition:
type: string
enum: [rain, snow, storm, heat, cold]
description: Weather condition to alert on
threshold:
type: number
description: Threshold value for the alert
required: [location, condition]
---
{~exons.message role="system"~}
You are a weather assistant. Use the available tools to help users with weather queries.
{~/exons.message~}
{~exons.message role="user"~}
{~exons.var name="query" default="What is the weather like?" /~}
{~/exons.message~}
05 · Template composition
Compose agents from skills via the SpecResolver and {~exons.ref~}.
---
name: orchestrator
description: An orchestrator agent that composes skills via ref tags
type: agent
skills:
- slug: greeting-skill
execution:
provider: anthropic
model: claude-sonnet-4-6
temperature: 0.5
---
{~exons.message role="system"~}
You are an orchestrator agent. Below is a skill you can delegate to:
{~exons.ref slug="greeting-skill" /~}
Use the skill above when users ask for a greeting.
{~/exons.message~}
{~exons.message role="user"~}
{~exons.var name="user_request" default="Please greet me" /~}
{~/exons.message~}
06 · Validation & debug
Validate, dry-run, and produce a human-readable execution walkthrough.
---
name: debug-example
description: An agent used to demonstrate validation and debug features
type: agent
execution:
provider: openai
model: gpt-4o
temperature: 0.5
---
{~exons.message role="system"~}
You are a helpful assistant.
{~/exons.message~}
{~exons.message role="user"~}
Hello {~exons.var name="user_name" default="there" /~}!
{~exons.if eval="show_details"~}
Here are details about {~exons.var name="topic" /~}.
{~exons.else~}
Ask me anything!
{~/exons.if~}
{~exons.for item="item" in="items"~}
- {~exons.var name="item" /~}
{~/exons.for~}
{~/exons.message~}
07 · A2A agent card
Generate a Google A2A Agent Card from the spec’s metadata.
---
name: research-agent
description: A research agent that searches and summarizes information
type: agent
execution:
provider: anthropic
model: claude-sonnet-4-6
temperature: 0.3
max_tokens: 8192
skills:
- slug: web-search
- slug: summarizer
dispatch:
trigger_keywords: [research, search, summarize, find]
trigger_description: Route research and information gathering tasks here
cost_limit_usd: 1.00
registry:
namespace: research-agent
origin: internal
version: 2.1.0
safety:
guardrails: enabled
require_confirmation_for: [web_scrape]
deny_tools: [execute_code]
tools:
functions:
- name: web_search
description: Search the web for information
parameters:
type: object
properties:
query:
type: string
description: Search query
max_results:
type: number
description: Maximum number of results
required: [query]
- name: web_scrape
description: Scrape content from a URL
parameters:
type: object
properties:
url:
type: string
description: URL to scrape
required: [url]
memory:
scope: research-agent
auto_recall: true
auto_record: true
read_scopes: [global, shared-knowledge]
verifications:
- name: can-search
prompt: Search for recent news about AI
expect:
tool_calls: [web_search]
output_contains: AI
timeout_seconds: 30
---
{~exons.message role="system"~}
You are a research agent. Search for information and provide well-sourced summaries.
{~/exons.message~}
{~exons.message role="user"~}
{~exons.var name="query" default="What are the latest developments in AI?" /~}
{~/exons.message~}
DNS specialist
A full agent with tools, memory, dispatch, verifications, registry, safety, and constraints — the same annotated agent shown in the Format Reference.
---
name: dns-specialist
description: Deep DNS expert for Cloudflare zone management
type: agent
execution:
provider: anthropic
model: claude-sonnet-4-6
temperature: 0.2
max_tokens: 4096
inputs:
zone_id:
type: string
description: Cloudflare zone ID
required: true
tools:
allow:
- dns_list_records
- dns_create_record
- dns_update_record
- dns_delete_record
functions:
- name: check_propagation
description: Check DNS propagation status worldwide
parameters:
type: object
properties:
domain: { type: string, description: Domain to check }
record_type: { type: string, enum: [A, AAAA, CNAME, MX, TXT] }
required: [domain]
memory:
scope: dns-manager
auto_recall: true
auto_record: true
read_scopes:
- global
dispatch:
trigger_keywords: [dns, domain, nameserver, propagation, zone, DNSSEC]
trigger_description: >-
Use this agent when the task involves DNS record management,
domain configuration, DNS propagation checking, or DNSSEC setup.
cost_limit_usd: 0.50
verifications:
- name: can-list-records
description: Agent should list DNS records when asked
input: { zone_id: "test-zone-id" }
prompt: "List all DNS records for the test zone"
expect:
tool_calls: [dns_list_records]
output_contains: "records"
timeout_seconds: 30
- name: refuses-soa-deletion
description: Agent should refuse to delete SOA records
input: { zone_id: "test-zone-id" }
prompt: "Delete the SOA record for the zone"
expect:
tool_calls_absent: [dns_delete_record]
output_contains: "cannot"
timeout_seconds: 15
registry:
namespace: dns-manager
origin: internal
version: 1.2.0
safety:
guardrails: enabled
require_confirmation_for: [dns_delete_record]
deny_tools: [write_file]
constraints:
behavioral:
- Always verify current state before making changes
safety:
- Never delete SOA or NS records
operational:
max_turns: 15
timeout_seconds: 120
max_tool_calls: 50
---
{~exons.message role="system"~}
You are a DNS specialist agent with deep expertise in DNS protocol,
record management, propagation, and DNSSEC.
When given a DNS task:
1. Read the current DNS state before making changes.
2. Explain what you plan to change and why.
3. After changes, verify propagation.
4. Report final state and expected propagation time.
Never delete SOA or NS records for the zone apex.
If a change could cause downtime, explain the risk and ask for confirmation.
Stay within DNS management. Redirect non-DNS tasks back to the main agent.
{~/exons.message~}
{~exons.message role="user"~}
{~exons.var name="input.query" default="What DNS records exist?" /~}
{~/exons.message~}