GitHub

Function

Inspect a single function execution — a success/error badge and duration up top, with tabs for the input it received, the output it returned, the console (stdout, stderr, traceback) and the code that ran.

A function block runs sandboxed code to transform data between workflow steps. The Function component renders one execution the way you'd want to read it when debugging a run: a success/error badge and duration along the top, then tabs for the Input it received, the Output it returned, the Console (stdout, stderr and traceback) and the Code that ran.

SuccessReturned Output214 ms

JSON in the Input and Output tabs gets light syntax highlighting, console streams are collapsible with line counts, and every panel has a hover button to copy its contents. When a run fails, the inspector opens on the Console tab.

Usage

Pass a single run object describing the execution. Everything is presentation only — wire it to whatever your run data looks like.

import { FunctionInspector } from "@/registry/new-york-v4/blocks/function-block"
 
export function Example() {
  return (
    <div className="h-[520px] overflow-hidden rounded-xl border">
      <FunctionInspector
        run={{
          isSuccess: true,
          message: "Returned Output",
          executionTimeMs: 214,
          inputData: { invoice_number: "INV-8842", amount: 12480.5 },
          outputData: { invoice_number: "INV-8842", total: 13541.34 },
          stdout: "Computed tax 1060.84 on subtotal 12480.5",
          code: "def transform(input: Input) -> Output: ...",
        }}
      />
    </div>
  )
}

The FunctionBlock export wraps the inspector with a sample run so it renders on its own with no props.

API

FunctionRun

FieldTypeDescription
isSuccessbooleanDrives the status badge and which tab opens first.
messagestringOptional one-line status shown next to the badge.
executionTimeMsnumber | nullWall-clock time, rendered next to the clock icon (auto ms/s).
inputDataRecord<string, unknown> | nullInput passed to the function. The Input tab only appears when set.
outputDataRecord<string, unknown> | nullValue the function returned, shown as highlighted JSON.
stdoutstring | nullCaptured standard output — a collapsible Console section.
stderrstring | nullCaptured standard error — a collapsible Console section.
errorstring | nullError summary, shown as a banner atop the Console tab.
tracebackstring | nullFull traceback, shown expanded in the Console tab.
codestring | nullSource that ran. The Code tab only appears when set.
languagestringLanguage label for the Code tab (default "python").

Components

ExportPropsDescription
FunctionInspector{ run: FunctionRun }The full execution inspector.
FunctionBlock{ run?: FunctionRun }The inspector preloaded with a sample run; pass run to override.