Triggers
Triggers define how an agent can be invoked. Each trigger has a name, optional inputs, and a corresponding handler.
Trigger Types
User Message
The most common trigger — when a user sends a chat message:
yaml
User Action
For UI interactions like button clicks:
yaml
API Trigger
Direct invocation through the SDK:
yaml
Trigger Definition
yaml
Tip: You can use custom types for complex trigger inputs.
Invoking Triggers
From Client SDK
tsx
From Server SDK
typescript
Handlers
Each trigger must have a corresponding handler:
yaml
Trigger Input Naming
Trigger inputs use UPPERCASE_SNAKE_CASE:
yaml
Best Practices
1. Use Descriptive Names
yaml
2. Document Triggers
yaml
3. Keep Triggers Focused
Each trigger should do one thing:
yaml