Functions (Beta)
Author reusable Harbor Functions with defineJob, inspect, and exec.
Beta
The authoring surface is defineJob inside Harbor runtime files.
Do not add legacy Orbit package imports to new Function docs.
Shape
defineJob({
name: "summarizeMessage",
description: "Summarize a message for the current workspace.",
input: {
message: "string",
tone: "string?",
},
output: {
summary: "string",
},
async run(input) {
const summary = await hrbr.ai.text({
model: "openai/gpt-4.1-mini",
prompt: "Summarize this message in one paragraph: " + input.message,
})
return { summary }
},
})Required fields:
| Field | Purpose |
|---|---|
name | CamelCase or kebab-case name. Harbor canonicalizes it for published lookup. |
description | One sentence shown in dashboard and inspection output. |
input | Static input schema. Shortcuts include string, number, boolean, unknown, and optional ?. |
run | Inline async function executed by Harbor. |
Publish and inspect
Use inspect when you are authoring or checking metadata:
hrbr inspect -f ./summarize-message.job.ts
hrbr inspect 'return await hrbr.jobs.inspect({ name: "summarize-message" })'Use exec when you want a traced execution run around the publish or
the code path:
hrbr exec -f ./summarize-message.job.tsRun
Run published Functions from the dashboard or from SDK clients. The local CLI is currently the authoring and inspection entrypoint, not the invocation history surface.
Runtime globals
Function code can use Harbor runtime globals such as plugin namespaces and
hrbr runtime primitives. Discover exact source/tool names first:
hrbr inspect 'return await hrbr.tools.search({ query: "send slack message", limit: 3 })'Then use the discovered namespace in the Function body.
Relationship to SDK packages
@hrbr/client and Python harbor-sdk call the Harbor API.
@hrbr/sdk carries system contracts and generated protocol pieces.
defineJob is the runtime authoring global used by files submitted
through hrbr inspect or hrbr exec.