Skip to Content
Levain LabsLevain Labs
API ReferenceAgents

Create Agent Trigger

Create a trigger that dispatches the agent on an event.

Create a trigger that dispatches the agent on an event.

The event source — the integration, or the self-hosted runtime for runtime.* events — must belong to the same workspace as the agent; an integration must also be in the active state. If a trigger already exists for this agent, source, and event combination, returns 409. Use PATCH /api/v1/triggers/{trigger_id} to update the existing trigger instead.

Set run_as to have the runs it starts act for you, with your person memory and rules; the person a trigger runs as is shown on it and set only at creation.

POST
/api/v1/agents/{agent_id}/triggers

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Path Parameters

agent_id*Agent Id

Header Parameters

X-API-Key?string|null

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://api.levainlabs.com/api/v1/agents/string/triggers" \  -H "Content-Type: application/json" \  -d '{    "event_type": "string"  }'
{
  "id": "string",
  "agent_id": "string",
  "integration_id": "string",
  "integration_provider": "string",
  "integration_display_name": "string",
  "event_type": "string",
  "enabled": true,
  "event_filter": {},
  "agent_version": 0,
  "last_delivery_at": "string",
  "last_delivery": {},
  "run_as_user": {
    "id": "string",
    "name": "string",
    "email": "string"
  },
  "created_at": "string"
}