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 mode | Behavior | Availability |
|---|---|---|
SESSION_PER_EVENT | Each cron firing or message starts a new session. | Every deployment. |
SESSION_PER_TOPIC | Messages from one topic share a session. | StreamNative Cloud messaging sources. |
SESSION_PER_KEY | Messages with the same key share a session. | StreamNative Cloud messaging sources. |
SHARED | Every 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
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Human-readable trigger name. |
agent | string or object | Yes | Agent ID shorthand, or { "type": "agent", "id": "...", "version": 1 }. The response always contains the resolved object with a pinned version. |
session_mode | enum | Yes | How events map to sessions. See How triggers create sessions. |
source | object | Yes | Cron, Pulsar, or Kafka source. See Source configuration. |
session | object | Yes | Session template. environment_id is required; title_template, metadata, and vault_ids are optional. |
replicas | integer | No | Trigger workers. Defaults to 1; the open-source engine accepts only 1. |
paused | boolean | No | Create the trigger in a paused state. This field is create-only; use pause and unpause afterward. |
Trigger responses also contain these server-managed fields:
| Field | Description |
|---|---|
id | Trigger ID. |
type | Always trigger. |
status | active, paused, or archived. |
next_fire_at | Next planned cron firing, or null when paused or archived. |
last_fired_at | Most recent firing, or null before the first one. |
error | Current scheduling or dispatch error, or null. |
archived_at | Archive timestamp, or null. |
created_at, updated_at | Resource timestamps. |
Source configuration
source.type selects the source and its valid fields:
| Field | Applies to | Description |
|---|---|---|
type | all | cron, pulsar, or kafka. Pulsar and Kafka require StreamNative Cloud. |
schedule | cron | Five-field cron expression: minute, hour, day of month, month, day of week. |
timezone | cron | IANA time zone. Defaults to Etc/UTC on the open-source engine. |
payload | cron | Non-empty text sent as the initial user message. |
connection | Pulsar, Kafka | Name of a Workspace connection. |
topics | Pulsar, Kafka | Non-empty topic list. Set either topics or topic_pattern, not both. |
topic_pattern | Pulsar, Kafka | Topic regex alternative to topics. |
subscription_name | Pulsar, Kafka | Consumer subscription name. |
schema_type | Pulsar, Kafka | Message schema, for example string, json, or avro. |
type_class_name, type_class_definition | Pulsar, Kafka | Explicit message type and its Python definition. |
consumer_additional_config | Kafka | Kafka consumer properties. |
input_schema_configs | Kafka | Object 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 jsonFor 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 jsonUpdate 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 jsonWhen 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 jsonThese 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
| Operation | Permission |
|---|---|
| Create | workspace.agentTriggers.create |
| List or retrieve | workspace.agentTriggers.describe |
| Update, pause, or unpause | workspace.agentTriggers.alter |
| Delete | workspace.agentTriggers.delete |
| List sessions created by a trigger | workspace.agentTriggers.describe and workspace.sessions.describe |
See Control registry access for how to separate access with Workspaces.