Cloud and BYOC for Orca Agent Engine are in Private Preview — request an invite
Docs
CLI

ork functions

Create, update, and manage functions over Pulsar or Kafka in Orca Agent Engine with the ork functions commands.

The ork functions commands manage functions over Pulsar or Kafka through the Workspace registry API. A function processes messages from one or more input topics and optionally writes results to an output topic. Its connection selects the messaging protocol. These commands require the cloud.sn.io extension and are unavailable on a self-hosted engine.

Commands read --registry-url / ORCA_REGISTRY_URL and exactly one credential: --access-token / ORCA_ACCESS_TOKEN or --api-key / ORCA_API_KEY. See ork CLI for setup.

ork functions
├── list      List functions
├── get       Get one function
├── create    Create a function
├── update    Update a function
├── delete    Delete a function
├── start     Start a function
├── stop      Stop a function
├── restart   Restart a function
├── status    Get function runtime status
├── stats     Get function runtime statistics
├── trigger   Invoke a function once
└── state
    ├── get   Read a state value
    └── put   Write a state value

ork functions list

List the function names in the Workspace.

ork functions list [flags]
FlagShorthandDefaultDescription
--output-otextOutput format: text, json, or yaml.
ork functions list -o json \
  --registry-url "$ORCA_REGISTRY_URL" \
  --access-token "$ORCA_ACCESS_TOKEN"

ork functions get

Get one function's configuration by name.

ork functions get [name] [flags]
FlagShorthandDefaultDescription
--output-otextOutput format: text, json, or yaml.
ork functions get word-count -o yaml

ork functions create

Create a function. Provide the function's identity (name, tenant, namespace), a package (one of --jar, --py, --go, or --function-type), and its messaging topology. You can supply all settings through flags, a --function-config-file, or a combination - flags override file values.

ork functions create [flags]

A package source is required on create. The package selectors --function-type, --jar, --py, and --go are mutually exclusive.

The connection can come from --connection, --use-connection, or the connection field in the --function-config-file.

For Kafka, select a connection of type kafka, use Kafka topic names in --inputs and --output, and set the matching generic runtime through --custom-runtime-options. The Kafka function example includes the Python source file and a complete create command.

Identity and package flags

FlagShorthandDefaultDescription
--fqfnFully Qualified Function Name (tenant/namespace/name).
--tenantpublicThe tenant of the function.
--namespacedefaultThe namespace of the function.
--nameThe name of the function.
--classnameThe class name of the function.
--function-type-tThe built-in function type.
--jarPath or URL to the function JAR package.
--pyPath or URL to the function Python package.
--goPath or URL to the function Go binary.
--function-config-filePath to a function config YAML file.

I/O and schema flags

FlagShorthandDefaultDescription
--inputs-iComma-separated input topics.
--topics-patternTopic pattern to consume from.
--output-oThe output topic of the function.
--producer-configCustom producer configuration as JSON.
--log-topicTopic for function logs.
--schema-typeBuiltin schema type or output schema class name.
--custom-serde-inputsMap of input topics to SerDe class names as JSON.
--custom-schema-inputsMap of input topics to schema class names as JSON.
--custom-schema-outputsMap of output topics to schema properties as JSON.
--input-specsMap of inputs to custom consumer configuration as JSON.
--input-type-class-nameThe input type class name.
--output-serde-classnameThe output SerDe class name.
--output-type-class-nameThe output type class name.

On ork functions, -o is the output topic (--output), not the rendering format. The create and update commands do not take a rendering-format flag; list, get, and status use -o / --output for text / json / yaml.

Processing and behavior flags

