For AI agents: the complete documentation index is available at https://flow.jig.md/llms.txt, the full documentation bundle is available at https://flow.jig.md/llms-full.txt, and this page is available as Markdown at https://flow.jig.md/start/run.md.
DocumentationStart herePrerelease

#Run your first Flow

View Markdown

Run a method that reads a customer request and suggests a support queue. You will supply input, inspect the result, and change one rule. The classifier is an illustrative example, not a recommended support policy.

For this input:

{"message":"I was charged twice."}

the method returns:

{"outcome":"done","output":{"queue":"billing"}}

#What you need

This tutorial uses Jig, one host that implements FLOW. Use a qualified Jig host and an npm installation. Jig currently qualifies selected Linux x86_64 and native Mac environments. Its installation includes the Bun runtime needed by this TypeScript example. The method needs no Agent, account, or model API key.

Other hosts supply their own installation and invocation interface. The support reference separates a host's supported runtimes from SDK availability.

#Prepare the example

Install the published developer alpha:

npm install --global @jigging/jig@alpha

Create a project and a package for the supplied classifier:

jig init support-demo
cd support-demo
jig new classify-request

Jig writes the project configuration and editable Flow packages. Keep flows/classify-request/package.json. It names the exact FLOW SDK revision qualified by that Jig build. Initialization and scaffolding prepare source files without approving or running them.

Give the package a readable purpose in flows/classify-request/FLOW.meta.json:

flows/classify-request/FLOW.meta.json
{"name":"classify-request","description":"Suggest a support queue from supplied request text."}

Replace flows/classify-request/FLOW.ts with this implementation:

flows/classify-request/FLOW.ts
import { handle, OperationError } from "@jigging/flow";

await handle(async (run) => {
  const input = run.input;
  if (
    input === null ||
    typeof input !== "object" ||
    Array.isArray(input) ||
    typeof input.message !== "string"
  ) {
    throw new OperationError(
      "INVALID_INPUT",
      "Expected an object with a message string.",
    );
  }

  const message = input.message.toLowerCase();
  const queue = /charged|invoice|payment/.test(message)
    ? "billing"
    : /password|login|error/.test(message)
      ? "technical"
      : "manual";

  return { outcome: "done", output: { queue } };
});

The handler checks its input, applies the example rules, and returns an outcome with data. Jig supplies the invocation and runs the method in its supported execution environment.

#Review and run

Review the project:

jig review --allow-resolution-network

Inspect the source, dependencies, and displayed policy before approving the revision. Enter y when the proposal matches the work you intend to allow. The network flag permits dependency resolution before approval. Runs keep their separate network permissions.

Run the approved method:

jig run flow:flows/classify-request --input '{"message":"I was charged twice."}' --json

The response includes:

{"status":"succeeded","outcome":"done","output":{"queue":"billing"}}

Jig also reports diagnostics. status describes execution, outcome describes the method's result, and output contains its data. The application decides whether to use the suggested queue. Successful execution alone establishes neither correct classification nor permission to assign the request.

#Change one rule

Run the same method with a refund request:

jig run flow:flows/classify-request --input '{"message":"Please refund my order."}' --json

The current rules suggest manual. Add refund to the billing expression:

const queue = /charged|invoice|payment|refund/.test(message)

Keep the rest of the conditional expression unchanged. Review the source change and run the refund input again:

jig review --allow-resolution-network
jig run flow:flows/classify-request --input '{"message":"Please refund my order."}' --json

Approve the intended change during review. The output now contains {"queue":"billing"}. Representative messages will show whether this rule helps your application.

#Check a failure

Supply a number where the method expects a message string:

jig run flow:flows/classify-request --input '{"message":12}' --json

The method raises INVALID_INPUT, and Jig reports failed execution instead of a suggested queue. Correct the input before starting another invocation. The outcomes guide explains domain outcomes and operational failures.

Next, call it from an application, or bring a Skill behind the same boundary.