Quickstart
Install fn, scaffold a function, run it, evaluate it, and deploy it — in about five minutes.
1. Install
curl -fsSL fn.run/install.sh | sh
Confirm the binary is on your PATH:
fn --version
# fn 1.0.0
2. Scaffold a function
fn init classify --template classify
This writes an fn.yml describing a typed classification function:
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:
import { fn } from "@fnlabs/sdk"
const ticket = await fn.run("classify@v3", { input })
Or hit the endpoint directly over HTTP:
curl -X POST https://api.fn.run/fn/classify/v1/run \
-H "Authorization: Bearer $FN_KEY" \
-F input=@ticket.pdf
Next steps
- Learn the full CLI
- Read the
fn.ymlspec - Set up deployment environments