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

Agent triggers

Run an agent in Orca Agent Engine automatically on a cron schedule or, on StreamNative Cloud, from Pulsar and Kafka messages.

An Agent Trigger starts sessions automatically. Every deployment serves the trigger API at /v1/triggers. A self-hosted deployment supports cron schedules. StreamNative Cloud extends the same route with Pulsar and Kafka sources, additional session modes, and multiple replicas.

Trigger capabilities depend on the deployment. The open-source engine accepts only cron, SESSION_PER_EVENT, and replicas: 1. StreamNative Cloud also accepts pulsar and kafka, all four messaging session modes, SHARED for cron, and positive replica counts. Unsupported combinations return the deployment's normal validation error.

Triggers replace the deprecated Agent Function workflow for running an agent continuously or on a schedule. You declare the automation over an agent resource; the runtime creates ordinary sessions when the source fires.

Get your registry endpoint

Registry endpoint

Examples on this page target your registry endpoint - the deployment host root, with no path suffix. For CLI, set ORCA_REGISTRY_URL and exactly one of ORCA_ACCESS_TOKEN (Bearer) or ORCA_API_KEY (x-api-key). For TypeScript SDK, set ORCA_BASE_URL / ORCA_API_KEY (Bearer). To find the endpoint, see Connect to the registry.

How triggers create sessions

Every trigger pins an agent version when you create it. If you omit agent.version, the registry resolves and stores the agent's current version at create time. Updating the agent later does not move an existing trigger to a newer version.

The session_mode field controls how source events map to sessions:

Session modeBehaviorAvailability
SESSION_PER_EVENTEach cron firing or message starts a new session.Every deployment.
SESSION_PER_TOPICMessages from one topic share a session.StreamNative Cloud messaging sources.
SESSION_PER_KEYMessages with the same key share a session.StreamNative Cloud messaging sources.
SHAREDEvery event handled by the trigger shares one session.StreamNative Cloud.

For cron triggers, the source payload becomes the initial user.message in each new session. The session block supplies the environment, vaults, metadata, and title template inherited by the sessions the trigger creates.

Trigger configuration fields

FieldTypeRequiredDescription
namestringYesHuman-readable trigger name.
agentstring or objectYesAgent ID shorthand, or { "type": "agent", "id": "...", "version": 1 }. The response always contains the resolved object with a pinned version.
session_modeenumYesHow events map to sessions. See How triggers create sessions.
sourceobjectYesCron, Pulsar, or Kafka source. See Source configuration.
sessionobjectYesSession template. environment_id is required; title_template, metadata, and vault_ids are optional.
replicasintegerNoTrigger workers. Defaults to 1; the open-source engine accepts only 1.
pausedbooleanNoCreate the trigger in a paused state. This field is create-only; use pause and unpause afterward.

Trigger responses also contain these server-managed fields:

FieldDescription
idTrigger ID.
typeAlways trigger.
statusactive, paused, or archived.
next_fire_atNext planned cron firing, or null when paused or archived.
last_fired_atMost recent firing, or null before the first one.
errorCurrent scheduling or dispatch error, or null.
archived_atArchive timestamp, or null.
created_at, updated_atResource timestamps.

Source configuration

source.type selects the source and its valid fields:

FieldApplies toDescription
typeallcron, pulsar, or kafka. Pulsar and Kafka require StreamNative Cloud.
schedulecronFive-field cron expression: minute, hour, day of month, month, day of week.
timezonecronIANA time zone. Defaults to Etc/UTC on the open-source engine.
payloadcronNon-empty text sent as the initial user message.
connectionPulsar, KafkaName of a Workspace connection.
topicsPulsar, KafkaNon-empty topic list. Set either topics or topic_pattern, not both.
topic_patternPulsar, KafkaTopic regex alternative to topics.
subscription_namePulsar, KafkaConsumer subscription name.
schema_typePulsar, KafkaMessage schema, for example string, json, or avro.
type_class_name, type_class_definitionPulsar, KafkaExplicit message type and its Python definition.
consumer_additional_configKafkaKafka consumer properties.
input_schema_configsKafkaObject keyed by topic, with optional subject, type, and version values.

