@octavus/docs 0.0.2 → 0.0.4
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/content/01-getting-started/02-quickstart.md +10 -4
- package/content/02-server-sdk/01-overview.md +2 -0
- package/content/02-server-sdk/03-tools.md +3 -2
- package/content/02-server-sdk/04-streaming.md +77 -100
- package/content/03-client-sdk/01-overview.md +5 -4
- package/content/03-client-sdk/02-messages.md +9 -10
- package/content/03-client-sdk/03-streaming.md +9 -10
- package/content/03-client-sdk/04-execution-blocks.md +2 -3
- package/content/04-protocol/01-overview.md +5 -3
- package/content/04-protocol/02-input-resources.md +30 -37
- package/content/04-protocol/03-triggers.md +4 -4
- package/content/04-protocol/04-tools.md +10 -18
- package/content/04-protocol/06-agent-config.md +2 -1
- package/content/05-api-reference/01-overview.md +12 -4
- package/content/05-api-reference/02-sessions.md +35 -29
- package/content/05-api-reference/03-agents.md +16 -14
- package/dist/chunk-2ZBPX5QB.js +421 -0
- package/dist/chunk-2ZBPX5QB.js.map +1 -0
- package/dist/chunk-3PIIST4D.js +421 -0
- package/dist/chunk-3PIIST4D.js.map +1 -0
- package/dist/chunk-42JETGDO.js +421 -0
- package/dist/chunk-42JETGDO.js.map +1 -0
- package/dist/chunk-7AOWCJHW.js +421 -0
- package/dist/chunk-7AOWCJHW.js.map +1 -0
- package/dist/chunk-7FPUAWSX.js +421 -0
- package/dist/chunk-7FPUAWSX.js.map +1 -0
- package/dist/chunk-APASMJBS.js +421 -0
- package/dist/chunk-APASMJBS.js.map +1 -0
- package/dist/chunk-BCEV3WV2.js +421 -0
- package/dist/chunk-BCEV3WV2.js.map +1 -0
- package/dist/chunk-EPDM2NIJ.js +421 -0
- package/dist/chunk-EPDM2NIJ.js.map +1 -0
- package/dist/chunk-GJ6FMIPD.js +421 -0
- package/dist/chunk-GJ6FMIPD.js.map +1 -0
- package/dist/chunk-IKQHGGUZ.js +421 -0
- package/dist/chunk-IKQHGGUZ.js.map +1 -0
- package/dist/chunk-JCBQRD5N.js +421 -0
- package/dist/chunk-JCBQRD5N.js.map +1 -0
- package/dist/chunk-MA3P7WCA.js +421 -0
- package/dist/chunk-MA3P7WCA.js.map +1 -0
- package/dist/chunk-MDMRCS4W.mjs +421 -0
- package/dist/chunk-MDMRCS4W.mjs.map +1 -0
- package/dist/chunk-MJXTA2R6.js +421 -0
- package/dist/chunk-MJXTA2R6.js.map +1 -0
- package/dist/chunk-O5TLYMQP.js +421 -0
- package/dist/chunk-O5TLYMQP.js.map +1 -0
- package/dist/chunk-TGJSIJYP.js +421 -0
- package/dist/chunk-TGJSIJYP.js.map +1 -0
- package/dist/chunk-TQZRBMU7.js +421 -0
- package/dist/chunk-TQZRBMU7.js.map +1 -0
- package/dist/chunk-TRL4RSEO.js +421 -0
- package/dist/chunk-TRL4RSEO.js.map +1 -0
- package/dist/chunk-VCASA6KL.js +421 -0
- package/dist/chunk-VCASA6KL.js.map +1 -0
- package/dist/chunk-WPXKIHLT.js +421 -0
- package/dist/chunk-WPXKIHLT.js.map +1 -0
- package/dist/chunk-ZKZVV4OQ.js +421 -0
- package/dist/chunk-ZKZVV4OQ.js.map +1 -0
- package/dist/chunk-ZOFEX73I.js +421 -0
- package/dist/chunk-ZOFEX73I.js.map +1 -0
- package/dist/content.js +1 -1
- package/dist/content.mjs +17 -0
- package/dist/content.mjs.map +1 -0
- package/dist/docs.json +17 -17
- package/dist/index.js +1 -1
- package/dist/index.mjs +11 -0
- package/dist/index.mjs.map +1 -0
- package/dist/search-index.json +1 -1
- package/dist/search.js +1 -1
- package/dist/search.js.map +1 -1
- package/dist/search.mjs +30 -0
- package/dist/search.mjs.map +1 -0
- package/dist/sections.json +17 -17
- package/package.json +1 -1
|
@@ -51,10 +51,16 @@ import { NextResponse } from 'next/server';
|
|
|
51
51
|
import { octavus } from '@/lib/octavus';
|
|
52
52
|
|
|
53
53
|
export async function POST(request: Request) {
|
|
54
|
-
const {
|
|
54
|
+
const { agentSlug, input } = await request.json();
|
|
55
55
|
|
|
56
|
-
//
|
|
57
|
-
const
|
|
56
|
+
// Look up agent by slug to get its ID
|
|
57
|
+
const agent = await octavus.agents.getBySlug(agentSlug);
|
|
58
|
+
if (!agent) {
|
|
59
|
+
return NextResponse.json({ error: 'Agent not found' }, { status: 404 });
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Create a new session using the agent ID
|
|
63
|
+
const sessionId = await octavus.agentSessions.create(agent.id, input);
|
|
58
64
|
|
|
59
65
|
return NextResponse.json({ sessionId });
|
|
60
66
|
}
|
|
@@ -227,7 +233,7 @@ export default function ChatPage() {
|
|
|
227
233
|
method: 'POST',
|
|
228
234
|
headers: { 'Content-Type': 'application/json' },
|
|
229
235
|
body: JSON.stringify({
|
|
230
|
-
|
|
236
|
+
agentSlug: 'support-chat',
|
|
231
237
|
input: {
|
|
232
238
|
COMPANY_NAME: 'Acme Corp',
|
|
233
239
|
PRODUCT_NAME: 'Widget Pro',
|
|
@@ -7,6 +7,8 @@ description: Introduction to the Octavus Server SDK for backend integration.
|
|
|
7
7
|
|
|
8
8
|
The `@octavus/server-sdk` package provides a Node.js SDK for integrating Octavus agents into your backend application. It handles session management, streaming, and the tool execution continuation loop.
|
|
9
9
|
|
|
10
|
+
**Current version:** `{{VERSION:@octavus/server-sdk}}`
|
|
11
|
+
|
|
10
12
|
## Installation
|
|
11
13
|
|
|
12
14
|
```bash
|
|
@@ -148,12 +148,13 @@ sequenceDiagram
|
|
|
148
148
|
participant UI as Your Frontend
|
|
149
149
|
|
|
150
150
|
LLM->>Platform: 1. Decides to call tool
|
|
151
|
-
Platform-->>UI: tool-
|
|
151
|
+
Platform-->>UI: tool-input-start, tool-input-delta
|
|
152
|
+
Platform-->>UI: tool-input-available
|
|
152
153
|
Platform-->>SDK: 2. tool-request (stream pauses)
|
|
153
154
|
|
|
154
155
|
Note over SDK: 3. Execute handler<br/>tools['get-user']()
|
|
155
156
|
|
|
156
|
-
SDK-->>UI: 4. tool-
|
|
157
|
+
SDK-->>UI: 4. tool-output-available
|
|
157
158
|
SDK->>Platform: 5. POST /trigger with results
|
|
158
159
|
Platform->>LLM: 6. Continue with results
|
|
159
160
|
LLM-->>Platform: Response
|
|
@@ -28,7 +28,28 @@ return new Response(stream, {
|
|
|
28
28
|
|
|
29
29
|
## Event Types
|
|
30
30
|
|
|
31
|
-
The stream emits various event types
|
|
31
|
+
The stream emits various event types. Octavus events align with the [Vercel AI SDK](https://sdk.vercel.ai/) naming conventions where applicable.
|
|
32
|
+
|
|
33
|
+
### Lifecycle Events
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
// Stream started
|
|
37
|
+
{ type: 'start', messageId: '...' }
|
|
38
|
+
|
|
39
|
+
// Stream completed
|
|
40
|
+
{ type: 'finish', finishReason: 'stop' }
|
|
41
|
+
|
|
42
|
+
// Possible finish reasons:
|
|
43
|
+
// - 'stop': Normal completion
|
|
44
|
+
// - 'tool-calls': Waiting for tool execution (handled by SDK)
|
|
45
|
+
// - 'length': Max tokens reached
|
|
46
|
+
// - 'content-filter': Content filtered
|
|
47
|
+
// - 'error': Error occurred
|
|
48
|
+
// - 'other': Other reason
|
|
49
|
+
|
|
50
|
+
// Error event
|
|
51
|
+
{ type: 'error', errorText: 'Something went wrong' }
|
|
52
|
+
```
|
|
32
53
|
|
|
33
54
|
### Block Events
|
|
34
55
|
|
|
@@ -36,7 +57,7 @@ Track execution progress:
|
|
|
36
57
|
|
|
37
58
|
```typescript
|
|
38
59
|
// Block started
|
|
39
|
-
{ type: 'block-start', blockId: '...', blockName: 'Respond to user', blockType: 'next-message', display: 'stream' }
|
|
60
|
+
{ type: 'block-start', blockId: '...', blockName: 'Respond to user', blockType: 'next-message', display: 'stream', thread: 'main' }
|
|
40
61
|
|
|
41
62
|
// Block completed
|
|
42
63
|
{ type: 'block-end', blockId: '...', summary: 'Generated response' }
|
|
@@ -51,48 +72,54 @@ Streaming text content:
|
|
|
51
72
|
{ type: 'text-start', id: '...' }
|
|
52
73
|
|
|
53
74
|
// Incremental text (most common event)
|
|
54
|
-
{ type: 'text-delta',
|
|
55
|
-
{ type: 'text-delta',
|
|
56
|
-
{ type: 'text-delta',
|
|
57
|
-
{ type: 'text-delta',
|
|
58
|
-
{ type: 'text-delta',
|
|
59
|
-
{ type: 'text-delta',
|
|
75
|
+
{ type: 'text-delta', id: '...', delta: 'Hello' }
|
|
76
|
+
{ type: 'text-delta', id: '...', delta: '!' }
|
|
77
|
+
{ type: 'text-delta', id: '...', delta: ' How' }
|
|
78
|
+
{ type: 'text-delta', id: '...', delta: ' can' }
|
|
79
|
+
{ type: 'text-delta', id: '...', delta: ' I' }
|
|
80
|
+
{ type: 'text-delta', id: '...', delta: ' help?' }
|
|
60
81
|
|
|
61
82
|
// Text generation ended
|
|
62
83
|
{ type: 'text-end', id: '...' }
|
|
63
84
|
```
|
|
64
85
|
|
|
65
|
-
###
|
|
86
|
+
### Reasoning Events
|
|
66
87
|
|
|
67
|
-
|
|
88
|
+
Extended reasoning (for supported models like Claude):
|
|
68
89
|
|
|
69
90
|
```typescript
|
|
70
|
-
//
|
|
71
|
-
{ type: '
|
|
72
|
-
|
|
73
|
-
// Tool arguments (JSON string)
|
|
74
|
-
{ type: 'tool-call-args', toolCallId: '...', argsJson: '{"userId":"user-123"}' }
|
|
91
|
+
// Reasoning started
|
|
92
|
+
{ type: 'reasoning-start', id: '...' }
|
|
75
93
|
|
|
76
|
-
//
|
|
77
|
-
{ type: '
|
|
94
|
+
// Reasoning content
|
|
95
|
+
{ type: 'reasoning-delta', id: '...', delta: 'Let me analyze this request...' }
|
|
78
96
|
|
|
79
|
-
//
|
|
80
|
-
{ type: '
|
|
97
|
+
// Reasoning ended
|
|
98
|
+
{ type: 'reasoning-end', id: '...' }
|
|
81
99
|
```
|
|
82
100
|
|
|
83
|
-
###
|
|
101
|
+
### Tool Events
|
|
84
102
|
|
|
85
|
-
|
|
103
|
+
Tool call lifecycle:
|
|
86
104
|
|
|
87
105
|
```typescript
|
|
88
|
-
//
|
|
89
|
-
{ type: '
|
|
106
|
+
// Tool input started
|
|
107
|
+
{ type: 'tool-input-start', toolCallId: '...', toolName: 'get-user-account', title: 'Looking up account' }
|
|
108
|
+
|
|
109
|
+
// Tool input/arguments streaming
|
|
110
|
+
{ type: 'tool-input-delta', toolCallId: '...', inputTextDelta: '{"userId":"user-123"}' }
|
|
111
|
+
|
|
112
|
+
// Tool input streaming ended
|
|
113
|
+
{ type: 'tool-input-end', toolCallId: '...' }
|
|
90
114
|
|
|
91
|
-
//
|
|
92
|
-
{ type: '
|
|
115
|
+
// Tool input is complete and available
|
|
116
|
+
{ type: 'tool-input-available', toolCallId: '...', toolName: 'get-user-account', input: { userId: 'user-123' } }
|
|
93
117
|
|
|
94
|
-
//
|
|
95
|
-
{ type: '
|
|
118
|
+
// Tool output available (success)
|
|
119
|
+
{ type: 'tool-output-available', toolCallId: '...', output: { name: 'Demo User', email: '...' } }
|
|
120
|
+
|
|
121
|
+
// Tool output error (failure)
|
|
122
|
+
{ type: 'tool-output-error', toolCallId: '...', errorText: 'User not found' }
|
|
96
123
|
```
|
|
97
124
|
|
|
98
125
|
### Resource Events
|
|
@@ -103,22 +130,6 @@ Resource updates:
|
|
|
103
130
|
{ type: 'resource-update', name: 'CONVERSATION_SUMMARY', value: 'User asked about...' }
|
|
104
131
|
```
|
|
105
132
|
|
|
106
|
-
### Completion Events
|
|
107
|
-
|
|
108
|
-
```typescript
|
|
109
|
-
// Stream completed
|
|
110
|
-
{ type: 'done', finishReason: 'stop' }
|
|
111
|
-
|
|
112
|
-
// Possible finish reasons:
|
|
113
|
-
// - 'stop': Normal completion
|
|
114
|
-
// - 'tool-calls': Waiting for tool execution (handled by SDK)
|
|
115
|
-
// - 'length': Max tokens reached
|
|
116
|
-
// - 'error': Error occurred
|
|
117
|
-
|
|
118
|
-
// Error event
|
|
119
|
-
{ type: 'error', message: 'Something went wrong', code: 'EXECUTION_ERROR' }
|
|
120
|
-
```
|
|
121
|
-
|
|
122
133
|
## Display Modes
|
|
123
134
|
|
|
124
135
|
Each block/tool specifies how it should appear to users:
|
|
@@ -136,63 +147,30 @@ Each block/tool specifies how it should appear to users:
|
|
|
136
147
|
|
|
137
148
|
```typescript
|
|
138
149
|
type StreamEvent =
|
|
139
|
-
|
|
150
|
+
// Lifecycle
|
|
151
|
+
| StartEvent
|
|
152
|
+
| FinishEvent
|
|
153
|
+
| ErrorEvent
|
|
154
|
+
// Text
|
|
140
155
|
| TextStartEvent
|
|
156
|
+
| TextDeltaEvent
|
|
141
157
|
| TextEndEvent
|
|
142
|
-
|
|
143
|
-
|
|
|
144
|
-
|
|
|
145
|
-
|
|
|
146
|
-
|
|
158
|
+
// Reasoning
|
|
159
|
+
| ReasoningStartEvent
|
|
160
|
+
| ReasoningDeltaEvent
|
|
161
|
+
| ReasoningEndEvent
|
|
162
|
+
// Tool Input/Output
|
|
163
|
+
| ToolInputStartEvent
|
|
164
|
+
| ToolInputDeltaEvent
|
|
165
|
+
| ToolInputEndEvent
|
|
166
|
+
| ToolInputAvailableEvent
|
|
167
|
+
| ToolOutputAvailableEvent
|
|
168
|
+
| ToolOutputErrorEvent
|
|
169
|
+
// Octavus-Specific
|
|
147
170
|
| BlockStartEvent
|
|
148
171
|
| BlockEndEvent
|
|
149
|
-
|
|
|
150
|
-
|
|
|
151
|
-
| ThinkingEndEvent
|
|
152
|
-
| DoneEvent
|
|
153
|
-
| ErrorEvent;
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
## Handling Streams Manually
|
|
157
|
-
|
|
158
|
-
If you need to process the stream server-side:
|
|
159
|
-
|
|
160
|
-
```typescript
|
|
161
|
-
import { safeParseStreamEvent } from '@octavus/core';
|
|
162
|
-
|
|
163
|
-
const { stream } = session.trigger('user-message', { USER_MESSAGE: 'Hello' });
|
|
164
|
-
|
|
165
|
-
const reader = stream.getReader();
|
|
166
|
-
const decoder = new TextDecoder();
|
|
167
|
-
|
|
168
|
-
let buffer = '';
|
|
169
|
-
|
|
170
|
-
while (true) {
|
|
171
|
-
const { done, value } = await reader.read();
|
|
172
|
-
if (done) break;
|
|
173
|
-
|
|
174
|
-
buffer += decoder.decode(value, { stream: true });
|
|
175
|
-
const lines = buffer.split('\n');
|
|
176
|
-
buffer = lines.pop() ?? '';
|
|
177
|
-
|
|
178
|
-
for (const line of lines) {
|
|
179
|
-
if (line.startsWith('data: ') && line !== 'data: [DONE]') {
|
|
180
|
-
const parsed = safeParseStreamEvent(JSON.parse(line.slice(6)));
|
|
181
|
-
if (parsed.success) {
|
|
182
|
-
const event = parsed.data;
|
|
183
|
-
|
|
184
|
-
switch (event.type) {
|
|
185
|
-
case 'text-delta':
|
|
186
|
-
process.stdout.write(event.content);
|
|
187
|
-
break;
|
|
188
|
-
case 'done':
|
|
189
|
-
console.log('\nDone:', event.finishReason);
|
|
190
|
-
break;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
172
|
+
| ResourceUpdateEvent
|
|
173
|
+
| ToolRequestEvent;
|
|
196
174
|
```
|
|
197
175
|
|
|
198
176
|
## Error Recovery
|
|
@@ -201,11 +179,10 @@ The SDK handles common error scenarios:
|
|
|
201
179
|
|
|
202
180
|
```typescript
|
|
203
181
|
// Network errors are caught and emitted
|
|
204
|
-
{ type: 'error',
|
|
182
|
+
{ type: 'error', errorText: 'Network request failed' }
|
|
205
183
|
|
|
206
184
|
// Tool errors are captured per-tool
|
|
207
|
-
{ type: 'tool-
|
|
185
|
+
{ type: 'tool-output-error', toolCallId: '...', errorText: 'Handler threw exception' }
|
|
208
186
|
|
|
209
|
-
// The stream always ends with either '
|
|
187
|
+
// The stream always ends with either 'finish' or 'error'
|
|
210
188
|
```
|
|
211
|
-
|
|
@@ -7,6 +7,8 @@ description: Introduction to the Octavus Client SDK for building chat interfaces
|
|
|
7
7
|
|
|
8
8
|
The `@octavus/client-sdk` package provides React hooks for building chat interfaces with Octavus agents. It handles streaming, message state, and execution blocks.
|
|
9
9
|
|
|
10
|
+
**Current version:** `{{VERSION:@octavus/client-sdk}}`
|
|
11
|
+
|
|
10
12
|
## Installation
|
|
11
13
|
|
|
12
14
|
```bash
|
|
@@ -61,7 +63,7 @@ Text streams incrementally as the LLM generates it:
|
|
|
61
63
|
const { streamingText, streamingParts } = useOctavusChat({...});
|
|
62
64
|
|
|
63
65
|
// streamingText: Current streaming text
|
|
64
|
-
// streamingParts: Structured parts (text,
|
|
66
|
+
// streamingParts: Structured parts (text, reasoning, tool calls)
|
|
65
67
|
```
|
|
66
68
|
|
|
67
69
|
### Message History
|
|
@@ -77,7 +79,7 @@ const { messages } = useOctavusChat({...});
|
|
|
77
79
|
// - content: Text content
|
|
78
80
|
// - parts: Ordered content parts
|
|
79
81
|
// - toolCalls: Tool call information
|
|
80
|
-
// -
|
|
82
|
+
// - reasoning: Extended reasoning (if enabled)
|
|
81
83
|
```
|
|
82
84
|
|
|
83
85
|
### Execution Blocks
|
|
@@ -132,7 +134,7 @@ interface UseOctavusChatReturn {
|
|
|
132
134
|
streamingText: string;
|
|
133
135
|
streamingParts: MessagePart[];
|
|
134
136
|
executionBlocks: ExecutionBlock[];
|
|
135
|
-
|
|
137
|
+
reasoningText: string;
|
|
136
138
|
|
|
137
139
|
// Actions
|
|
138
140
|
addUserMessage: (content: string) => void;
|
|
@@ -145,4 +147,3 @@ interface UseOctavusChatReturn {
|
|
|
145
147
|
- [Messages](/docs/client-sdk/messages) — Working with message state
|
|
146
148
|
- [Streaming](/docs/client-sdk/streaming) — Building streaming UIs
|
|
147
149
|
- [Execution Blocks](/docs/client-sdk/execution-blocks) — Showing agent progress
|
|
148
|
-
|
|
@@ -16,7 +16,7 @@ interface Message {
|
|
|
16
16
|
content: string;
|
|
17
17
|
parts?: MessagePart[];
|
|
18
18
|
toolCalls?: ToolCallWithDescription[];
|
|
19
|
-
|
|
19
|
+
reasoning?: string;
|
|
20
20
|
visible?: boolean;
|
|
21
21
|
createdAt: Date;
|
|
22
22
|
}
|
|
@@ -28,9 +28,9 @@ For rich content display, use the `parts` array which preserves content ordering
|
|
|
28
28
|
|
|
29
29
|
```typescript
|
|
30
30
|
interface MessagePart {
|
|
31
|
-
type: 'text' | '
|
|
31
|
+
type: 'text' | 'reasoning' | 'tool-call';
|
|
32
32
|
visible: boolean;
|
|
33
|
-
content?: string; // For text and
|
|
33
|
+
content?: string; // For text and reasoning
|
|
34
34
|
toolCall?: ToolCallInfo; // For tool-call
|
|
35
35
|
thread?: string; // For non-main thread content
|
|
36
36
|
}
|
|
@@ -77,7 +77,7 @@ function MessageList({ messages }: { messages: Message[] }) {
|
|
|
77
77
|
|
|
78
78
|
### Rich Rendering with Parts
|
|
79
79
|
|
|
80
|
-
For messages with tool calls and
|
|
80
|
+
For messages with tool calls and reasoning, render parts in order:
|
|
81
81
|
|
|
82
82
|
```tsx
|
|
83
83
|
function MessageContent({ message }: { message: Message }) {
|
|
@@ -94,7 +94,7 @@ function MessageContent({ message }: { message: Message }) {
|
|
|
94
94
|
case 'text':
|
|
95
95
|
return <p key={i}>{part.content}</p>;
|
|
96
96
|
|
|
97
|
-
case '
|
|
97
|
+
case 'reasoning':
|
|
98
98
|
return (
|
|
99
99
|
<details key={i} className="text-gray-500">
|
|
100
100
|
<summary>Thinking...</summary>
|
|
@@ -106,7 +106,7 @@ function MessageContent({ message }: { message: Message }) {
|
|
|
106
106
|
return (
|
|
107
107
|
<div key={i} className="bg-gray-100 p-2 rounded text-sm">
|
|
108
108
|
🔧 {part.toolCall?.name}
|
|
109
|
-
{part.toolCall?.status === '
|
|
109
|
+
{part.toolCall?.status === 'available' && ' ✓'}
|
|
110
110
|
</div>
|
|
111
111
|
);
|
|
112
112
|
|
|
@@ -129,7 +129,7 @@ interface ToolCallInfo {
|
|
|
129
129
|
name: string;
|
|
130
130
|
description?: string;
|
|
131
131
|
arguments: Record<string, unknown>;
|
|
132
|
-
status: 'pending' | '
|
|
132
|
+
status: 'pending' | 'streaming' | 'available' | 'error';
|
|
133
133
|
result?: unknown;
|
|
134
134
|
error?: string;
|
|
135
135
|
}
|
|
@@ -147,7 +147,7 @@ function ToolCallCard({ toolCall }: { toolCall: ToolCallInfo }) {
|
|
|
147
147
|
<StatusBadge status={toolCall.status} />
|
|
148
148
|
</div>
|
|
149
149
|
|
|
150
|
-
{toolCall.status === '
|
|
150
|
+
{toolCall.status === 'available' && toolCall.result && (
|
|
151
151
|
<pre className="mt-2 text-xs bg-gray-50 p-2 rounded">
|
|
152
152
|
{JSON.stringify(toolCall.result, null, 2)}
|
|
153
153
|
</pre>
|
|
@@ -178,7 +178,7 @@ const initialMessages = sessionState.messages
|
|
|
178
178
|
content: msg.content,
|
|
179
179
|
parts: msg.parts,
|
|
180
180
|
toolCalls: msg.toolCalls,
|
|
181
|
-
|
|
181
|
+
reasoning: msg.reasoning,
|
|
182
182
|
createdAt: new Date(msg.createdAt),
|
|
183
183
|
}));
|
|
184
184
|
|
|
@@ -204,4 +204,3 @@ useOctavusChat({
|
|
|
204
204
|
},
|
|
205
205
|
});
|
|
206
206
|
```
|
|
207
|
-
|
|
@@ -13,7 +13,7 @@ The Client SDK provides real-time access to streaming content, enabling responsi
|
|
|
13
13
|
const {
|
|
14
14
|
streamingText, // Current visible text being streamed
|
|
15
15
|
streamingParts, // Structured parts being streamed
|
|
16
|
-
|
|
16
|
+
reasoningText, // Current reasoning content
|
|
17
17
|
status, // 'idle' | 'loading' | 'streaming' | 'error'
|
|
18
18
|
isLoading, // true during loading or streaming
|
|
19
19
|
} = useOctavusChat({...});
|
|
@@ -59,7 +59,7 @@ function StreamingContent() {
|
|
|
59
59
|
case 'text':
|
|
60
60
|
return <span key={i}>{part.content}</span>;
|
|
61
61
|
|
|
62
|
-
case '
|
|
62
|
+
case 'reasoning':
|
|
63
63
|
return (
|
|
64
64
|
<div key={i} className="text-gray-500 italic">
|
|
65
65
|
💭 {part.content}
|
|
@@ -80,15 +80,15 @@ function StreamingContent() {
|
|
|
80
80
|
}
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
-
##
|
|
83
|
+
## Reasoning Indicator
|
|
84
84
|
|
|
85
|
-
Show when the model is
|
|
85
|
+
Show when the model is using extended reasoning:
|
|
86
86
|
|
|
87
87
|
```tsx
|
|
88
|
-
function
|
|
89
|
-
const {
|
|
88
|
+
function ReasoningIndicator() {
|
|
89
|
+
const { reasoningText, status } = useOctavusChat({...});
|
|
90
90
|
|
|
91
|
-
if (!
|
|
91
|
+
if (!reasoningText || status !== 'streaming') {
|
|
92
92
|
return null;
|
|
93
93
|
}
|
|
94
94
|
|
|
@@ -99,7 +99,7 @@ function ThinkingIndicator() {
|
|
|
99
99
|
<span className="font-medium">Thinking...</span>
|
|
100
100
|
</div>
|
|
101
101
|
<p className="mt-2 text-sm text-gray-600 line-clamp-3">
|
|
102
|
-
{
|
|
102
|
+
{reasoningText}
|
|
103
103
|
</p>
|
|
104
104
|
</div>
|
|
105
105
|
);
|
|
@@ -160,7 +160,7 @@ function ChatWithTools() {
|
|
|
160
160
|
|
|
161
161
|
// Find active tool call
|
|
162
162
|
const activeToolCall = streamingParts.find(
|
|
163
|
-
p => p.type === 'tool-call' && p.toolCall?.status === '
|
|
163
|
+
p => p.type === 'tool-call' && p.toolCall?.status === 'streaming'
|
|
164
164
|
);
|
|
165
165
|
|
|
166
166
|
return (
|
|
@@ -212,4 +212,3 @@ function StreamingContent() {
|
|
|
212
212
|
);
|
|
213
213
|
}
|
|
214
214
|
```
|
|
215
|
-
|
|
@@ -20,7 +20,7 @@ interface ExecutionBlock {
|
|
|
20
20
|
outputToChat: boolean; // Whether output goes to main chat
|
|
21
21
|
thread?: string; // For named threads
|
|
22
22
|
streamingText: string; // Current streaming content
|
|
23
|
-
|
|
23
|
+
reasoning?: string; // Extended reasoning content
|
|
24
24
|
toolCalls: ToolCallWithDescription[];
|
|
25
25
|
startedAt: Date;
|
|
26
26
|
completedAt?: Date;
|
|
@@ -85,7 +85,7 @@ function ExecutionBlockCard({ block }: { block: ExecutionBlock }) {
|
|
|
85
85
|
{block.toolCalls.map((tc) => (
|
|
86
86
|
<div key={tc.id} className="text-sm flex items-center gap-1">
|
|
87
87
|
🔧 {tc.description || tc.name}
|
|
88
|
-
{tc.status === '
|
|
88
|
+
{tc.status === 'available' && ' ✓'}
|
|
89
89
|
{tc.status === 'error' && ' ✗'}
|
|
90
90
|
</div>
|
|
91
91
|
))}
|
|
@@ -228,4 +228,3 @@ function getBlockLabel(block: ExecutionBlock): string {
|
|
|
228
228
|
// ○ Creating a support ticket
|
|
229
229
|
// ○ Respond with ticket info
|
|
230
230
|
```
|
|
231
|
-
|
|
@@ -39,10 +39,12 @@ triggers:
|
|
|
39
39
|
request-human:
|
|
40
40
|
description: User clicks "Talk to Human"
|
|
41
41
|
|
|
42
|
-
# Temporary variables for execution
|
|
42
|
+
# Temporary variables for execution (with types)
|
|
43
43
|
variables:
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
SUMMARY:
|
|
45
|
+
type: string
|
|
46
|
+
TICKET:
|
|
47
|
+
type: unknown
|
|
46
48
|
|
|
47
49
|
# Tools the agent can use
|
|
48
50
|
tools:
|
|
@@ -41,7 +41,7 @@ input:
|
|
|
41
41
|
|
|
42
42
|
| Field | Required | Description |
|
|
43
43
|
|-------|----------|-------------|
|
|
44
|
-
| `type` | Yes | Data type: `string`, `number`, `boolean`, `
|
|
44
|
+
| `type` | Yes | Data type: `string`, `number`, `boolean`, `unknown` |
|
|
45
45
|
| `description` | No | Describes what this input is for |
|
|
46
46
|
| `optional` | No | If true, consumer doesn't have to provide it |
|
|
47
47
|
| `default` | No | Default value if not provided (defaults to `"NONE"`) |
|
|
@@ -74,20 +74,21 @@ Resources are persistent state that:
|
|
|
74
74
|
|
|
75
75
|
```yaml
|
|
76
76
|
resources:
|
|
77
|
-
#
|
|
77
|
+
# String resource with default
|
|
78
78
|
CONVERSATION_SUMMARY:
|
|
79
|
+
type: string
|
|
79
80
|
description: Running summary of the conversation
|
|
80
81
|
default: ""
|
|
81
82
|
|
|
82
|
-
# Resource with type
|
|
83
|
+
# Resource with unknown type (for complex data)
|
|
83
84
|
USER_CONTEXT:
|
|
84
|
-
type:
|
|
85
|
+
type: unknown
|
|
85
86
|
description: Cached user information
|
|
86
87
|
default: {}
|
|
87
88
|
|
|
88
89
|
# Read-only resource (agent can read but not write)
|
|
89
90
|
SYSTEM_CONFIG:
|
|
90
|
-
type:
|
|
91
|
+
type: unknown
|
|
91
92
|
description: System configuration
|
|
92
93
|
readonly: true
|
|
93
94
|
default:
|
|
@@ -99,7 +100,7 @@ resources:
|
|
|
99
100
|
|
|
100
101
|
| Field | Required | Description |
|
|
101
102
|
|-------|----------|-------------|
|
|
102
|
-
| `type` |
|
|
103
|
+
| `type` | Yes | Data type: `string`, `number`, `boolean`, `unknown` |
|
|
103
104
|
| `description` | No | Describes the resource purpose |
|
|
104
105
|
| `default` | No | Initial value |
|
|
105
106
|
| `readonly` | No | If true, agent cannot write to it |
|
|
@@ -135,15 +136,29 @@ useOctavusChat({
|
|
|
135
136
|
|
|
136
137
|
## Variables
|
|
137
138
|
|
|
138
|
-
Variables are
|
|
139
|
+
Variables are internal state managed by block outputs. They persist across triggers but are not synced to the consumer (unlike resources).
|
|
139
140
|
|
|
140
141
|
```yaml
|
|
141
142
|
variables:
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
SUMMARY:
|
|
144
|
+
type: string
|
|
145
|
+
description: Generated summary text
|
|
146
|
+
TICKET:
|
|
147
|
+
type: unknown
|
|
148
|
+
description: Ticket creation result
|
|
149
|
+
CONVERSATION_TEXT:
|
|
150
|
+
type: string
|
|
151
|
+
description: Serialized conversation
|
|
145
152
|
```
|
|
146
153
|
|
|
154
|
+
### Variable Definition
|
|
155
|
+
|
|
156
|
+
| Field | Required | Description |
|
|
157
|
+
|-------|----------|-------------|
|
|
158
|
+
| `type` | Yes | Data type: `string`, `number`, `boolean`, `unknown` |
|
|
159
|
+
| `description` | No | Describes what this variable stores |
|
|
160
|
+
| `default` | No | Initial value |
|
|
161
|
+
|
|
147
162
|
### Using Variables
|
|
148
163
|
|
|
149
164
|
Set variables as output from blocks:
|
|
@@ -170,31 +185,9 @@ handlers:
|
|
|
170
185
|
|
|
171
186
|
## Scoping
|
|
172
187
|
|
|
173
|
-
| Type | Scope | Persistence |
|
|
174
|
-
|
|
175
|
-
| `input` | Session |
|
|
176
|
-
| `resources` | Session |
|
|
177
|
-
| `variables` |
|
|
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
|
-
```
|
|
188
|
+
| Type | Scope | Persistence | Synced to Consumer |
|
|
189
|
+
|------|-------|-------------|---------------------|
|
|
190
|
+
| `input` | Session | Immutable | Yes (at creation) |
|
|
191
|
+
| `resources` | Session | Persists across triggers | Yes (via callbacks) |
|
|
192
|
+
| `variables` | Session | Persists across triggers | No (internal only) |
|
|
200
193
|
|
|
@@ -58,7 +58,7 @@ triggers:
|
|
|
58
58
|
type: string
|
|
59
59
|
ANALYSIS_TYPE:
|
|
60
60
|
type: string
|
|
61
|
-
|
|
61
|
+
description: Type of analysis (summary, sentiment, extraction)
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
## Trigger Definition
|
|
@@ -69,7 +69,7 @@ triggers:
|
|
|
69
69
|
description: Optional description
|
|
70
70
|
input:
|
|
71
71
|
VARIABLE_NAME:
|
|
72
|
-
type: string | number | boolean |
|
|
72
|
+
type: string | number | boolean | unknown
|
|
73
73
|
description: What this input is for
|
|
74
74
|
optional: true | false # defaults to false
|
|
75
75
|
default: value # default if optional and not provided
|
|
@@ -147,7 +147,7 @@ triggers:
|
|
|
147
147
|
input:
|
|
148
148
|
SEARCH_QUERY: { type: string }
|
|
149
149
|
MAX_RESULTS: { type: number, optional: true, default: 10 }
|
|
150
|
-
|
|
150
|
+
FILTER_CATEGORY: { type: string, optional: true }
|
|
151
151
|
```
|
|
152
152
|
|
|
153
153
|
## Best Practices
|
|
@@ -204,6 +204,6 @@ triggers:
|
|
|
204
204
|
user-action:
|
|
205
205
|
input:
|
|
206
206
|
ACTION_TYPE: { type: string } # "message" | "file" | "callback"
|
|
207
|
-
PAYLOAD: { type:
|
|
207
|
+
PAYLOAD: { type: unknown } # Different structure per type
|
|
208
208
|
```
|
|
209
209
|
|