Build it yourself, or with an engineer from the team. Book a demo.

BlogLLMOpsFunctional AI: Your Prompt or Agent, as an Agentic Function

LLMOps6 min read

Functional AI: Your Prompt or Agent, as an Agentic Function

Why we give your prompt or agent a typed contract and host it as a versioned Agentic Function, instead of a string copied between branches.

Most teams ship their first agent the same way: a prompt in a string, a model call behind it, no prompt management to speak of, and a hope that nobody touches it. It works in the demo. Then it goes to production, and the cracks show.

Part of our guide to LLMOps.

Key takeaways

  • A prompt in a string literal has no interface, no versions and no tests. Prompt management starts by giving it a contract: typed inputs, typed outputs, and the instructions between them.
  • Every deploy freezes a version into one hashed artifact, so what you tested is what runs; fn diff and fn rollback turn the unanswerable questions into one-liners.
  • An experiment runs a version against a frozen dataset and a Score Set and returns a trust score, pass rate, cost and findings. The results inform a person; deploy runs only the Contract Test.
  • The contract is enforced at the edge: input that breaks it is rejected with a 422 before any model call.

Someone tweaks the wording to fix one edge case and silently regresses three others. There is no record of what the prompt looked like last Tuesday, no way to compare two versions, and no number anyone trusts that says whether today's change is better or worse. The prompt is the most important code in the codebase, and it is the least engineered.

Why prompts break in production without prompt management

Prompts break in production because a prompt is not a unit of software. Functions have an interface. They have inputs and outputs with types. You can test them, version them, diff them, and roll them back. None of that is true of a prompt sitting in a string literal.

So we kept the prompt and gave it a contract. In Functional AI, your prompt or agent becomes an Agentic Function: typed inputs, typed outputs, and the instructions that turn one into the other. You can build it in the canvas, with the Python, TypeScript or Go SDK, or as a YAML file you push with the fn CLI:

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: integer, required: true, minimum: 1, maximum: 4 }
  reason:
    type: string
    required: true
    length: { unit: tokens, target: 25, range: [10, 40] }   # soft target: scored, never enforced
implementation:
  execution: { mode: single_shot }
  flow:
    - "Read the subject and body."
    - "Pick exactly one queue."
  sections:
    role: You are a support triage assistant for a SaaS company.
    constraints:
      - "Never invent details not present in the ticket."

fn new function.yaml pushes it. There is no model and no version number in the file: you pick the model when you test and when you deploy, and the runtime numbers the versions. The contract is enforced at the edge — a call whose input breaks it is rejected with a 422 naming the field, before any model call. Bad input costs nothing.

What mature prompt management requires: versioning and rollback

Mature prompt management requires that every change becomes a version you can diff and roll back. A draft is edited in place. The first deploy freezes that version forever, and any change after it creates a new one. Each version compiles to one hashed artifact, so what you tested is what runs. The questions that used to be unanswerable become one-liners:

  • What changed between two versions? — fn diff 301 317
  • Is the new one actually better? — run an experiment on each version against the same dataset and Score Set, then compare them side by side
  • Production is on fire, undo it — fn rollback 42 --to-version 301

Rollback is instant because nothing is rebuilt. The earlier version still exists; the URL and keys never change.

How prompt management measures every version before a human decides

Every prompt version is measured by an experiment before a person decides what ships. The reason prompt changes are scary is that nobody knows if they worked. So evaluation is a first-class step. An experiment runs one version against a frozen dataset version and a Score Set, on one or more models, a few times each. It returns a trust score from 0 to 100, pass rate, cost per run, p95 latency, and findings, each with a concrete fix for the prompt.

From the CLI it is one command, and it exits non-zero when the experiment fails, so you can call it from your own pipeline:

fn eval 42 --version 317 --snapshot 9 --scores 4

The results inform a person; they do not ship anything on their own. Deploying runs only the Contract Test, an instant structural check with no model call. A human reads the experiment, picks the version and the model, and deploys — and a space can require a second person to approve it.

Prompt management as an Agentic Function, not another agent framework

We are deliberate about the words we use. Functional AI is not another agent framework you assemble. Your prompt or agent becomes an Agentic Function: inputs in, structured output out, with the metadata you need to bill and trace every call — version, latency, cost, tokens, and a trace id.

That contract is the feature. An Agentic Function you can test is one you can trust in production — and trust is the thing that has been missing from agents all along.

Ready to build one? Get started, or read the Quickstart first.

The AI observability and evaluation platform, in one page

Functional AI is the AI observability and evaluation platform for prompts and agents. Build your prompt or agent as an Agentic Function; it evaluates it, runs it, traces every call, and lets you ship a new version without redeploying.

What Functional AI is →

// get started

Ship agents you can trust.

Build your prompt or agent as an Agentic Function. Functional AI evaluates it, runs it, and traces every call — and you ship new versions anytime, straight from your code. Build it yourself, or with an engineer from the team that built the platform.