@octavus/docs 0.0.8 → 1.0.0
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/README.md +127 -0
- package/content/01-getting-started/01-introduction.md +3 -3
- package/content/01-getting-started/02-quickstart.md +40 -17
- package/content/02-server-sdk/01-overview.md +54 -11
- package/content/02-server-sdk/02-sessions.md +166 -15
- package/content/02-server-sdk/03-tools.md +21 -21
- package/content/02-server-sdk/04-streaming.md +50 -20
- package/content/02-server-sdk/05-cli.md +247 -0
- package/content/03-client-sdk/01-overview.md +65 -35
- package/content/03-client-sdk/02-messages.md +116 -8
- package/content/03-client-sdk/03-streaming.md +36 -17
- package/content/03-client-sdk/04-execution-blocks.md +8 -12
- package/content/03-client-sdk/05-socket-transport.md +161 -45
- package/content/03-client-sdk/06-http-transport.md +48 -24
- package/content/03-client-sdk/07-structured-output.md +412 -0
- package/content/03-client-sdk/08-file-uploads.md +473 -0
- package/content/03-client-sdk/09-error-handling.md +274 -0
- package/content/04-protocol/01-overview.md +25 -14
- package/content/04-protocol/02-input-resources.md +35 -35
- package/content/04-protocol/03-triggers.md +9 -11
- package/content/04-protocol/04-tools.md +72 -29
- package/content/04-protocol/05-skills.md +304 -0
- package/content/04-protocol/06-handlers.md +304 -0
- package/content/04-protocol/07-agent-config.md +334 -0
- package/content/04-protocol/08-provider-options.md +294 -0
- package/content/04-protocol/09-skills-advanced.md +439 -0
- package/content/04-protocol/10-types.md +719 -0
- package/content/05-api-reference/01-overview.md +20 -21
- package/content/05-api-reference/02-sessions.md +192 -37
- package/content/05-api-reference/03-agents.md +25 -37
- package/content/06-examples/01-overview.md +6 -4
- package/content/06-examples/02-nextjs-chat.md +28 -18
- package/content/06-examples/03-socket-chat.md +53 -30
- package/content/06-examples/_meta.md +0 -1
- package/dist/chunk-WJ2W3DUC.js +663 -0
- package/dist/chunk-WJ2W3DUC.js.map +1 -0
- package/dist/content.js +1 -1
- package/dist/docs.json +106 -34
- package/dist/index.js +1 -1
- package/dist/search-index.json +1 -1
- package/dist/search.js +1 -1
- package/dist/search.js.map +1 -1
- package/dist/sections.json +106 -34
- package/package.json +12 -2
- package/content/04-protocol/05-handlers.md +0 -251
- package/content/04-protocol/06-agent-config.md +0 -209
- package/dist/chunk-232K4EME.js +0 -439
- package/dist/chunk-232K4EME.js.map +0 -1
- package/dist/chunk-2JDZLMS3.js +0 -439
- package/dist/chunk-2JDZLMS3.js.map +0 -1
- package/dist/chunk-2YMRODFE.js +0 -421
- package/dist/chunk-2YMRODFE.js.map +0 -1
- package/dist/chunk-2ZBPX5QB.js +0 -421
- package/dist/chunk-2ZBPX5QB.js.map +0 -1
- package/dist/chunk-3PIIST4D.js +0 -421
- package/dist/chunk-3PIIST4D.js.map +0 -1
- package/dist/chunk-42JETGDO.js +0 -421
- package/dist/chunk-42JETGDO.js.map +0 -1
- package/dist/chunk-4WWUKU4V.js +0 -421
- package/dist/chunk-4WWUKU4V.js.map +0 -1
- package/dist/chunk-5M7DS4DF.js +0 -519
- package/dist/chunk-5M7DS4DF.js.map +0 -1
- package/dist/chunk-6JQ3OMGF.js +0 -421
- package/dist/chunk-6JQ3OMGF.js.map +0 -1
- package/dist/chunk-7AOWCJHW.js +0 -421
- package/dist/chunk-7AOWCJHW.js.map +0 -1
- package/dist/chunk-7AS4ST73.js +0 -421
- package/dist/chunk-7AS4ST73.js.map +0 -1
- package/dist/chunk-7F5WOCIL.js +0 -421
- package/dist/chunk-7F5WOCIL.js.map +0 -1
- package/dist/chunk-7FPUAWSX.js +0 -421
- package/dist/chunk-7FPUAWSX.js.map +0 -1
- package/dist/chunk-APASMJBS.js +0 -421
- package/dist/chunk-APASMJBS.js.map +0 -1
- package/dist/chunk-BCEV3WV2.js +0 -421
- package/dist/chunk-BCEV3WV2.js.map +0 -1
- package/dist/chunk-CHGY4G27.js +0 -421
- package/dist/chunk-CHGY4G27.js.map +0 -1
- package/dist/chunk-CI7JDWKU.js +0 -421
- package/dist/chunk-CI7JDWKU.js.map +0 -1
- package/dist/chunk-CVFWWRL7.js +0 -421
- package/dist/chunk-CVFWWRL7.js.map +0 -1
- package/dist/chunk-EPDM2NIJ.js +0 -421
- package/dist/chunk-EPDM2NIJ.js.map +0 -1
- package/dist/chunk-ESGSYVGK.js +0 -421
- package/dist/chunk-ESGSYVGK.js.map +0 -1
- package/dist/chunk-GDCTM2SV.js +0 -421
- package/dist/chunk-GDCTM2SV.js.map +0 -1
- package/dist/chunk-GJ6FMIPD.js +0 -421
- package/dist/chunk-GJ6FMIPD.js.map +0 -1
- package/dist/chunk-H6JGSSAJ.js +0 -519
- package/dist/chunk-H6JGSSAJ.js.map +0 -1
- package/dist/chunk-IKQHGGUZ.js +0 -421
- package/dist/chunk-IKQHGGUZ.js.map +0 -1
- package/dist/chunk-IUKE3XDN.js +0 -421
- package/dist/chunk-IUKE3XDN.js.map +0 -1
- package/dist/chunk-J26MLMLN.js +0 -421
- package/dist/chunk-J26MLMLN.js.map +0 -1
- package/dist/chunk-J7BMB3ZW.js +0 -421
- package/dist/chunk-J7BMB3ZW.js.map +0 -1
- package/dist/chunk-JCBQRD5N.js +0 -421
- package/dist/chunk-JCBQRD5N.js.map +0 -1
- package/dist/chunk-JOB6YWEF.js +0 -421
- package/dist/chunk-JOB6YWEF.js.map +0 -1
- package/dist/chunk-JZRABTHU.js +0 -519
- package/dist/chunk-JZRABTHU.js.map +0 -1
- package/dist/chunk-K3GFQUMC.js +0 -421
- package/dist/chunk-K3GFQUMC.js.map +0 -1
- package/dist/chunk-LWYMRXBF.js +0 -421
- package/dist/chunk-LWYMRXBF.js.map +0 -1
- package/dist/chunk-M2R2NDPR.js +0 -421
- package/dist/chunk-M2R2NDPR.js.map +0 -1
- package/dist/chunk-MA3P7WCA.js +0 -421
- package/dist/chunk-MA3P7WCA.js.map +0 -1
- package/dist/chunk-MDMRCS4W.mjs +0 -421
- package/dist/chunk-MDMRCS4W.mjs.map +0 -1
- package/dist/chunk-MJXTA2R6.js +0 -421
- package/dist/chunk-MJXTA2R6.js.map +0 -1
- package/dist/chunk-NFVJQNDP.js +0 -421
- package/dist/chunk-NFVJQNDP.js.map +0 -1
- package/dist/chunk-O5TLYMQP.js +0 -421
- package/dist/chunk-O5TLYMQP.js.map +0 -1
- package/dist/chunk-OECAPVSX.js +0 -439
- package/dist/chunk-OECAPVSX.js.map +0 -1
- package/dist/chunk-OL5QDJ42.js +0 -483
- package/dist/chunk-OL5QDJ42.js.map +0 -1
- package/dist/chunk-PMOVVTHO.js +0 -519
- package/dist/chunk-PMOVVTHO.js.map +0 -1
- package/dist/chunk-QCHDPR2D.js +0 -421
- package/dist/chunk-QCHDPR2D.js.map +0 -1
- package/dist/chunk-R5MTVABN.js +0 -439
- package/dist/chunk-R5MTVABN.js.map +0 -1
- package/dist/chunk-RJ4H4YVA.js +0 -519
- package/dist/chunk-RJ4H4YVA.js.map +0 -1
- package/dist/chunk-S5U4IWCR.js +0 -439
- package/dist/chunk-S5U4IWCR.js.map +0 -1
- package/dist/chunk-SCKIOGKI.js +0 -421
- package/dist/chunk-SCKIOGKI.js.map +0 -1
- package/dist/chunk-TGJSIJYP.js +0 -421
- package/dist/chunk-TGJSIJYP.js.map +0 -1
- package/dist/chunk-TQZRBMU7.js +0 -421
- package/dist/chunk-TQZRBMU7.js.map +0 -1
- package/dist/chunk-TRL4RSEO.js +0 -421
- package/dist/chunk-TRL4RSEO.js.map +0 -1
- package/dist/chunk-TWUMRHQ7.js +0 -421
- package/dist/chunk-TWUMRHQ7.js.map +0 -1
- package/dist/chunk-UCJE36LL.js +0 -519
- package/dist/chunk-UCJE36LL.js.map +0 -1
- package/dist/chunk-VCASA6KL.js +0 -421
- package/dist/chunk-VCASA6KL.js.map +0 -1
- package/dist/chunk-VWPQ6ORV.js +0 -421
- package/dist/chunk-VWPQ6ORV.js.map +0 -1
- package/dist/chunk-WPXKIHLT.js +0 -421
- package/dist/chunk-WPXKIHLT.js.map +0 -1
- package/dist/chunk-WUNFFJ32.js +0 -421
- package/dist/chunk-WUNFFJ32.js.map +0 -1
- package/dist/chunk-WW7TRC7S.js +0 -519
- package/dist/chunk-WW7TRC7S.js.map +0 -1
- package/dist/chunk-XVSMRXBJ.js +0 -421
- package/dist/chunk-XVSMRXBJ.js.map +0 -1
- package/dist/chunk-YPPXXV3I.js +0 -421
- package/dist/chunk-YPPXXV3I.js.map +0 -1
- package/dist/chunk-ZKZVV4OQ.js +0 -421
- package/dist/chunk-ZKZVV4OQ.js.map +0 -1
- package/dist/chunk-ZOFEX73I.js +0 -421
- package/dist/chunk-ZOFEX73I.js.map +0 -1
- package/dist/content.mjs +0 -17
- package/dist/content.mjs.map +0 -1
- package/dist/index.mjs +0 -11
- package/dist/index.mjs.map +0 -1
- package/dist/search.mjs +0 -30
- package/dist/search.mjs.map +0 -1
- package/dist/types-BltYGlWI.d.ts +0 -36
|
@@ -49,34 +49,34 @@ All responses are JSON. Success responses return the data directly (not wrapped
|
|
|
49
49
|
|
|
50
50
|
## HTTP Status Codes
|
|
51
51
|
|
|
52
|
-
| Code | Description
|
|
53
|
-
|
|
54
|
-
| 200
|
|
55
|
-
| 201
|
|
56
|
-
| 400
|
|
57
|
-
| 401
|
|
58
|
-
| 403
|
|
59
|
-
| 404
|
|
60
|
-
| 500
|
|
52
|
+
| Code | Description |
|
|
53
|
+
| ---- | ----------------------------------------- |
|
|
54
|
+
| 200 | Success |
|
|
55
|
+
| 201 | Created |
|
|
56
|
+
| 400 | Bad Request - Invalid parameters |
|
|
57
|
+
| 401 | Unauthorized - Missing or invalid API key |
|
|
58
|
+
| 403 | Forbidden - Insufficient permissions |
|
|
59
|
+
| 404 | Not Found |
|
|
60
|
+
| 500 | Internal Server Error |
|
|
61
61
|
|
|
62
62
|
## Endpoints Overview
|
|
63
63
|
|
|
64
64
|
### Agents
|
|
65
65
|
|
|
66
|
-
| Method | Endpoint
|
|
67
|
-
|
|
68
|
-
| GET
|
|
69
|
-
| GET
|
|
70
|
-
| POST
|
|
71
|
-
| PATCH
|
|
66
|
+
| Method | Endpoint | Description |
|
|
67
|
+
| ------ | ----------------- | --------------- |
|
|
68
|
+
| GET | `/api/agents` | List all agents |
|
|
69
|
+
| GET | `/api/agents/:id` | Get agent by ID |
|
|
70
|
+
| POST | `/api/agents` | Create agent |
|
|
71
|
+
| PATCH | `/api/agents/:id` | Update agent |
|
|
72
72
|
|
|
73
73
|
### Sessions
|
|
74
74
|
|
|
75
|
-
| Method | Endpoint
|
|
76
|
-
|
|
77
|
-
| POST
|
|
78
|
-
| GET
|
|
79
|
-
| POST
|
|
75
|
+
| Method | Endpoint | Description |
|
|
76
|
+
| ------ | --------------------------------- | --------------------- |
|
|
77
|
+
| POST | `/api/agent-sessions` | Create session |
|
|
78
|
+
| GET | `/api/agent-sessions/:id` | Get session state |
|
|
79
|
+
| POST | `/api/agent-sessions/:id/trigger` | Execute trigger (SSE) |
|
|
80
80
|
|
|
81
81
|
## Streaming
|
|
82
82
|
|
|
@@ -120,4 +120,3 @@ We recommend using our SDKs instead of calling the API directly:
|
|
|
120
120
|
- **Client SDK**: `@octavus/client-sdk` - For other frontend frameworks
|
|
121
121
|
|
|
122
122
|
The SDKs handle authentication, streaming, and tool execution automatically.
|
|
123
|
-
|
|
@@ -28,12 +28,12 @@ POST /api/agent-sessions
|
|
|
28
28
|
}
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
| Field
|
|
32
|
-
|
|
33
|
-
| `agentId` | string | Yes
|
|
34
|
-
| `input`
|
|
31
|
+
| Field | Type | Required | Description |
|
|
32
|
+
| --------- | ------ | -------- | ------------------------------------- |
|
|
33
|
+
| `agentId` | string | Yes | Agent ID (the `id` field, not `slug`) |
|
|
34
|
+
| `input` | object | No | Input variables for the agent |
|
|
35
35
|
|
|
36
|
-
>
|
|
36
|
+
> **Getting the agent ID:** Copy the ID from the agent URL in the [platform](https://octavus.ai) (e.g., `octavus.ai/agents/clxyz123`), or use the [CLI](/docs/server-sdk/cli) (`octavus sync ./agents/my-agent`) for local development workflows.
|
|
37
37
|
|
|
38
38
|
### Response
|
|
39
39
|
|
|
@@ -60,20 +60,27 @@ curl -X POST https://octavus.ai/api/agent-sessions \
|
|
|
60
60
|
|
|
61
61
|
## Get Session
|
|
62
62
|
|
|
63
|
-
Retrieve session state
|
|
63
|
+
Retrieve session state. Returns UI-ready messages for active sessions, or expiration info for expired sessions.
|
|
64
64
|
|
|
65
65
|
```
|
|
66
66
|
GET /api/agent-sessions/:sessionId
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
###
|
|
69
|
+
### Query Parameters
|
|
70
|
+
|
|
71
|
+
| Parameter | Type | Description |
|
|
72
|
+
| --------- | ------ | ---------------------------------------------------- |
|
|
73
|
+
| `format` | string | Optional. Use `format=ui` for UI-ready messages only |
|
|
74
|
+
|
|
75
|
+
### Response (Active Session)
|
|
70
76
|
|
|
71
|
-
|
|
77
|
+
When the session is active, the response includes `UIMessage` objects:
|
|
72
78
|
|
|
73
79
|
```json
|
|
74
80
|
{
|
|
75
81
|
"id": "cm5xyz123abc456def",
|
|
76
82
|
"agentId": "cm5xvz7k80001abcd",
|
|
83
|
+
"status": "active",
|
|
77
84
|
"input": {
|
|
78
85
|
"COMPANY_NAME": "Acme Corp",
|
|
79
86
|
"PRODUCT_NAME": "Widget Pro"
|
|
@@ -86,9 +93,7 @@ The response includes `UIMessage` objects that can be passed directly to the cli
|
|
|
86
93
|
{
|
|
87
94
|
"id": "1702345800000-xyz789a",
|
|
88
95
|
"role": "user",
|
|
89
|
-
"parts": [
|
|
90
|
-
{ "type": "text", "text": "How do I reset my password?", "status": "done" }
|
|
91
|
-
],
|
|
96
|
+
"parts": [{ "type": "text", "text": "How do I reset my password?", "status": "done" }],
|
|
92
97
|
"status": "done",
|
|
93
98
|
"createdAt": "2024-01-15T10:30:00.000Z"
|
|
94
99
|
},
|
|
@@ -107,6 +112,23 @@ The response includes `UIMessage` objects that can be passed directly to the cli
|
|
|
107
112
|
}
|
|
108
113
|
```
|
|
109
114
|
|
|
115
|
+
### Response (Expired Session)
|
|
116
|
+
|
|
117
|
+
When the session has expired, the response indicates the expiration status:
|
|
118
|
+
|
|
119
|
+
```json
|
|
120
|
+
{
|
|
121
|
+
"status": "expired",
|
|
122
|
+
"sessionId": "cm5xyz123abc456def",
|
|
123
|
+
"agentId": "cm5xvz7k80001abcd",
|
|
124
|
+
"createdAt": "2024-01-15T10:30:00Z"
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Use the [Restore Session](#restore-session) endpoint to restore an expired session from stored messages.
|
|
129
|
+
|
|
130
|
+
````
|
|
131
|
+
|
|
110
132
|
### UIMessage Parts
|
|
111
133
|
|
|
112
134
|
Messages contain typed `parts` that preserve content ordering:
|
|
@@ -117,14 +139,77 @@ Messages contain typed `parts` that preserve content ordering:
|
|
|
117
139
|
| `reasoning` | Extended reasoning with `text` and `status` fields |
|
|
118
140
|
| `tool-call` | Tool execution with `toolCallId`, `toolName`, `displayName`, `args`, `result`, `status` |
|
|
119
141
|
| `operation` | Internal operations with `operationId`, `name`, `operationType`, `status` |
|
|
142
|
+
| `file` | File attachment with `id`, `mediaType`, `url`, `filename`, `size` |
|
|
143
|
+
| `source` | Source reference with `sourceType`, `id`, `url`, `title` |
|
|
144
|
+
| `object` | Structured output with `id`, `typeName`, `object`, `status` |
|
|
120
145
|
|
|
121
146
|
### Example
|
|
122
147
|
|
|
123
148
|
```bash
|
|
124
149
|
curl https://octavus.ai/api/agent-sessions/:sessionId \
|
|
125
150
|
-H "Authorization: Bearer YOUR_API_KEY"
|
|
151
|
+
````
|
|
152
|
+
|
|
153
|
+
## Restore Session
|
|
154
|
+
|
|
155
|
+
Restore an expired session from stored messages. This allows you to continue a conversation after the server-side state has expired.
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
POST /api/agent-sessions/:sessionId/restore
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Request Body
|
|
162
|
+
|
|
163
|
+
```json
|
|
164
|
+
{
|
|
165
|
+
"messages": [
|
|
166
|
+
{
|
|
167
|
+
"id": "1702345800000-xyz789a",
|
|
168
|
+
"role": "user",
|
|
169
|
+
"parts": [{ "type": "text", "text": "How do I reset my password?", "status": "done" }],
|
|
170
|
+
"status": "done",
|
|
171
|
+
"createdAt": "2024-01-15T10:30:00.000Z"
|
|
172
|
+
}
|
|
173
|
+
],
|
|
174
|
+
"input": {
|
|
175
|
+
"COMPANY_NAME": "Acme Corp"
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
| Field | Type | Required | Description |
|
|
181
|
+
| ---------- | ----------- | -------- | -------------------------------------------------------------- |
|
|
182
|
+
| `messages` | UIMessage[] | Yes | Previously stored chat history |
|
|
183
|
+
| `input` | object | No | Session input for system prompt interpolation (same as create) |
|
|
184
|
+
|
|
185
|
+
### Response
|
|
186
|
+
|
|
187
|
+
```json
|
|
188
|
+
{
|
|
189
|
+
"sessionId": "cm5xyz123abc456def",
|
|
190
|
+
"restored": true
|
|
191
|
+
}
|
|
126
192
|
```
|
|
127
193
|
|
|
194
|
+
| Field | Type | Description |
|
|
195
|
+
| ----------- | ------- | ----------------------------------------------------------------------- |
|
|
196
|
+
| `sessionId` | string | The session ID |
|
|
197
|
+
| `restored` | boolean | `true` if restored from messages, `false` if session was already active |
|
|
198
|
+
|
|
199
|
+
### Example
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
curl -X POST https://octavus.ai/api/agent-sessions/:sessionId/restore \
|
|
203
|
+
-H "Authorization: Bearer YOUR_API_KEY" \
|
|
204
|
+
-H "Content-Type: application/json" \
|
|
205
|
+
-d '{
|
|
206
|
+
"messages": [...],
|
|
207
|
+
"input": { "COMPANY_NAME": "Acme Corp" }
|
|
208
|
+
}'
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
> **Note**: Store the `UIMessage[]` array after each interaction to enable restoration. The restore endpoint reconstructs the conversation state from these messages.
|
|
212
|
+
|
|
128
213
|
## Trigger Session
|
|
129
214
|
|
|
130
215
|
Execute a trigger on a session. Returns a Server-Sent Events stream.
|
|
@@ -145,11 +230,11 @@ POST /api/agent-sessions/:sessionId/trigger
|
|
|
145
230
|
}
|
|
146
231
|
```
|
|
147
232
|
|
|
148
|
-
| Field
|
|
149
|
-
|
|
150
|
-
| `triggerName` | string | Yes
|
|
151
|
-
| `input`
|
|
152
|
-
| `toolResults` | array
|
|
233
|
+
| Field | Type | Required | Description |
|
|
234
|
+
| ------------- | ------ | -------- | ---------------------------------------------- |
|
|
235
|
+
| `triggerName` | string | Yes | Name of the trigger to execute |
|
|
236
|
+
| `input` | object | No | Input variables for the trigger |
|
|
237
|
+
| `toolResults` | array | No | Tool results for continuation (handled by SDK) |
|
|
153
238
|
|
|
154
239
|
### Response
|
|
155
240
|
|
|
@@ -193,27 +278,28 @@ data: [DONE]
|
|
|
193
278
|
|
|
194
279
|
### Event Types
|
|
195
280
|
|
|
196
|
-
| Event
|
|
197
|
-
|
|
198
|
-
| `start`
|
|
199
|
-
| `finish`
|
|
200
|
-
| `error`
|
|
201
|
-
| `block-start`
|
|
202
|
-
| `block-end`
|
|
203
|
-
| `text-start`
|
|
204
|
-
| `text-delta`
|
|
205
|
-
| `text-end`
|
|
206
|
-
| `reasoning-start`
|
|
207
|
-
| `reasoning-delta`
|
|
208
|
-
| `reasoning-end`
|
|
209
|
-
| `tool-input-start`
|
|
210
|
-
| `tool-input-delta`
|
|
211
|
-
| `tool-input-end`
|
|
212
|
-
| `tool-input-available`
|
|
213
|
-
| `tool-output-available` | Tool completed with result
|
|
214
|
-
| `tool-output-error`
|
|
215
|
-
| `tool-request`
|
|
216
|
-
| `
|
|
281
|
+
| Event | Description |
|
|
282
|
+
| ----------------------- | ---------------------------------- |
|
|
283
|
+
| `start` | Stream started |
|
|
284
|
+
| `finish` | Execution complete |
|
|
285
|
+
| `error` | Error occurred |
|
|
286
|
+
| `block-start` | Execution block started |
|
|
287
|
+
| `block-end` | Execution block completed |
|
|
288
|
+
| `text-start` | Text generation started |
|
|
289
|
+
| `text-delta` | Incremental text content |
|
|
290
|
+
| `text-end` | Text generation ended |
|
|
291
|
+
| `reasoning-start` | Extended reasoning started |
|
|
292
|
+
| `reasoning-delta` | Reasoning content |
|
|
293
|
+
| `reasoning-end` | Extended reasoning ended |
|
|
294
|
+
| `tool-input-start` | Tool call initiated |
|
|
295
|
+
| `tool-input-delta` | Tool arguments streaming |
|
|
296
|
+
| `tool-input-end` | Tool arguments streaming ended |
|
|
297
|
+
| `tool-input-available` | Tool input complete |
|
|
298
|
+
| `tool-output-available` | Tool completed with result |
|
|
299
|
+
| `tool-output-error` | Tool failed |
|
|
300
|
+
| `tool-request` | Platform requesting tool execution |
|
|
301
|
+
| `file-available` | File ready for display/download |
|
|
302
|
+
| `resource-update` | Resource value changed |
|
|
217
303
|
|
|
218
304
|
### Example
|
|
219
305
|
|
|
@@ -249,3 +335,72 @@ When the agent calls external tools, you'll receive a `tool-request` event. Exec
|
|
|
249
335
|
```
|
|
250
336
|
|
|
251
337
|
The Server SDK handles this continuation pattern automatically.
|
|
338
|
+
|
|
339
|
+
## Upload URLs
|
|
340
|
+
|
|
341
|
+
Get presigned URLs for file uploads. Files are uploaded directly to S3.
|
|
342
|
+
|
|
343
|
+
```
|
|
344
|
+
POST /api/files/upload-urls
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
### Request Body
|
|
348
|
+
|
|
349
|
+
```json
|
|
350
|
+
{
|
|
351
|
+
"sessionId": "cm5xyz123abc456def",
|
|
352
|
+
"files": [
|
|
353
|
+
{
|
|
354
|
+
"filename": "photo.jpg",
|
|
355
|
+
"mediaType": "image/jpeg",
|
|
356
|
+
"size": 102400
|
|
357
|
+
}
|
|
358
|
+
]
|
|
359
|
+
}
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
| Field | Type | Required | Description |
|
|
363
|
+
| ------------------- | ------ | -------- | ----------------------------------- |
|
|
364
|
+
| `sessionId` | string | Yes | Session ID to associate files with |
|
|
365
|
+
| `files` | array | Yes | Array of file metadata (1-20 files) |
|
|
366
|
+
| `files[].filename` | string | Yes | Original filename |
|
|
367
|
+
| `files[].mediaType` | string | Yes | MIME type (e.g., `image/png`) |
|
|
368
|
+
| `files[].size` | number | Yes | File size in bytes |
|
|
369
|
+
|
|
370
|
+
### Response
|
|
371
|
+
|
|
372
|
+
```json
|
|
373
|
+
{
|
|
374
|
+
"files": [
|
|
375
|
+
{
|
|
376
|
+
"id": "file-abc123",
|
|
377
|
+
"uploadUrl": "https://s3.amazonaws.com/bucket/key?...",
|
|
378
|
+
"downloadUrl": "https://s3.amazonaws.com/bucket/key?..."
|
|
379
|
+
}
|
|
380
|
+
]
|
|
381
|
+
}
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### Upload Flow
|
|
385
|
+
|
|
386
|
+
1. Request upload URLs from the platform
|
|
387
|
+
2. PUT file content to `uploadUrl` with `Content-Type` header
|
|
388
|
+
3. Use `downloadUrl` as the `url` in `FileReference`
|
|
389
|
+
4. Include `FileReference` in trigger input
|
|
390
|
+
|
|
391
|
+
### Supported Types
|
|
392
|
+
|
|
393
|
+
| Category | Media Types |
|
|
394
|
+
| --------- | -------------------------------------------------------------------- |
|
|
395
|
+
| Images | `image/jpeg`, `image/png`, `image/gif`, `image/webp` |
|
|
396
|
+
| Documents | `application/pdf`, `text/plain`, `text/markdown`, `application/json` |
|
|
397
|
+
|
|
398
|
+
### Limits
|
|
399
|
+
|
|
400
|
+
| Limit | Value |
|
|
401
|
+
| --------------------- | ---------- |
|
|
402
|
+
| Max file size | 10 MB |
|
|
403
|
+
| Max total per request | 50 MB |
|
|
404
|
+
| Max files per request | 20 |
|
|
405
|
+
| Upload URL expiry | 15 minutes |
|
|
406
|
+
| Download URL expiry | 24 hours |
|
|
@@ -42,11 +42,10 @@ curl https://octavus.ai/api/agents \
|
|
|
42
42
|
|
|
43
43
|
## Get Agent
|
|
44
44
|
|
|
45
|
-
Get a single agent by ID
|
|
45
|
+
Get a single agent by ID.
|
|
46
46
|
|
|
47
47
|
```
|
|
48
48
|
GET /api/agents/:id
|
|
49
|
-
GET /api/agents/:slug?by=slug
|
|
50
49
|
```
|
|
51
50
|
|
|
52
51
|
### Response
|
|
@@ -77,15 +76,12 @@ GET /api/agents/:slug?by=slug
|
|
|
77
76
|
### Example
|
|
78
77
|
|
|
79
78
|
```bash
|
|
80
|
-
# By ID
|
|
81
79
|
curl https://octavus.ai/api/agents/:agentId \
|
|
82
80
|
-H "Authorization: Bearer YOUR_API_KEY"
|
|
83
|
-
|
|
84
|
-
# By slug
|
|
85
|
-
curl "https://octavus.ai/api/agents/:slug?by=slug" \
|
|
86
|
-
-H "Authorization: Bearer YOUR_API_KEY"
|
|
87
81
|
```
|
|
88
82
|
|
|
83
|
+
> **Tip:** You can also view and edit agents directly in the [platform](https://octavus.ai), or use the [CLI](/docs/server-sdk/cli) (`octavus list`) for local workflows.
|
|
84
|
+
|
|
89
85
|
## Create Agent
|
|
90
86
|
|
|
91
87
|
Create a new agent.
|
|
@@ -114,14 +110,14 @@ POST /api/agents
|
|
|
114
110
|
}
|
|
115
111
|
```
|
|
116
112
|
|
|
117
|
-
| Field
|
|
118
|
-
|
|
119
|
-
| `settings.slug`
|
|
120
|
-
| `settings.name`
|
|
121
|
-
| `settings.description` | string | No
|
|
122
|
-
| `settings.format`
|
|
123
|
-
| `protocol`
|
|
124
|
-
| `prompts`
|
|
113
|
+
| Field | Type | Required | Description |
|
|
114
|
+
| ---------------------- | ------ | -------- | ------------------------- |
|
|
115
|
+
| `settings.slug` | string | Yes | URL-safe identifier |
|
|
116
|
+
| `settings.name` | string | Yes | Display name |
|
|
117
|
+
| `settings.description` | string | No | Agent description |
|
|
118
|
+
| `settings.format` | string | Yes | `interactive` or `worker` |
|
|
119
|
+
| `protocol` | string | Yes | YAML protocol definition |
|
|
120
|
+
| `prompts` | array | Yes | Prompt files |
|
|
125
121
|
|
|
126
122
|
### Response
|
|
127
123
|
|
|
@@ -157,7 +153,6 @@ Update an existing agent.
|
|
|
157
153
|
|
|
158
154
|
```
|
|
159
155
|
PATCH /api/agents/:id
|
|
160
|
-
PATCH /api/agents/:slug?by=slug
|
|
161
156
|
```
|
|
162
157
|
|
|
163
158
|
### Request Body
|
|
@@ -196,29 +191,22 @@ curl -X PATCH https://octavus.ai/api/agents/:agentId \
|
|
|
196
191
|
}'
|
|
197
192
|
```
|
|
198
193
|
|
|
199
|
-
##
|
|
194
|
+
## Creating and Managing Agents
|
|
200
195
|
|
|
201
|
-
|
|
196
|
+
There are two ways to manage agents:
|
|
202
197
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
],
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
if (created) {
|
|
217
|
-
console.log('Created new agent:', agentId);
|
|
218
|
-
} else {
|
|
219
|
-
console.log('Updated existing agent:', agentId);
|
|
220
|
-
}
|
|
198
|
+
### Platform UI
|
|
199
|
+
|
|
200
|
+
Create and edit agents directly at [octavus.ai](https://octavus.ai). The web editor provides real-time validation and is the easiest way to get started. Copy the agent ID from the URL to use in your application.
|
|
201
|
+
|
|
202
|
+
### CLI (Local Development)
|
|
203
|
+
|
|
204
|
+
For version-controlled agent definitions, use the [Octavus CLI](/docs/server-sdk/cli):
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
octavus sync ./agents/support-chat
|
|
221
208
|
```
|
|
222
209
|
|
|
223
|
-
This
|
|
210
|
+
This creates the agent if it doesn't exist, or updates it if it does. The CLI outputs the agent ID which you should store in an environment variable.
|
|
224
211
|
|
|
212
|
+
For CI/CD integration, see the [CLI documentation](/docs/server-sdk/cli#cicd-integration).
|
|
@@ -9,19 +9,21 @@ This section provides complete integration examples for different architectures.
|
|
|
9
9
|
|
|
10
10
|
## Available Examples
|
|
11
11
|
|
|
12
|
-
| Example
|
|
13
|
-
|
|
14
|
-
| [Next.js Chat](/docs/examples/nextjs-chat) | HTTP/SSE
|
|
15
|
-
| [Socket Chat](/docs/examples/socket-chat)
|
|
12
|
+
| Example | Transport | Best For |
|
|
13
|
+
| ------------------------------------------ | --------- | --------------------------------- |
|
|
14
|
+
| [Next.js Chat](/docs/examples/nextjs-chat) | HTTP/SSE | Next.js, Remix, standard web apps |
|
|
15
|
+
| [Socket Chat](/docs/examples/socket-chat) | SockJS | Meteor, Phoenix, real-time apps |
|
|
16
16
|
|
|
17
17
|
## Choosing a Transport
|
|
18
18
|
|
|
19
19
|
**Use HTTP Transport when:**
|
|
20
|
+
|
|
20
21
|
- Building with Next.js, Remix, or similar frameworks
|
|
21
22
|
- You want the simplest integration
|
|
22
23
|
- Deploying to serverless (Vercel, Netlify, etc.)
|
|
23
24
|
|
|
24
25
|
**Use Socket Transport when:**
|
|
26
|
+
|
|
25
27
|
- Using Meteor, Phoenix, or socket-based frameworks
|
|
26
28
|
- Need custom real-time events (typing indicators, presence)
|
|
27
29
|
- Behind proxies that don't support SSE well
|
|
@@ -10,6 +10,7 @@ This example builds a support chat interface using Next.js App Router with HTTP/
|
|
|
10
10
|
## What You're Building
|
|
11
11
|
|
|
12
12
|
A chat interface that:
|
|
13
|
+
|
|
13
14
|
- Creates sessions server-side
|
|
14
15
|
- Streams AI responses in real-time
|
|
15
16
|
- Handles tool calls on your server
|
|
@@ -56,7 +57,26 @@ export const octavus = new OctavusClient({
|
|
|
56
57
|
});
|
|
57
58
|
```
|
|
58
59
|
|
|
59
|
-
## Step 4: Create
|
|
60
|
+
## Step 4: Create Upload URLs Endpoint (Optional)
|
|
61
|
+
|
|
62
|
+
If your agent supports file uploads (images, documents), create an endpoint to get presigned URLs:
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
// app/api/upload-urls/route.ts
|
|
66
|
+
import { NextResponse } from 'next/server';
|
|
67
|
+
import { octavus } from '@/lib/octavus';
|
|
68
|
+
|
|
69
|
+
export async function POST(request: Request) {
|
|
70
|
+
const { sessionId, files } = await request.json();
|
|
71
|
+
|
|
72
|
+
// Get presigned URLs from Octavus
|
|
73
|
+
const result = await octavus.files.getUploadUrls(sessionId, files);
|
|
74
|
+
|
|
75
|
+
return NextResponse.json(result);
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Step 5: Create Session Endpoint
|
|
60
80
|
|
|
61
81
|
Sessions hold conversation state. Create one when the user opens the chat:
|
|
62
82
|
|
|
@@ -84,7 +104,7 @@ const sessionId = await octavus.agentSessions.create(agentId, {
|
|
|
84
104
|
});
|
|
85
105
|
```
|
|
86
106
|
|
|
87
|
-
## Step
|
|
107
|
+
## Step 6: Create Trigger Endpoint
|
|
88
108
|
|
|
89
109
|
Triggers execute agent actions. The `user-message` trigger is the most common:
|
|
90
110
|
|
|
@@ -141,7 +161,7 @@ export async function POST(request: Request) {
|
|
|
141
161
|
|
|
142
162
|
**Protocol Note:** Tool names and arguments are defined in your agent's protocol YAML. The tool handlers here must match those definitions.
|
|
143
163
|
|
|
144
|
-
## Step
|
|
164
|
+
## Step 7: Build the Chat Component
|
|
145
165
|
|
|
146
166
|
```tsx
|
|
147
167
|
// components/Chat.tsx
|
|
@@ -182,11 +202,7 @@ export function Chat({ sessionId }: ChatProps) {
|
|
|
182
202
|
|
|
183
203
|
// Send triggers the 'user-message' action
|
|
184
204
|
// The third argument adds the user message to the UI
|
|
185
|
-
await send(
|
|
186
|
-
'user-message',
|
|
187
|
-
{ USER_MESSAGE: message },
|
|
188
|
-
{ userMessage: { content: message } },
|
|
189
|
-
);
|
|
205
|
+
await send('user-message', { USER_MESSAGE: message }, { userMessage: { content: message } });
|
|
190
206
|
};
|
|
191
207
|
|
|
192
208
|
return (
|
|
@@ -194,15 +210,10 @@ export function Chat({ sessionId }: ChatProps) {
|
|
|
194
210
|
{/* Messages */}
|
|
195
211
|
<div className="flex-1 overflow-y-auto p-4 space-y-4">
|
|
196
212
|
{messages.map((msg) => (
|
|
197
|
-
<div
|
|
198
|
-
key={msg.id}
|
|
199
|
-
className={msg.role === 'user' ? 'text-right' : 'text-left'}
|
|
200
|
-
>
|
|
213
|
+
<div key={msg.id} className={msg.role === 'user' ? 'text-right' : 'text-left'}>
|
|
201
214
|
<div
|
|
202
215
|
className={`inline-block p-3 rounded-lg ${
|
|
203
|
-
msg.role === 'user'
|
|
204
|
-
? 'bg-blue-500 text-white'
|
|
205
|
-
: 'bg-gray-100'
|
|
216
|
+
msg.role === 'user' ? 'bg-blue-500 text-white' : 'bg-gray-100'
|
|
206
217
|
}`}
|
|
207
218
|
>
|
|
208
219
|
{msg.parts.map((part, i) => {
|
|
@@ -248,7 +259,7 @@ export function Chat({ sessionId }: ChatProps) {
|
|
|
248
259
|
}
|
|
249
260
|
```
|
|
250
261
|
|
|
251
|
-
## Step
|
|
262
|
+
## Step 8: Create the Page
|
|
252
263
|
|
|
253
264
|
```tsx
|
|
254
265
|
// app/chat/page.tsx
|
|
@@ -307,7 +318,7 @@ The `send()` call maps directly:
|
|
|
307
318
|
|
|
308
319
|
```typescript
|
|
309
320
|
await send(
|
|
310
|
-
'user-message',
|
|
321
|
+
'user-message', // trigger name
|
|
311
322
|
{ USER_MESSAGE: message }, // trigger inputs
|
|
312
323
|
{ userMessage: { content: message } },
|
|
313
324
|
);
|
|
@@ -340,4 +351,3 @@ Tool handlers receive the parameters as `args`:
|
|
|
340
351
|
- [Protocol Overview](/docs/protocol/overview) — Define agent behavior
|
|
341
352
|
- [Messages](/docs/client-sdk/messages) — Rich message rendering
|
|
342
353
|
- [Streaming](/docs/client-sdk/streaming) — Advanced streaming UI
|
|
343
|
-
|