Quickstart
From install to a parsed agent with extracted messages in a few minutes.
1. Install
install
go get github.com/itsatony/go-exons2. Define an agent
Create a hello.exons file — YAML frontmatter describes the configuration, the template body the prompt:
hello.exons
---
name: greeter
description: A friendly greeter agent
type: agent
execution:
provider: openai
model: gpt-4o
temperature: 0.7
---
{~exons.message role="system"~}
You are a friendly greeter.
{~/exons.message~}
{~exons.message role="user"~}
Say hello to {~exons.var name="user_name" default="World" /~}
{~/exons.message~}3. Parse and use
main.go
engine := exons.MustNew()
tmpl, _ := engine.Parse(source)
// Execute the template and extract structured messages
messages, _ := tmpl.ExecuteAndExtractMessages(ctx, map[string]any{
"user_name": "Alice",
})
// messages[0] → {Role: "system", Content: "You are a friendly greeter."}
// messages[1] → {Role: "user", Content: "Say hello to Alice"}
// Access the parsed spec
spec := tmpl.Spec()
fmt.Println(spec.Name) // "greeter"
fmt.Println(spec.Execution.Model) // "gpt-4o"That’s it. go-exons parses and validates the spec and extracts the messages — executing them against an LLM is your runtime’s job.
Next
- Concept — why the format exists and how it’s structured.
- Format Reference — every frontmatter field and template tag.
- Examples — seven worked
.exonsfiles.