@octavus/docs 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/content/01-getting-started/01-introduction.md +93 -0
- package/content/01-getting-started/02-quickstart.md +268 -0
- package/content/01-getting-started/_meta.md +4 -0
- package/content/02-server-sdk/01-overview.md +133 -0
- package/content/02-server-sdk/02-sessions.md +164 -0
- package/content/02-server-sdk/03-tools.md +242 -0
- package/content/02-server-sdk/04-streaming.md +211 -0
- package/content/02-server-sdk/_meta.md +4 -0
- package/content/03-client-sdk/01-overview.md +148 -0
- package/content/03-client-sdk/02-messages.md +207 -0
- package/content/03-client-sdk/03-streaming.md +215 -0
- package/content/03-client-sdk/04-execution-blocks.md +231 -0
- package/content/03-client-sdk/_meta.md +4 -0
- package/content/04-protocol/01-overview.md +142 -0
- package/content/04-protocol/02-input-resources.md +200 -0
- package/content/04-protocol/03-triggers.md +209 -0
- package/content/04-protocol/04-tools.md +255 -0
- package/content/04-protocol/05-handlers.md +251 -0
- package/content/04-protocol/06-agent-config.md +215 -0
- package/content/04-protocol/_meta.md +4 -0
- package/content/05-api-reference/01-overview.md +129 -0
- package/content/05-api-reference/02-sessions.md +232 -0
- package/content/05-api-reference/03-agents.md +222 -0
- package/content/05-api-reference/_meta.md +4 -0
- package/dist/chunk-2YMRODFE.js +421 -0
- package/dist/chunk-2YMRODFE.js.map +1 -0
- package/dist/chunk-6JQ3OMGF.js +421 -0
- package/dist/chunk-6JQ3OMGF.js.map +1 -0
- package/dist/chunk-ESGSYVGK.js +421 -0
- package/dist/chunk-ESGSYVGK.js.map +1 -0
- package/dist/chunk-GDCTM2SV.js +421 -0
- package/dist/chunk-GDCTM2SV.js.map +1 -0
- package/dist/chunk-J26MLMLN.js +421 -0
- package/dist/chunk-J26MLMLN.js.map +1 -0
- package/dist/chunk-LWYMRXBF.js +421 -0
- package/dist/chunk-LWYMRXBF.js.map +1 -0
- package/dist/chunk-NFVJQNDP.js +421 -0
- package/dist/chunk-NFVJQNDP.js.map +1 -0
- package/dist/chunk-SCKIOGKI.js +421 -0
- package/dist/chunk-SCKIOGKI.js.map +1 -0
- package/dist/chunk-VWPQ6ORV.js +421 -0
- package/dist/chunk-VWPQ6ORV.js.map +1 -0
- package/dist/chunk-WUNFFJ32.js +421 -0
- package/dist/chunk-WUNFFJ32.js.map +1 -0
- package/dist/chunk-XVSMRXBJ.js +421 -0
- package/dist/chunk-XVSMRXBJ.js.map +1 -0
- package/dist/content.d.ts +37 -0
- package/dist/content.js +17 -0
- package/dist/content.js.map +1 -0
- package/dist/docs.json +173 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/search-index.json +1 -0
- package/dist/search.d.ts +19 -0
- package/dist/search.js +30 -0
- package/dist/search.js.map +1 -0
- package/dist/sections.json +213 -0
- package/dist/types-BNRNBPDE.d.ts +28 -0
- package/dist/types-BltYGlWI.d.ts +36 -0
- package/package.json +52 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Overview
|
|
3
|
+
description: Introduction to Octavus agent protocols.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Protocol Overview
|
|
7
|
+
|
|
8
|
+
Agent protocols define how an AI agent behaves. They're written in YAML and specify inputs, triggers, tools, and execution handlers.
|
|
9
|
+
|
|
10
|
+
## Why Protocols?
|
|
11
|
+
|
|
12
|
+
Protocols provide:
|
|
13
|
+
|
|
14
|
+
- **Declarative definition** — Define behavior, not implementation
|
|
15
|
+
- **Portable agents** — Move agents between projects
|
|
16
|
+
- **Versioning** — Track changes with git
|
|
17
|
+
- **Validation** — Catch errors before runtime
|
|
18
|
+
- **Visualization** — Debug execution flows
|
|
19
|
+
|
|
20
|
+
## Protocol Structure
|
|
21
|
+
|
|
22
|
+
```yaml
|
|
23
|
+
# Agent inputs (provided when creating a session)
|
|
24
|
+
input:
|
|
25
|
+
COMPANY_NAME: { type: string }
|
|
26
|
+
USER_ID: { type: string, optional: true }
|
|
27
|
+
|
|
28
|
+
# Persistent resources the agent can read/write
|
|
29
|
+
resources:
|
|
30
|
+
CONVERSATION_SUMMARY:
|
|
31
|
+
description: Summary for handoff
|
|
32
|
+
default: ""
|
|
33
|
+
|
|
34
|
+
# How the agent can be invoked
|
|
35
|
+
triggers:
|
|
36
|
+
user-message:
|
|
37
|
+
input:
|
|
38
|
+
USER_MESSAGE: { type: string }
|
|
39
|
+
request-human:
|
|
40
|
+
description: User clicks "Talk to Human"
|
|
41
|
+
|
|
42
|
+
# Temporary variables for execution
|
|
43
|
+
variables:
|
|
44
|
+
- SUMMARY
|
|
45
|
+
- TICKET
|
|
46
|
+
|
|
47
|
+
# Tools the agent can use
|
|
48
|
+
tools:
|
|
49
|
+
get-user-account:
|
|
50
|
+
description: Looking up your account
|
|
51
|
+
parameters:
|
|
52
|
+
userId: { type: string }
|
|
53
|
+
returns:
|
|
54
|
+
name: { type: string }
|
|
55
|
+
email: { type: string }
|
|
56
|
+
|
|
57
|
+
# Agent configuration (model, tools, etc.)
|
|
58
|
+
agent:
|
|
59
|
+
model: anthropic/claude-sonnet-4-5
|
|
60
|
+
system: system # References prompts/system.md
|
|
61
|
+
tools: [get-user-account]
|
|
62
|
+
agentic: true # Allow multiple tool calls
|
|
63
|
+
thinking: medium # Extended reasoning
|
|
64
|
+
|
|
65
|
+
# What happens when triggers fire
|
|
66
|
+
handlers:
|
|
67
|
+
user-message:
|
|
68
|
+
Add user message:
|
|
69
|
+
type: add-message
|
|
70
|
+
role: user
|
|
71
|
+
prompt: user-message
|
|
72
|
+
input: [USER_MESSAGE]
|
|
73
|
+
|
|
74
|
+
Respond to user:
|
|
75
|
+
type: next-message
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## File Structure
|
|
79
|
+
|
|
80
|
+
Each agent is a folder with:
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
my-agent/
|
|
84
|
+
├── protocol.yaml # Main logic (required)
|
|
85
|
+
├── settings.json # Agent metadata (required)
|
|
86
|
+
└── prompts/ # Prompt templates
|
|
87
|
+
├── system.md
|
|
88
|
+
├── user-message.md
|
|
89
|
+
└── escalation-summary.md
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### settings.json
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"slug": "my-agent",
|
|
97
|
+
"name": "My Agent",
|
|
98
|
+
"description": "What this agent does",
|
|
99
|
+
"format": "interactive"
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
| Field | Required | Description |
|
|
104
|
+
|-------|----------|-------------|
|
|
105
|
+
| `slug` | Yes | URL-safe identifier (lowercase, digits, dashes) |
|
|
106
|
+
| `name` | Yes | Human-readable name |
|
|
107
|
+
| `description` | No | Brief description |
|
|
108
|
+
| `format` | Yes | `interactive` (chat) or `generation` (background) |
|
|
109
|
+
|
|
110
|
+
## Naming Conventions
|
|
111
|
+
|
|
112
|
+
- **Slugs**: `lowercase-with-dashes`
|
|
113
|
+
- **Variables**: `UPPERCASE_SNAKE_CASE`
|
|
114
|
+
- **Prompts**: `lowercase-with-dashes.md`
|
|
115
|
+
- **Tools**: `lowercase-with-dashes`
|
|
116
|
+
- **Triggers**: `lowercase-with-dashes`
|
|
117
|
+
|
|
118
|
+
## Variables in Prompts
|
|
119
|
+
|
|
120
|
+
Reference variables with `{{VARIABLE_NAME}}`:
|
|
121
|
+
|
|
122
|
+
```markdown
|
|
123
|
+
<!-- prompts/system.md -->
|
|
124
|
+
You are a support agent for {{COMPANY_NAME}}.
|
|
125
|
+
|
|
126
|
+
Help users with their {{PRODUCT_NAME}} questions.
|
|
127
|
+
|
|
128
|
+
## Support Policies
|
|
129
|
+
|
|
130
|
+
{{SUPPORT_POLICIES}}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Variables are replaced with their values at runtime. If a variable is not provided, it's replaced with an empty string.
|
|
134
|
+
|
|
135
|
+
## Next Steps
|
|
136
|
+
|
|
137
|
+
- [Input & Resources](/docs/protocol/input-resources) — Defining agent inputs
|
|
138
|
+
- [Triggers](/docs/protocol/triggers) — How agents are invoked
|
|
139
|
+
- [Tools](/docs/protocol/tools) — External capabilities
|
|
140
|
+
- [Handlers](/docs/protocol/handlers) — Execution blocks
|
|
141
|
+
- [Agent Config](/docs/protocol/agent-config) — Model and settings
|
|
142
|
+
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Input & Resources
|
|
3
|
+
description: Defining agent inputs and persistent resources.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Input & Resources
|
|
7
|
+
|
|
8
|
+
Inputs are provided when creating a session. Resources are persistent state the agent can read and write.
|
|
9
|
+
|
|
10
|
+
## Input Variables
|
|
11
|
+
|
|
12
|
+
Define inputs that consumers must (or may) provide:
|
|
13
|
+
|
|
14
|
+
```yaml
|
|
15
|
+
input:
|
|
16
|
+
# Required input
|
|
17
|
+
COMPANY_NAME:
|
|
18
|
+
type: string
|
|
19
|
+
description: The company name to use in responses
|
|
20
|
+
|
|
21
|
+
# Required input with description
|
|
22
|
+
PRODUCT_NAME:
|
|
23
|
+
type: string
|
|
24
|
+
description: Product being supported
|
|
25
|
+
|
|
26
|
+
# Optional input (defaults to "NONE")
|
|
27
|
+
SUPPORT_POLICIES:
|
|
28
|
+
type: string
|
|
29
|
+
description: Company policies for support
|
|
30
|
+
optional: true
|
|
31
|
+
|
|
32
|
+
# Optional input with custom default
|
|
33
|
+
USER_ID:
|
|
34
|
+
type: string
|
|
35
|
+
description: Current user's ID
|
|
36
|
+
optional: true
|
|
37
|
+
default: ""
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Input Definition
|
|
41
|
+
|
|
42
|
+
| Field | Required | Description |
|
|
43
|
+
|-------|----------|-------------|
|
|
44
|
+
| `type` | Yes | Data type: `string`, `number`, `boolean`, `array`, `object` |
|
|
45
|
+
| `description` | No | Describes what this input is for |
|
|
46
|
+
| `optional` | No | If true, consumer doesn't have to provide it |
|
|
47
|
+
| `default` | No | Default value if not provided (defaults to `"NONE"`) |
|
|
48
|
+
|
|
49
|
+
### Using Inputs
|
|
50
|
+
|
|
51
|
+
When creating a session, pass input values:
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
const sessionId = await client.agentSessions.create('support-chat', {
|
|
55
|
+
COMPANY_NAME: 'Acme Corp',
|
|
56
|
+
PRODUCT_NAME: 'Widget Pro',
|
|
57
|
+
SUPPORT_POLICIES: 'Refunds within 30 days...',
|
|
58
|
+
// USER_ID is optional, not provided
|
|
59
|
+
});
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
In prompts, reference with `{{INPUT_NAME}}`:
|
|
63
|
+
|
|
64
|
+
```markdown
|
|
65
|
+
You are a support agent for {{COMPANY_NAME}}.
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Resources
|
|
69
|
+
|
|
70
|
+
Resources are persistent state that:
|
|
71
|
+
- Survive across triggers
|
|
72
|
+
- Can be read and written by the agent
|
|
73
|
+
- Are synced to the consumer's application
|
|
74
|
+
|
|
75
|
+
```yaml
|
|
76
|
+
resources:
|
|
77
|
+
# Simple resource with default
|
|
78
|
+
CONVERSATION_SUMMARY:
|
|
79
|
+
description: Running summary of the conversation
|
|
80
|
+
default: ""
|
|
81
|
+
|
|
82
|
+
# Resource with type
|
|
83
|
+
USER_CONTEXT:
|
|
84
|
+
type: object
|
|
85
|
+
description: Cached user information
|
|
86
|
+
default: {}
|
|
87
|
+
|
|
88
|
+
# Read-only resource (agent can read but not write)
|
|
89
|
+
SYSTEM_CONFIG:
|
|
90
|
+
type: object
|
|
91
|
+
description: System configuration
|
|
92
|
+
readonly: true
|
|
93
|
+
default:
|
|
94
|
+
maxRetries: 3
|
|
95
|
+
timeout: 30000
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Resource Definition
|
|
99
|
+
|
|
100
|
+
| Field | Required | Description |
|
|
101
|
+
|-------|----------|-------------|
|
|
102
|
+
| `type` | No | Data type (defaults to string) |
|
|
103
|
+
| `description` | No | Describes the resource purpose |
|
|
104
|
+
| `default` | No | Initial value |
|
|
105
|
+
| `readonly` | No | If true, agent cannot write to it |
|
|
106
|
+
|
|
107
|
+
### Writing Resources
|
|
108
|
+
|
|
109
|
+
Use the `set-resource` block in handlers:
|
|
110
|
+
|
|
111
|
+
```yaml
|
|
112
|
+
handlers:
|
|
113
|
+
request-human:
|
|
114
|
+
# ... generate summary ...
|
|
115
|
+
|
|
116
|
+
Save summary:
|
|
117
|
+
type: set-resource
|
|
118
|
+
resource: CONVERSATION_SUMMARY
|
|
119
|
+
value: SUMMARY # Variable containing the value
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Resource Events
|
|
123
|
+
|
|
124
|
+
When a resource is updated, the client SDK receives a `resource-update` event:
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
useOctavusChat({
|
|
128
|
+
onResourceUpdate: (name, value) => {
|
|
129
|
+
if (name === 'CONVERSATION_SUMMARY') {
|
|
130
|
+
console.log('Summary updated:', value);
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Variables
|
|
137
|
+
|
|
138
|
+
Variables are temporary storage during execution. Unlike resources, they don't persist across triggers.
|
|
139
|
+
|
|
140
|
+
```yaml
|
|
141
|
+
variables:
|
|
142
|
+
- SUMMARY
|
|
143
|
+
- TICKET
|
|
144
|
+
- CONVERSATION_TEXT
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Using Variables
|
|
148
|
+
|
|
149
|
+
Set variables as output from blocks:
|
|
150
|
+
|
|
151
|
+
```yaml
|
|
152
|
+
handlers:
|
|
153
|
+
request-human:
|
|
154
|
+
Serialize conversation:
|
|
155
|
+
type: serialize-thread
|
|
156
|
+
format: markdown
|
|
157
|
+
output: CONVERSATION_TEXT # Stores result in variable
|
|
158
|
+
|
|
159
|
+
Generate summary:
|
|
160
|
+
type: next-message
|
|
161
|
+
output: SUMMARY # LLM output stored in variable
|
|
162
|
+
|
|
163
|
+
Create ticket:
|
|
164
|
+
type: tool-call
|
|
165
|
+
tool: create-support-ticket
|
|
166
|
+
input:
|
|
167
|
+
summary: SUMMARY # Use variable as input
|
|
168
|
+
output: TICKET
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Scoping
|
|
172
|
+
|
|
173
|
+
| Type | Scope | Persistence |
|
|
174
|
+
|------|-------|-------------|
|
|
175
|
+
| `input` | Session | Read-only, set at creation |
|
|
176
|
+
| `resources` | Session | Read/write, persists |
|
|
177
|
+
| `variables` | Trigger execution | Temporary |
|
|
178
|
+
|
|
179
|
+
```mermaid
|
|
180
|
+
flowchart TB
|
|
181
|
+
subgraph Session["Session (persistent)"]
|
|
182
|
+
direction TB
|
|
183
|
+
Input["**input** (immutable)<br/>COMPANY_NAME, PRODUCT_NAME"]
|
|
184
|
+
Resources["**resources** (read/write)<br/>CONVERSATION_SUMMARY"]
|
|
185
|
+
|
|
186
|
+
subgraph T1["Trigger: user-message"]
|
|
187
|
+
V1["**variables**: { }"]
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
subgraph T2["Trigger: request-human"]
|
|
191
|
+
V2["**variables**: { SUMMARY, TICKET }"]
|
|
192
|
+
end
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
Input -.-> T1
|
|
196
|
+
Input -.-> T2
|
|
197
|
+
Resources -.-> T1
|
|
198
|
+
Resources -.-> T2
|
|
199
|
+
```
|
|
200
|
+
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Triggers
|
|
3
|
+
description: Defining how agents are invoked.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Triggers
|
|
7
|
+
|
|
8
|
+
Triggers define how an agent can be invoked. Each trigger has a name, optional inputs, and a corresponding handler.
|
|
9
|
+
|
|
10
|
+
## Trigger Types
|
|
11
|
+
|
|
12
|
+
### User Message
|
|
13
|
+
|
|
14
|
+
The most common trigger — when a user sends a chat message:
|
|
15
|
+
|
|
16
|
+
```yaml
|
|
17
|
+
triggers:
|
|
18
|
+
user-message:
|
|
19
|
+
description: User sends a chat message
|
|
20
|
+
input:
|
|
21
|
+
USER_MESSAGE:
|
|
22
|
+
type: string
|
|
23
|
+
description: The user's message
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### User Action
|
|
27
|
+
|
|
28
|
+
For UI interactions like button clicks:
|
|
29
|
+
|
|
30
|
+
```yaml
|
|
31
|
+
triggers:
|
|
32
|
+
request-human:
|
|
33
|
+
description: User clicks "Talk to Human" button
|
|
34
|
+
# No input needed - action is implicit
|
|
35
|
+
|
|
36
|
+
submit-feedback:
|
|
37
|
+
description: User submits feedback form
|
|
38
|
+
input:
|
|
39
|
+
RATING:
|
|
40
|
+
type: number
|
|
41
|
+
description: Rating from 1-5
|
|
42
|
+
COMMENT:
|
|
43
|
+
type: string
|
|
44
|
+
description: Optional comment
|
|
45
|
+
optional: true
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### API Trigger
|
|
49
|
+
|
|
50
|
+
Direct invocation through the SDK:
|
|
51
|
+
|
|
52
|
+
```yaml
|
|
53
|
+
triggers:
|
|
54
|
+
analyze-document:
|
|
55
|
+
description: Analyze an uploaded document
|
|
56
|
+
input:
|
|
57
|
+
DOCUMENT_URL:
|
|
58
|
+
type: string
|
|
59
|
+
ANALYSIS_TYPE:
|
|
60
|
+
type: string
|
|
61
|
+
enum: [summary, sentiment, extraction]
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Trigger Definition
|
|
65
|
+
|
|
66
|
+
```yaml
|
|
67
|
+
triggers:
|
|
68
|
+
trigger-name:
|
|
69
|
+
description: Optional description
|
|
70
|
+
input:
|
|
71
|
+
VARIABLE_NAME:
|
|
72
|
+
type: string | number | boolean | array | object
|
|
73
|
+
description: What this input is for
|
|
74
|
+
optional: true | false # defaults to false
|
|
75
|
+
default: value # default if optional and not provided
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Invoking Triggers
|
|
79
|
+
|
|
80
|
+
### From Client SDK
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
// User message trigger
|
|
84
|
+
await triggerAction('user-message', {
|
|
85
|
+
USER_MESSAGE: 'How do I reset my password?'
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// User action trigger (no input)
|
|
89
|
+
await triggerAction('request-human');
|
|
90
|
+
|
|
91
|
+
// Action with input
|
|
92
|
+
await triggerAction('submit-feedback', {
|
|
93
|
+
RATING: 5,
|
|
94
|
+
COMMENT: 'Great help!'
|
|
95
|
+
});
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### From Server SDK
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
const { stream } = session.trigger('user-message', {
|
|
102
|
+
USER_MESSAGE: 'Help me with billing'
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
const { stream } = session.trigger('request-human');
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Handlers
|
|
109
|
+
|
|
110
|
+
Each trigger must have a corresponding handler:
|
|
111
|
+
|
|
112
|
+
```yaml
|
|
113
|
+
triggers:
|
|
114
|
+
user-message:
|
|
115
|
+
input:
|
|
116
|
+
USER_MESSAGE: { type: string }
|
|
117
|
+
|
|
118
|
+
request-human:
|
|
119
|
+
description: Escalate to human support
|
|
120
|
+
|
|
121
|
+
handlers:
|
|
122
|
+
user-message:
|
|
123
|
+
# Blocks executed when user-message is triggered
|
|
124
|
+
Add user message:
|
|
125
|
+
type: add-message
|
|
126
|
+
role: user
|
|
127
|
+
prompt: user-message
|
|
128
|
+
input: [USER_MESSAGE]
|
|
129
|
+
|
|
130
|
+
Respond:
|
|
131
|
+
type: next-message
|
|
132
|
+
|
|
133
|
+
request-human:
|
|
134
|
+
# Blocks executed when request-human is triggered
|
|
135
|
+
Summarize:
|
|
136
|
+
type: serialize-thread
|
|
137
|
+
# ...
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Trigger Input Naming
|
|
141
|
+
|
|
142
|
+
Trigger inputs use `UPPERCASE_SNAKE_CASE`:
|
|
143
|
+
|
|
144
|
+
```yaml
|
|
145
|
+
triggers:
|
|
146
|
+
search-products:
|
|
147
|
+
input:
|
|
148
|
+
SEARCH_QUERY: { type: string }
|
|
149
|
+
MAX_RESULTS: { type: number, optional: true, default: 10 }
|
|
150
|
+
CATEGORIES: { type: array, optional: true }
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Best Practices
|
|
154
|
+
|
|
155
|
+
### 1. Use Descriptive Names
|
|
156
|
+
|
|
157
|
+
```yaml
|
|
158
|
+
# Good
|
|
159
|
+
triggers:
|
|
160
|
+
user-message: # Clear - user sends chat message
|
|
161
|
+
request-human: # Clear - wants human support
|
|
162
|
+
cancel-subscription: # Clear - specific action
|
|
163
|
+
|
|
164
|
+
# Avoid
|
|
165
|
+
triggers:
|
|
166
|
+
trigger1: # Unclear
|
|
167
|
+
msg: # Too abbreviated
|
|
168
|
+
do-thing: # Vague
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### 2. Document Triggers
|
|
172
|
+
|
|
173
|
+
```yaml
|
|
174
|
+
triggers:
|
|
175
|
+
escalate-to-tier2:
|
|
176
|
+
description: >
|
|
177
|
+
Escalate the conversation to tier 2 support.
|
|
178
|
+
Should be called when the issue cannot be resolved
|
|
179
|
+
at tier 1 level.
|
|
180
|
+
input:
|
|
181
|
+
REASON:
|
|
182
|
+
type: string
|
|
183
|
+
description: Why escalation is needed
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### 3. Keep Triggers Focused
|
|
187
|
+
|
|
188
|
+
Each trigger should do one thing:
|
|
189
|
+
|
|
190
|
+
```yaml
|
|
191
|
+
# Good - focused triggers
|
|
192
|
+
triggers:
|
|
193
|
+
send-message:
|
|
194
|
+
input: { MESSAGE: { type: string } }
|
|
195
|
+
|
|
196
|
+
upload-file:
|
|
197
|
+
input: { FILE_URL: { type: string } }
|
|
198
|
+
|
|
199
|
+
request-callback:
|
|
200
|
+
input: { PHONE: { type: string } }
|
|
201
|
+
|
|
202
|
+
# Avoid - overloaded trigger
|
|
203
|
+
triggers:
|
|
204
|
+
user-action:
|
|
205
|
+
input:
|
|
206
|
+
ACTION_TYPE: { type: string } # "message" | "file" | "callback"
|
|
207
|
+
PAYLOAD: { type: object } # Different structure per type
|
|
208
|
+
```
|
|
209
|
+
|