@octavus/docs 0.0.9 → 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 +24 -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 +63 -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/{07-provider-options.md → 08-provider-options.md} +54 -35
- 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 +99 -36
- 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 +99 -36
- package/package.json +12 -2
- package/content/04-protocol/05-handlers.md +0 -251
- package/content/04-protocol/06-agent-config.md +0 -242
- 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-7KXF63FV.js +0 -537
- package/dist/chunk-7KXF63FV.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-TQJG6EBM.js +0 -537
- package/dist/chunk-TQJG6EBM.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
|
@@ -26,10 +26,10 @@ import type { ToolHandlers } from '@octavus/server-sdk';
|
|
|
26
26
|
const tools: ToolHandlers = {
|
|
27
27
|
'get-user-account': async (args) => {
|
|
28
28
|
const userId = args.userId as string;
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
// Query your database
|
|
31
31
|
const user = await db.users.findById(userId);
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
return {
|
|
34
34
|
name: user.name,
|
|
35
35
|
email: user.email,
|
|
@@ -37,18 +37,18 @@ const tools: ToolHandlers = {
|
|
|
37
37
|
createdAt: user.createdAt.toISOString(),
|
|
38
38
|
};
|
|
39
39
|
},
|
|
40
|
-
|
|
40
|
+
|
|
41
41
|
'create-support-ticket': async (args) => {
|
|
42
42
|
const summary = args.summary as string;
|
|
43
43
|
const priority = args.priority as string;
|
|
44
|
-
|
|
44
|
+
|
|
45
45
|
// Create ticket in your system
|
|
46
46
|
const ticket = await ticketService.create({
|
|
47
47
|
summary,
|
|
48
48
|
priority,
|
|
49
49
|
source: 'ai-chat',
|
|
50
50
|
});
|
|
51
|
-
|
|
51
|
+
|
|
52
52
|
return {
|
|
53
53
|
ticketId: ticket.id,
|
|
54
54
|
estimatedResponse: getEstimatedResponse(priority),
|
|
@@ -90,7 +90,7 @@ Arguments are passed as a `Record<string, unknown>`. Type-check as needed:
|
|
|
90
90
|
const query = args.query as string;
|
|
91
91
|
const category = args.category as string | undefined;
|
|
92
92
|
const maxPrice = args.maxPrice as number | undefined;
|
|
93
|
-
|
|
93
|
+
|
|
94
94
|
return await productSearch({ query, category, maxPrice });
|
|
95
95
|
}
|
|
96
96
|
```
|
|
@@ -98,6 +98,7 @@ Arguments are passed as a `Record<string, unknown>`. Type-check as needed:
|
|
|
98
98
|
### Return Values
|
|
99
99
|
|
|
100
100
|
Return any JSON-serializable value. The result is:
|
|
101
|
+
|
|
101
102
|
1. Sent back to the LLM as context
|
|
102
103
|
2. Stored in session state
|
|
103
104
|
3. Optionally stored in a variable for protocol use
|
|
@@ -123,13 +124,13 @@ Throw errors for failures. They're captured and sent to the LLM:
|
|
|
123
124
|
```typescript
|
|
124
125
|
'get-user-account': async (args) => {
|
|
125
126
|
const userId = args.userId as string;
|
|
126
|
-
|
|
127
|
+
|
|
127
128
|
const user = await db.users.findById(userId);
|
|
128
|
-
|
|
129
|
+
|
|
129
130
|
if (!user) {
|
|
130
131
|
throw new Error(`User not found: ${userId}`);
|
|
131
132
|
}
|
|
132
|
-
|
|
133
|
+
|
|
133
134
|
return user;
|
|
134
135
|
}
|
|
135
136
|
```
|
|
@@ -151,15 +152,15 @@ sequenceDiagram
|
|
|
151
152
|
Platform-->>UI: tool-input-start, tool-input-delta
|
|
152
153
|
Platform-->>UI: tool-input-available
|
|
153
154
|
Platform-->>SDK: 2. tool-request (stream pauses)
|
|
154
|
-
|
|
155
|
+
|
|
155
156
|
Note over SDK: 3. Execute handler<br/>tools['get-user']()
|
|
156
|
-
|
|
157
|
+
|
|
157
158
|
SDK-->>UI: 4. tool-output-available
|
|
158
159
|
SDK->>Platform: 5. POST /trigger with results
|
|
159
160
|
Platform->>LLM: 6. Continue with results
|
|
160
161
|
LLM-->>Platform: Response
|
|
161
162
|
Platform-->>UI: text-delta events
|
|
162
|
-
|
|
163
|
+
|
|
163
164
|
Note over LLM,UI: 7. Repeat if more tools needed
|
|
164
165
|
```
|
|
165
166
|
|
|
@@ -174,7 +175,7 @@ import { toSSEStream } from '@octavus/server-sdk';
|
|
|
174
175
|
export async function POST(request: Request) {
|
|
175
176
|
const authToken = request.headers.get('Authorization');
|
|
176
177
|
const user = await validateToken(authToken);
|
|
177
|
-
|
|
178
|
+
|
|
178
179
|
const session = client.agentSessions.attach(sessionId, {
|
|
179
180
|
tools: {
|
|
180
181
|
'get-user-account': async (args) => {
|
|
@@ -191,7 +192,7 @@ export async function POST(request: Request) {
|
|
|
191
192
|
},
|
|
192
193
|
},
|
|
193
194
|
});
|
|
194
|
-
|
|
195
|
+
|
|
195
196
|
const events = session.trigger(triggerName, input);
|
|
196
197
|
return new Response(toSSEStream(events));
|
|
197
198
|
}
|
|
@@ -217,7 +218,7 @@ export async function POST(request: Request) {
|
|
|
217
218
|
'external-api-call': async (args) => {
|
|
218
219
|
const controller = new AbortController();
|
|
219
220
|
const timeout = setTimeout(() => controller.abort(), 10000);
|
|
220
|
-
|
|
221
|
+
|
|
221
222
|
try {
|
|
222
223
|
const response = await fetch(url, { signal: controller.signal });
|
|
223
224
|
return await response.json();
|
|
@@ -232,14 +233,13 @@ export async function POST(request: Request) {
|
|
|
232
233
|
```typescript
|
|
233
234
|
'search-products': async (args) => {
|
|
234
235
|
console.log('Tool call: search-products', { args });
|
|
235
|
-
|
|
236
|
+
|
|
236
237
|
const result = await productSearch(args);
|
|
237
|
-
|
|
238
|
-
console.log('Tool result: search-products', {
|
|
239
|
-
resultCount: result.length
|
|
238
|
+
|
|
239
|
+
console.log('Tool result: search-products', {
|
|
240
|
+
resultCount: result.length
|
|
240
241
|
});
|
|
241
|
-
|
|
242
|
+
|
|
242
243
|
return result;
|
|
243
244
|
}
|
|
244
245
|
```
|
|
245
|
-
|
|
@@ -15,8 +15,8 @@ When you trigger an action, you get an async generator of parsed events:
|
|
|
15
15
|
import { toSSEStream } from '@octavus/server-sdk';
|
|
16
16
|
|
|
17
17
|
// trigger() returns an async generator of StreamEvent
|
|
18
|
-
const events = session.trigger('user-message', {
|
|
19
|
-
USER_MESSAGE: 'Hello!'
|
|
18
|
+
const events = session.trigger('user-message', {
|
|
19
|
+
USER_MESSAGE: 'Hello!',
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
// For HTTP endpoints, convert to SSE stream
|
|
@@ -24,7 +24,7 @@ return new Response(toSSEStream(events), {
|
|
|
24
24
|
headers: {
|
|
25
25
|
'Content-Type': 'text/event-stream',
|
|
26
26
|
'Cache-Control': 'no-cache',
|
|
27
|
-
|
|
27
|
+
Connection: 'keep-alive',
|
|
28
28
|
},
|
|
29
29
|
});
|
|
30
30
|
|
|
@@ -36,7 +36,7 @@ for await (const event of events) {
|
|
|
36
36
|
|
|
37
37
|
## Event Types
|
|
38
38
|
|
|
39
|
-
The stream emits various event types
|
|
39
|
+
The stream emits various event types for lifecycle, text, reasoning, and tool interactions.
|
|
40
40
|
|
|
41
41
|
### Lifecycle Events
|
|
42
42
|
|
|
@@ -55,8 +55,8 @@ The stream emits various event types. Octavus events align with the [Vercel AI S
|
|
|
55
55
|
// - 'error': Error occurred
|
|
56
56
|
// - 'other': Other reason
|
|
57
57
|
|
|
58
|
-
// Error event
|
|
59
|
-
{ type: 'error',
|
|
58
|
+
// Error event (see Error Handling docs for full structure)
|
|
59
|
+
{ type: 'error', errorType: 'internal_error', message: 'Something went wrong', source: 'platform', retryable: false }
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
### Block Events
|
|
@@ -127,7 +127,7 @@ Tool call lifecycle:
|
|
|
127
127
|
{ type: 'tool-output-available', toolCallId: '...', output: { name: 'Demo User', email: '...' } }
|
|
128
128
|
|
|
129
129
|
// Tool output error (failure)
|
|
130
|
-
{ type: 'tool-output-error', toolCallId: '...',
|
|
130
|
+
{ type: 'tool-output-error', toolCallId: '...', error: 'User not found' }
|
|
131
131
|
```
|
|
132
132
|
|
|
133
133
|
### Resource Events
|
|
@@ -142,12 +142,12 @@ Resource updates:
|
|
|
142
142
|
|
|
143
143
|
Each block/tool specifies how it should appear to users:
|
|
144
144
|
|
|
145
|
-
| Mode
|
|
146
|
-
|
|
147
|
-
| `hidden`
|
|
148
|
-
| `name`
|
|
149
|
-
| `description` | Shows description text
|
|
150
|
-
| `stream`
|
|
145
|
+
| Mode | Description |
|
|
146
|
+
| ------------- | ----------------------------------- |
|
|
147
|
+
| `hidden` | Not shown to user (background work) |
|
|
148
|
+
| `name` | Shows block/tool name |
|
|
149
|
+
| `description` | Shows description text |
|
|
150
|
+
| `stream` | Streams content to chat |
|
|
151
151
|
|
|
152
152
|
**Note**: Hidden events are filtered before reaching the client SDK. Your frontend only sees user-facing events.
|
|
153
153
|
|
|
@@ -181,16 +181,46 @@ type StreamEvent =
|
|
|
181
181
|
| ToolRequestEvent;
|
|
182
182
|
```
|
|
183
183
|
|
|
184
|
-
## Error
|
|
184
|
+
## Error Events
|
|
185
185
|
|
|
186
|
-
|
|
186
|
+
Errors are emitted as structured events with type classification:
|
|
187
187
|
|
|
188
188
|
```typescript
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
{
|
|
190
|
+
type: 'error',
|
|
191
|
+
errorType: 'rate_limit_error', // Error classification
|
|
192
|
+
message: 'Rate limit exceeded', // Human-readable message
|
|
193
|
+
source: 'provider', // 'platform' | 'provider' | 'tool'
|
|
194
|
+
retryable: true, // Whether retry is possible
|
|
195
|
+
retryAfter: 60, // Seconds to wait (rate limits)
|
|
196
|
+
code: 'ANTHROPIC_429', // Machine-readable code
|
|
197
|
+
provider: { // Provider details (when applicable)
|
|
198
|
+
name: 'anthropic',
|
|
199
|
+
statusCode: 429,
|
|
200
|
+
requestId: 'req_...'
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Error Types
|
|
206
|
+
|
|
207
|
+
| Type | Description |
|
|
208
|
+
| ---------------------- | --------------------- |
|
|
209
|
+
| `rate_limit_error` | Too many requests |
|
|
210
|
+
| `authentication_error` | Invalid API key |
|
|
211
|
+
| `provider_error` | LLM provider issue |
|
|
212
|
+
| `provider_overloaded` | Provider at capacity |
|
|
213
|
+
| `tool_error` | Tool execution failed |
|
|
214
|
+
| `internal_error` | Platform error |
|
|
191
215
|
|
|
192
|
-
|
|
193
|
-
{ type: 'tool-output-error', toolCallId: '...', errorText: 'Handler threw exception' }
|
|
216
|
+
### Tool Errors
|
|
194
217
|
|
|
195
|
-
|
|
218
|
+
Tool errors are captured per-tool and don't stop the stream:
|
|
219
|
+
|
|
220
|
+
```typescript
|
|
221
|
+
{ type: 'tool-output-error', toolCallId: '...', error: 'Handler threw exception' }
|
|
196
222
|
```
|
|
223
|
+
|
|
224
|
+
The stream always ends with either `finish` or `error`.
|
|
225
|
+
|
|
226
|
+
For client-side error handling patterns, see [Error Handling](/docs/client-sdk/error-handling).
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: CLI
|
|
3
|
+
description: Command-line interface for validating and syncing agent definitions.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Octavus CLI
|
|
7
|
+
|
|
8
|
+
The `@octavus/cli` package provides a command-line interface for validating and syncing agent definitions from your local filesystem to the Octavus platform.
|
|
9
|
+
|
|
10
|
+
**Current version:** `{{VERSION:@octavus/cli}}`
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install --save-dev @octavus/cli
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Configuration
|
|
19
|
+
|
|
20
|
+
The CLI requires an API key with agent management permissions.
|
|
21
|
+
|
|
22
|
+
### Environment Variables
|
|
23
|
+
|
|
24
|
+
| Variable | Description |
|
|
25
|
+
| --------------------- | ------------------------------------------------------- |
|
|
26
|
+
| `OCTAVUS_CLI_API_KEY` | API key with agent management permissions (recommended) |
|
|
27
|
+
| `OCTAVUS_API_KEY` | Fallback if `OCTAVUS_CLI_API_KEY` not set |
|
|
28
|
+
| `OCTAVUS_API_URL` | Optional, defaults to `https://octavus.ai` |
|
|
29
|
+
|
|
30
|
+
### Two-Key Strategy (Recommended)
|
|
31
|
+
|
|
32
|
+
For production deployments, use separate API keys:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# CI/CD or .env.local (not committed)
|
|
36
|
+
OCTAVUS_CLI_API_KEY=oct_sk_... # Agent management permissions
|
|
37
|
+
|
|
38
|
+
# Production .env
|
|
39
|
+
OCTAVUS_API_KEY=oct_sk_... # Session-only permissions
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This ensures production servers only have session permissions (smaller blast radius if leaked), while agent management is restricted to development/CI environments.
|
|
43
|
+
|
|
44
|
+
### Multiple Environments
|
|
45
|
+
|
|
46
|
+
Use separate Octavus projects for staging and production, each with their own API keys. The `--env` flag lets you load different environment files:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Local development (default: .env)
|
|
50
|
+
octavus sync ./agents/my-agent
|
|
51
|
+
|
|
52
|
+
# Staging project
|
|
53
|
+
octavus --env .env.staging sync ./agents/my-agent
|
|
54
|
+
|
|
55
|
+
# Production project
|
|
56
|
+
octavus --env .env.production sync ./agents/my-agent
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Example environment files:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# .env.staging (syncs to your staging project)
|
|
63
|
+
OCTAVUS_CLI_API_KEY=oct_sk_staging_project_key...
|
|
64
|
+
|
|
65
|
+
# .env.production (syncs to your production project)
|
|
66
|
+
OCTAVUS_CLI_API_KEY=oct_sk_production_project_key...
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Each project has its own agents, so you'll get different agent IDs per environment.
|
|
70
|
+
|
|
71
|
+
## Global Options
|
|
72
|
+
|
|
73
|
+
| Option | Description |
|
|
74
|
+
| -------------- | ------------------------------------------------------- |
|
|
75
|
+
| `--env <file>` | Load environment from a specific file (default: `.env`) |
|
|
76
|
+
| `--help` | Show help |
|
|
77
|
+
| `--version` | Show version |
|
|
78
|
+
|
|
79
|
+
## Commands
|
|
80
|
+
|
|
81
|
+
### `octavus sync <path>`
|
|
82
|
+
|
|
83
|
+
Sync an agent definition to the platform. Creates the agent if it doesn't exist, or updates it if it does.
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
octavus sync ./agents/my-agent
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Options:**
|
|
90
|
+
|
|
91
|
+
- `--json` — Output as JSON (for CI/CD parsing)
|
|
92
|
+
- `--quiet` — Suppress non-essential output
|
|
93
|
+
|
|
94
|
+
**Example output:**
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
ℹ Reading agent from ./agents/my-agent...
|
|
98
|
+
ℹ Syncing support-chat...
|
|
99
|
+
✓ Created: support-chat
|
|
100
|
+
Agent ID: clxyz123abc456
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### `octavus validate <path>`
|
|
104
|
+
|
|
105
|
+
Validate an agent definition without saving. Useful for CI/CD pipelines.
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
octavus validate ./agents/my-agent
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Exit codes:**
|
|
112
|
+
|
|
113
|
+
- `0` — Validation passed
|
|
114
|
+
- `1` — Validation errors
|
|
115
|
+
- `2` — Configuration errors (missing API key, etc.)
|
|
116
|
+
|
|
117
|
+
### `octavus list`
|
|
118
|
+
|
|
119
|
+
List all agents in your project.
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
octavus list
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Example output:**
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
SLUG NAME FORMAT ID
|
|
129
|
+
────────────────────────────────────────────────────────────────────────────
|
|
130
|
+
support-chat Support Chat Agent interactive clxyz123abc456
|
|
131
|
+
|
|
132
|
+
1 agent(s)
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### `octavus get <slug>`
|
|
136
|
+
|
|
137
|
+
Get details about a specific agent by its slug.
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
octavus get support-chat
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Agent Directory Structure
|
|
144
|
+
|
|
145
|
+
The CLI expects agent definitions in a specific directory structure:
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
my-agent/
|
|
149
|
+
├── settings.json # Required: Agent metadata
|
|
150
|
+
├── protocol.yaml # Required: Agent protocol
|
|
151
|
+
└── prompts/ # Optional: Prompt templates
|
|
152
|
+
├── system.md
|
|
153
|
+
└── user-message.md
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### settings.json
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
{
|
|
160
|
+
"slug": "my-agent",
|
|
161
|
+
"name": "My Agent",
|
|
162
|
+
"description": "A helpful assistant",
|
|
163
|
+
"format": "interactive"
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### protocol.yaml
|
|
168
|
+
|
|
169
|
+
See the [Protocol documentation](/docs/protocol/overview) for details on protocol syntax.
|
|
170
|
+
|
|
171
|
+
## CI/CD Integration
|
|
172
|
+
|
|
173
|
+
### GitHub Actions
|
|
174
|
+
|
|
175
|
+
```yaml
|
|
176
|
+
name: Validate and Sync Agents
|
|
177
|
+
|
|
178
|
+
on:
|
|
179
|
+
push:
|
|
180
|
+
branches: [main]
|
|
181
|
+
paths:
|
|
182
|
+
- 'agents/**'
|
|
183
|
+
|
|
184
|
+
jobs:
|
|
185
|
+
sync:
|
|
186
|
+
runs-on: ubuntu-latest
|
|
187
|
+
steps:
|
|
188
|
+
- uses: actions/checkout@v4
|
|
189
|
+
|
|
190
|
+
- uses: actions/setup-node@v4
|
|
191
|
+
with:
|
|
192
|
+
node-version: '22'
|
|
193
|
+
|
|
194
|
+
- run: npm install
|
|
195
|
+
|
|
196
|
+
- name: Validate agent
|
|
197
|
+
run: npx octavus validate ./agents/support-chat
|
|
198
|
+
env:
|
|
199
|
+
OCTAVUS_CLI_API_KEY: ${{ secrets.OCTAVUS_CLI_API_KEY }}
|
|
200
|
+
|
|
201
|
+
- name: Sync agent
|
|
202
|
+
run: npx octavus sync ./agents/support-chat
|
|
203
|
+
env:
|
|
204
|
+
OCTAVUS_CLI_API_KEY: ${{ secrets.OCTAVUS_CLI_API_KEY }}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Package.json Scripts
|
|
208
|
+
|
|
209
|
+
Add sync scripts to your `package.json`:
|
|
210
|
+
|
|
211
|
+
```json
|
|
212
|
+
{
|
|
213
|
+
"scripts": {
|
|
214
|
+
"agents:validate": "octavus validate ./agents/my-agent",
|
|
215
|
+
"agents:sync": "octavus sync ./agents/my-agent"
|
|
216
|
+
},
|
|
217
|
+
"devDependencies": {
|
|
218
|
+
"@octavus/cli": "^0.1.0"
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Workflow
|
|
224
|
+
|
|
225
|
+
The recommended workflow for managing agents:
|
|
226
|
+
|
|
227
|
+
1. **Define agent locally** — Create `settings.json`, `protocol.yaml`, and prompts
|
|
228
|
+
2. **Validate** — Run `octavus validate ./my-agent` to check for errors
|
|
229
|
+
3. **Sync** — Run `octavus sync ./my-agent` to push to platform
|
|
230
|
+
4. **Store agent ID** — Save the output ID in an environment variable
|
|
231
|
+
5. **Use in app** — Read the ID from env and pass to `client.agentSessions.create()`
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
# After syncing: octavus sync ./agents/support-chat
|
|
235
|
+
# Output: Agent ID: clxyz123abc456
|
|
236
|
+
|
|
237
|
+
# Add to your .env file
|
|
238
|
+
OCTAVUS_SUPPORT_AGENT_ID=clxyz123abc456
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
```typescript
|
|
242
|
+
const agentId = process.env.OCTAVUS_SUPPORT_AGENT_ID;
|
|
243
|
+
|
|
244
|
+
const sessionId = await client.agentSessions.create(agentId, {
|
|
245
|
+
COMPANY_NAME: 'Acme Corp',
|
|
246
|
+
});
|
|
247
|
+
```
|