Create a cron trigger

The example below works on both self-hosted and StreamNative Cloud deployments. $AGENT_ID / agent.id comes from creating an agent, and $ENVIRONMENT_ID / environment.id comes from creating an environment.

trigger=$(ork agent triggers create \
  --name "nightly-backlog-review" \
  --agent "$AGENT_ID" \
  --source-type cron \
  --session-mode SESSION_PER_EVENT \
  --schedule "0 2 * * *" \
  --timezone Etc/UTC \
  --payload "Review unresolved tickets and summarize themes." \
  --environment-id "$ENVIRONMENT_ID" \
  -o json)

TRIGGER_ID=$(jq -r '.id' <<< "$trigger")

A successful create returns 200 OK and the complete Trigger resource:

{
  "id": "trg_01H8...",
  "type": "trigger",
  "name": "nightly-backlog-review",
  "agent": { "type": "agent", "id": "agt_01H8...", "version": 1 },
  "session_mode": "SESSION_PER_EVENT",
  "source": {
    "type": "cron",
    "schedule": "0 2 * * *",
    "timezone": "Etc/UTC",
    "payload": "Review unresolved tickets and summarize themes."
  },
  "session": {
    "environment_id": "env_01H8...",
    "title_template": null,
    "metadata": {},
    "vault_ids": []
  },
  "replicas": 1,
  "status": "active",
  "next_fire_at": "2026-08-27T02:00:00.000Z",
  "last_fired_at": null,
  "error": null,
  "archived_at": null,
  "created_at": "2026-08-26T02:00:00.000Z",
  "updated_at": "2026-08-26T02:00:00.000Z"
}

Pass --paused in the CLI or paused: true in the request to create the configuration without scheduling future events.

Create a messaging trigger on StreamNative Cloud

StreamNative Cloud accepts Pulsar and Kafka sources on the same /v1/triggers route. A messaging source requires a connection and exactly one of topics or topic_pattern.

ork agent triggers create \
  --name "support-triage-inbound" \
  --agent "$AGENT_ID" \
  --source-type pulsar \
  --session-mode SESSION_PER_TOPIC \
  --connection inbound-pulsar \
  --topic persistent://public/operations/support-requests \
  --subscription-name support-triage \
  --schema-type json \
  --environment-id "$ENVIRONMENT_ID" \
  -o json

For Kafka, set source.type to kafka. You can also pass consumer_additional_config and input_schema_configs.

Manage triggers

List and retrieve

ork agent triggers list --agent "$AGENT_ID" -o json
ork agent triggers get "$TRIGGER_ID" -o json

Update a trigger

Updates use a partial POST. Send only the mutable fields you want to change; omitted fields keep their stored values. The pinned agent and create-only paused field cannot be updated.

ork agent triggers update "$TRIGGER_ID" \
  --source-type cron \
  --schedule "30 2 * * *" \
  -o json

When updating source fields with the CLI, include --source-type so the command can build the correct source variant.

Pause and unpause

Pause prevents future events from creating sessions. It does not stop sessions that already exist. Unpause resumes from the first future cron slot or new source event; it does not replay the paused interval.

ork agent triggers pause "$TRIGGER_ID"
ork agent triggers unpause "$TRIGGER_ID"

List sessions created by a trigger

ork agent triggers sessions "$TRIGGER_ID" --limit 100 -o json

These are ordinary sessions. Retrieve them, stream events, and inspect resources through the standard Sessions API.

Delete a trigger

ork agent triggers delete "$TRIGGER_ID"

The open-source engine archives the trigger record and returns { "id": "...", "type": "trigger_deleted" }. Existing sessions remain available.

Permissions

OperationPermission
Createworkspace.agentTriggers.create
List or retrieveworkspace.agentTriggers.describe
Update, pause, or unpauseworkspace.agentTriggers.alter
Deleteworkspace.agentTriggers.delete
List sessions created by a triggerworkspace.agentTriggers.describe and workspace.sessions.describe

See Control registry access for how to separate access with Workspaces.

What's next

On this page