Quickstart
Install the fn CLI, scaffold an Agentic Function, run it, evaluate it, and deploy it — in about five minutes.
1. Install
curl -fsSL fnai.dev/install.sh | sh
Confirm the binary is on your PATH:
fn --version
# fn 1.0.0
2. Scaffold an Agentic Function
fn init classify --template classify
This writes an fn.yml describing a typed Agentic Function for classification:
name: classify
version: 1
model: claude-opus-4-8
input:
ticket: file
output:
category: string
priority: enum[low, high]
confidence: number
3. Run it locally
fn run classify --input ticket.pdf
{
"category": "billing",
"priority": "high",
"confidence": 0.94
}
The metadata line below the output reports the version, latency, cost, and the last eval score so you always know what you just ran.
4. Evaluate
Create a dataset of real inputs and expected outputs, one JSON object per line:
{"input": "ticket-001.pdf", "expected": {"category": "billing"}}
{"input": "ticket-002.pdf", "expected": {"category": "support"}}
Then grade against it:
fn eval classify --dataset tickets.jsonl --threshold 0.95
A score below the threshold exits non-zero, so you can drop this straight into CI. See the Evaluation guide for datasets and gates.
5. Deploy
fn deploy classify --env production
You now have a versioned endpoint. Call it like any other function, from your code:
app.py
from fnai import Function
classify = Function("classify", api_key="fnk_…")
result = classify.run(ticket=text)
Or hit the endpoint directly over HTTP:
curl -X POST https://api.fnai.dev/v1/run/classify \
-H "Authorization: Bearer $FN_KEY" \
-H "Content-Type: application/json" \
-d '{"input": {"ticket": "…"}}'
Next steps
- Learn the full CLI
- Read the
fn.ymlspec - Set up deployment environments