// examples
Real Agentic Functions, ready to copy.
Each example is a complete definition file. Save it as function.yaml, push it with fn new function.yaml, pick a model when you deploy, and call it with an invoke key.
ClassifySummarizeExtractTransformGenerate
classify
ClassifyRoute support tickets to a queue and priority.
name: Ticket Classifier
description: Routes an inbound support ticket to a queue with a priority.
input:
subject: { type: string, required: true }
body: { type: string, required: true }
output:
queue: { type: string, required: true, enum: [billing, bug, how_to, account, other] }
priority: { type: string, required: true, enum: [low, high] }
implementation:
execution: { mode: single_shot }
flow:
- "Read the subject and body."
- "Pick exactly one queue."$ fn run classify --key fnk_… --input '{"subject":"Charged twice","body":"My card was billed two times this month."}'summarize
SummarizeCondense long documents into a structured brief.
name: Summarize
description: Condenses a long document into a short structured brief.
input:
text: { type: string, required: true }
output:
tldr:
type: string
required: true
length: { unit: tokens, target: 40, range: [20, 60] }
key_points: { type: array, required: true, items: { type: string }, max_items: 5 }
implementation:
execution: { mode: single_shot }
flow:
- "Read the whole document."
- "Write a one-paragraph TL;DR, then the key points."$ fn run summarize --key fnk_… --input '{"text":"Q3 revenue grew 12% while churn held flat…"}'extract
ExtractPull typed fields out of invoice text.
name: Invoice Extractor
description: Pulls the vendor, total and due date out of an invoice.
input:
text: { type: string, required: true }
output:
vendor: { type: string, required: true }
total: { type: number, required: true, minimum: 0 }
due_date: { type: string, required: true, format: date }
implementation:
execution: { mode: single_shot }
flow:
- "Find the vendor, the amount due and the due date."
sections:
constraints:
- "Never invent a value that is not in the invoice."$ fn run extract --key fnk_… --input '{"text":"ACME Ltd. Invoice #4411. Total due: $1,240.00 by 2026-11-30."}'transform
TransformRewrite a messy CSV row into a clean, typed record.
name: Row Cleaner
description: Rewrites one messy CSV row into a clean, typed record.
input:
row: { type: string, required: true }
output:
name: { type: string, required: true }
email: { type: string, required: true, format: email }
country: { type: string, required: true, pattern: "^[A-Z]{2}$" }
implementation:
execution: { mode: single_shot }
flow:
- "Split the row into its fields."
- "Normalise the email and the two-letter country code."$ fn run transform --key fnk_… --input '{"row":" Jane DOE ; JANE@Example.com ; united kingdom "}'release-notes
GenerateDraft release notes from a list of merged pull requests.
name: Release Notes
description: Drafts release notes from a list of merged pull request titles.
input:
prs: { type: array, required: true, items: { type: string }, min_items: 1 }
output:
markdown: { type: string, required: true }
implementation:
execution: { mode: single_shot }
flow:
- "Group the pull requests into features, fixes and chores."
- "Write one line per change in plain language."$ fn run release-notes --key fnk_… --input '{"prs":["Add CSV export","Fix login redirect loop"]}'