FlagDefaultDescription
--processing-guaranteesProcessing guarantees for the function.
--user-configUser-defined config as JSON.
--retain-orderingfalseConsume and process messages in order.
--retain-key-orderingfalseConsume and process messages in key order.
--batch-builderBatch builder strategy.
--forward-source-message-propertytrueForward input message properties to the output topic.
--subs-nameSpecific subscription name for the input-topic consumer.
--subs-positionSubscription position to consume from.
--skip-to-latestfalseSkip to the latest message on function instance restart.
--auto-acktrueEnable auto ack.
--cleanup-subscriptiontrueDelete the subscription when the function is deleted.
--max-message-retries0Max message retries before sending to the dead letter topic.
--dead-letter-topicDead letter topic.
--timeout-ms0Function timeout in milliseconds.
--custom-runtime-optionsJSON string with runtime options. Kafka functions require a matching genericKind; use kafkaConsumerConfig and kafkaProducerConfig for Kafka client properties.
--secretsFunction secrets as JSON.

Resource and window flags

FlagDefaultDescription
--parallelism0Parallelism factor. Defaults to 1 when unset.
--cpu0CPU cores per function instance.
--ram0RAM per function instance.
--disk0Disk per function instance.
--window-length-count0The number of messages per window.
--window-length-duration-ms0The time duration of the window in milliseconds.
--sliding-interval-count0The number of messages after which the window slides.
--sliding-interval-duration-ms0The time duration after which the window slides.

Connection flags

FlagDefaultDescription
--connectionPulsar or Kafka connection name. The connection selects the messaging protocol.
--use-connectionfalseInteractively select a connection for the function.
--sn-service-accountService account identity used by the function.

Example

ork functions create \
  --registry-url "$ORCA_REGISTRY_URL" \
  --access-token "$ORCA_ACCESS_TOKEN" \
  --name word-count \
  --tenant public \
  --namespace default \
  --function-type word_count \
  --connection events-pulsar \
  --inputs persistent://public/default/sentences \
  --output persistent://public/default/word-counts \
  --parallelism 1

ork functions update

Update an existing function. The function name is a positional argument. If you also pass --name, it must match the positional argument. Pass only the flags you want to change.

ork functions update [name] [flags]

update accepts every flag from create except --connection and --use-connection, which are create-only because a function's connection cannot change during an update. It also accepts:

FlagDefaultDescription
--update-auth-datafalseWhether to update the auth data.
ork functions update word-count \
  --registry-url "$ORCA_REGISTRY_URL" \
  --access-token "$ORCA_ACCESS_TOKEN" \
  --parallelism 2

ork functions delete

Delete a function by name.

ork functions delete [name]
ork functions delete word-count

ork functions start, stop, restart

Control a function's runtime lifecycle. Pass the optional instance ID to operate on one instance; omit it to operate on every instance.

ork functions start [name] [instance-id]
ork functions stop [name] [instance-id]
ork functions restart [name] [instance-id]
ork functions stop word-count
ork functions start word-count
ork functions restart word-count

ork functions status

Get aggregate status or one instance's status, including running state, restart counts, and errors.

ork functions status [name] [instance-id] [flags]
FlagShorthandDefaultDescription
--output-otextOutput format: text, json, or yaml.
ork functions status word-count -o json \
  --registry-url "$ORCA_REGISTRY_URL" \
  --access-token "$ORCA_ACCESS_TOKEN"

ork functions stats

Get aggregate statistics or one instance's statistics.

ork functions stats [name] [instance-id] [flags]
FlagShorthandDefaultDescription
--output-otextOutput format: text, json, or yaml.
ork functions stats word-count -o json

ork functions trigger

Invoke a Pulsar function once with inline data or a file. Set exactly one of --data and --data-file; --topic optionally selects the input topic.

Kafka functions return HTTP 400 for this operation. Publish a record to a Kafka input topic to invoke them.

ork functions trigger word-count --data '{"value": 1}'

ork functions state

Read or write one state key.

ork functions state get [name] [key] [-o text|json|yaml]
ork functions state put [name] [key] --state-json <json>
ork functions state put [name] [key] --state-file <path>

Set exactly one of --state-json and --state-file when writing.

What's next

On this page