// the AI function runtime
Trust your AI features in production.
Your prompt, agent, or multi-agent workflow becomes a function you call from your code.
You call it like any function. We host it, evaluate it, keep it running, and fail over if a model dies.
// the problem
Shipping AI is easy. Trusting it in production is not.
It breaks and nobody notices
A prompt tweak quietly regresses. You find out when a customer does, not when it shipped.
The bill creeps with no ceiling
A chattier model, a bigger prompt, and spend climbs. Nobody set a budget the AI has to live within.
One model has a bad day
Your provider rate-limits or goes down, and your feature goes down with it. Nothing catches the fall.
Your software is reliable. Your AI should be too.
// the runtime
You shouldn't have to babysit AI in production.
Functional AI is the runtime for AI features — serverless for your prompts, agents, and workflows. You write the function; we run everything behind it. No platform team required.
your code
await fn.run("classify@v3", { input })Hosting
No servers to run. Your function lives on our infrastructure.
Any model
No lock-in. Use a model we host with usage billed at cost, or plug in any provider's own endpoint and credentials.
Context
No context-prep code. Point a function at raw files and we parse, summarize, and budget tokens.
Evaluation
No eval harness to build. Quality is checked before it ships.
Model fallback
No failover code to write. We switch models the moment one fails.
Versioning
No redeploys. New versions go live behind the same function call.
Monitoring
No alerting to wire up. Every call is watched for latency and drift.
Cost control
No runaway bills. We keep you on the cheapest model that still passes.
All the AI features, none of the infrastructure.
// how it works
Three steps to AI you can trust.
No platform team. No eval pipeline to build. No infrastructure to run. Write it, tune it, and call it.
- 01
Write it
Your prompt, agent, or multi-agent workflow as a function. In the UI, the CLI, or from your coding agent over MCP.
- 02
Evaluate & iterate
Test versions until the output and the cost are exactly what you want. We help you find the cheapest model that still passes.
- 03
Promote & call it
We host it, monitor it, fall back if your model fails, and let you ship new versions anytime. No redeploy.
// write
Three ways in. One function out.
Write your prompt, agent, or multi-agent workflow once. However you start, you end up with the same thing: a typed function we host and you call.
UI
Author and test a function in the browser. No setup.
$ app.fnai.dev/new
CLI
A thin client to the hosted runtime. Stays in your workflow.
$ fn new classify
MCP
Drive fn straight from your coding agent over MCP.
$ fn.create_function(...)
// evaluate & iterate
Test it. Tune it. Until the output and the cost are right.
Define a dataset and a threshold, and fn turns every version into a pass/fail signal. Iterate until the output is right, then let fn find the cheapest model that still passes.
Quality
Grade against datasets of real inputs and expected outputs.
Consistency
Re-run N times and measure variance, not just a lucky pass.
Cost & model choice
Compare models and pick the cheapest one that still clears your bar.
Regression gate
Every version is compared to the last. A drop fails the build.
// promote to production
Promote a version. Then just call it.
Promote a version and you get a stable, authenticated HTTP endpoint, hosted on our infrastructure. Send inputs, get typed structured output, a status, and the trace ID and metadata you need to bill, trace, and monitor.
{ "status": "success", "output": { "category": "billing", "priority": "high", "confidence": 0.94 }, "meta": { "version": "v3", "latency_ms": 142, "cost_usd": 0.003, "tokens": 1840, "trace_id": "run_8f3c2a1d" } }
// monitor & fall back
If your model fails, we've already switched to a backup.
You pick a model. We keep a backup ready and switch the moment it fails. Your function keeps answering, and your users never notice.
Always watching
We monitor every call for latency, errors, and drift, so you never wire up alerting.
Automatic failover
If your model fails, we fall back to a backup instantly. The failure never reaches your users.
Cheapest model that passes
We keep running on the lowest-cost model that still clears your quality bar.
// reliability
When a tool fails, the agent degrades. It doesn't guess.
Real tools and networks fail. fn wraps every call in timeouts, retries, and hard budgets, and when it genuinely can't finish, it says so instead of inventing an answer.
Retries with backoff
Every tool call is timeout-bound. Transient failures retry with backoff; bad input fails fast instead of hammering.
Safe to retry
Side-effecting tools — send, charge, write — carry idempotency keys, so a retry never fires the action twice.
Bounded loops
Hard caps on steps and tokens, plus loop detection: an agent calling the same tool in circles breaks and escalates.
Graceful degradation
Out of budget or missing a tool? You get the best partial answer with an explicit status — never a confident wrong one.
// security
Agents touch the outside world. We contain the blast radius.
The moment a function fetches a web page or calls a tool, it has an attack surface. fn treats external content as untrusted, scopes every credential tightly, and keeps destructive actions behind a gate.
Untrusted tool output
Content a tool fetches is data, never instructions. We won't claim injection is solved — it isn't. We make it harder and contain the blast radius.
Least-privilege tools
Read-only tools are separated from write and destructive ones. Each credential is scoped to only what the function actually needs.
Secrets stay out
No credentials in prompts, logs, or traces. Keys are injected at the tool layer; PII and tokens are redacted by default.
Human in the loop
High-impact actions — delete, send, pay, publish — can require explicit confirmation or run in a sandbox before they touch anything real.
// ship new versions anytime
Ship a better version at 2pm. No redeploy.
The same function call picks up the new version behind it, so you ship improvements without redeploying your app. Versions are immutable and comparable: diff any two, route traffic with aliases like stable and canary, and roll back instantly when an eval or production tells you to.
- stable→v3100% traffic
- canary→v3-rc15% traffic
instant rollback
$ fn rollback classify --to v2// with fn
Two ways to run AI in production.
The difference between hoping your AI holds up and knowing it does.
Without fn
- Prompts scattered across Notion, env vars, and your codebase
- You find out it broke from a customer
- Costs creep up with no ceiling
- A model outage takes your feature down
- Locked into one model; a price hike or deprecation is your problem
- Changing the AI means a full redeploy
With fn
- One function you call from your code
- Certified better than the last version before it ships
- Always on the cheapest model that still passes
- Automatic failover, your users never notice
- Swap models without touching your code
- Ship new versions anytime, no redeploy
Every other tool hands you a dashboard to operate. Functional AI hands you an outcome: AI that just works.
// faq
Common questions
- What is the best way to host an AI feature as a function?
- Write your prompt, agent, or multi-agent workflow and define it in
fn.yml. Functional AI hosts it as a versioned, callable function behind a stable HTTP endpoint. Your app calls the same URL every time; the runtime handles the model, the eval gate, and automatic fallback — no infrastructure to manage, no redeploy when you update the logic. - How do I add automatic model fallback to my AI app?
- Fallback is part of the runtime, not your code. Set a primary model and one or more backups in
fn.yml. The runtime monitors every call and routes to the next model in the list when the primary returns an error or exceeds your latency threshold. Your function's signature and endpoint stay the same — your app sees no change.
Build AI features you can trust. Be first to ship them.
Functional AI is launching soon. Join the waitlist for early access and we'll email you the moment it's ready.
Shipping AI features in production?