Skip to Content
Levain LabsLevain Labs

create_agent_trigger

Create a trigger that dispatches the agent on an event. Pass exactly one event source: integration_id for a provider event (e.g. event_type…

Create a trigger that dispatches the agent on an event.

Pass exactly one event source: integration_id for a provider event (e.g. event_type 'github.pull_request', 'shopify.orders/create', or 'stripe.invoice.payment_failed'; the prefix must match the integration's provider), or runtime_id for an event a self-hosted runtime raises with levain-runtime emit (free-form lowercase dot-separated event_type under 'runtime.', e.g. 'runtime.claude_code.stop').

event_filter narrows the event to the deliveries that matter: a JSON object of dotted payload paths to a value or a list of values, all of which must match (a list matches any of its entries; a path the payload lacks matches only null). For example {"action": ["opened", "synchronize"], "pull_request.draft": true} on 'github.pull_request', or {"action": "completed", "workflow.name": "Deploy", "workflow_run.head_branch": "production"} on 'github.workflow_run', which otherwise fires for every workflow run in the installation (workflow.name is the workflow's name; workflow_run.name is the run's title, which a workflow's run-name rewrites).

run_as=True makes the runs it starts act for you, with your person memory and rules, as a run you opened would; it is set only at creation and needs a signed-in user.

Parameters

NameTypeRequiredDescription
agent_idstringyes
event_typestringyes
integration_idstringno
runtime_idstringno
agent_versionintegerno
enabledbooleanno
event_filterobjectno
run_asbooleanno

On this page