@octavus/docs 0.0.6 → 0.0.8
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 +28 -19
- package/content/02-server-sdk/01-overview.md +34 -17
- package/content/02-server-sdk/02-sessions.md +6 -3
- package/content/02-server-sdk/03-tools.md +4 -2
- package/content/02-server-sdk/04-streaming.md +12 -4
- package/content/03-client-sdk/01-overview.md +107 -42
- package/content/03-client-sdk/02-messages.md +71 -19
- package/content/03-client-sdk/03-streaming.md +38 -28
- package/content/03-client-sdk/05-socket-transport.md +414 -0
- package/content/03-client-sdk/06-http-transport.md +280 -0
- package/content/04-protocol/03-triggers.md +48 -21
- package/content/04-protocol/04-tools.md +25 -15
- package/content/05-api-reference/01-overview.md +3 -17
- package/content/06-examples/01-overview.md +27 -0
- package/content/06-examples/02-nextjs-chat.md +343 -0
- package/content/06-examples/03-socket-chat.md +392 -0
- package/content/06-examples/_meta.md +5 -0
- package/dist/chunk-232K4EME.js +439 -0
- package/dist/chunk-232K4EME.js.map +1 -0
- package/dist/chunk-2JDZLMS3.js +439 -0
- package/dist/chunk-2JDZLMS3.js.map +1 -0
- package/dist/chunk-5M7DS4DF.js +519 -0
- package/dist/chunk-5M7DS4DF.js.map +1 -0
- package/dist/chunk-7AS4ST73.js +421 -0
- package/dist/chunk-7AS4ST73.js.map +1 -0
- package/dist/chunk-H6JGSSAJ.js +519 -0
- package/dist/chunk-H6JGSSAJ.js.map +1 -0
- package/dist/chunk-JZRABTHU.js +519 -0
- package/dist/chunk-JZRABTHU.js.map +1 -0
- package/dist/chunk-OECAPVSX.js +439 -0
- package/dist/chunk-OECAPVSX.js.map +1 -0
- package/dist/chunk-OL5QDJ42.js +483 -0
- package/dist/chunk-OL5QDJ42.js.map +1 -0
- package/dist/chunk-PMOVVTHO.js +519 -0
- package/dist/chunk-PMOVVTHO.js.map +1 -0
- package/dist/chunk-R5MTVABN.js +439 -0
- package/dist/chunk-R5MTVABN.js.map +1 -0
- package/dist/chunk-RJ4H4YVA.js +519 -0
- package/dist/chunk-RJ4H4YVA.js.map +1 -0
- package/dist/chunk-S5U4IWCR.js +439 -0
- package/dist/chunk-S5U4IWCR.js.map +1 -0
- package/dist/chunk-UCJE36LL.js +519 -0
- package/dist/chunk-UCJE36LL.js.map +1 -0
- package/dist/chunk-WW7TRC7S.js +519 -0
- package/dist/chunk-WW7TRC7S.js.map +1 -0
- package/dist/content.js +1 -1
- package/dist/docs.json +57 -12
- 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 +65 -12
- package/package.json +2 -2
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: HTTP Transport
|
|
3
|
+
description: Using HTTP/SSE for streaming with Octavus in Next.js, Express, and other frameworks.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# HTTP Transport
|
|
7
|
+
|
|
8
|
+
The HTTP transport uses standard HTTP requests with Server-Sent Events (SSE) for streaming. This is the simplest and most compatible transport option.
|
|
9
|
+
|
|
10
|
+
## When to Use HTTP Transport
|
|
11
|
+
|
|
12
|
+
| Use Case | Recommendation |
|
|
13
|
+
|----------|----------------|
|
|
14
|
+
| Next.js, Remix, or similar frameworks | ✅ Use HTTP |
|
|
15
|
+
| Standard web apps without special requirements | ✅ Use HTTP |
|
|
16
|
+
| Serverless deployments (Vercel, etc.) | ✅ Use HTTP |
|
|
17
|
+
| Need custom real-time events | Consider [Socket Transport](/docs/client-sdk/socket-transport) |
|
|
18
|
+
|
|
19
|
+
## Basic Setup
|
|
20
|
+
|
|
21
|
+
### Client
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { useMemo } from 'react';
|
|
25
|
+
import { useOctavusChat, createHttpTransport } from '@octavus/react';
|
|
26
|
+
|
|
27
|
+
function Chat({ sessionId }: { sessionId: string }) {
|
|
28
|
+
const transport = useMemo(
|
|
29
|
+
() =>
|
|
30
|
+
createHttpTransport({
|
|
31
|
+
triggerRequest: (triggerName, input) =>
|
|
32
|
+
fetch('/api/trigger', {
|
|
33
|
+
method: 'POST',
|
|
34
|
+
headers: { 'Content-Type': 'application/json' },
|
|
35
|
+
body: JSON.stringify({ sessionId, triggerName, input }),
|
|
36
|
+
}),
|
|
37
|
+
}),
|
|
38
|
+
[sessionId],
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const { messages, status, error, send, stop } = useOctavusChat({ transport });
|
|
42
|
+
|
|
43
|
+
const sendMessage = async (text: string) => {
|
|
44
|
+
await send(
|
|
45
|
+
'user-message',
|
|
46
|
+
{ USER_MESSAGE: text },
|
|
47
|
+
{ userMessage: { content: text } },
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// ... render chat
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Server (Next.js API Route)
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
// app/api/trigger/route.ts
|
|
59
|
+
import { OctavusClient, toSSEStream } from '@octavus/server-sdk';
|
|
60
|
+
|
|
61
|
+
const client = new OctavusClient({
|
|
62
|
+
baseUrl: process.env.OCTAVUS_API_URL!,
|
|
63
|
+
apiKey: process.env.OCTAVUS_API_KEY!,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
export async function POST(request: Request) {
|
|
67
|
+
const { sessionId, triggerName, input } = await request.json();
|
|
68
|
+
|
|
69
|
+
const session = client.agentSessions.attach(sessionId, {
|
|
70
|
+
tools: {
|
|
71
|
+
'get-user-account': async (args) => {
|
|
72
|
+
return { name: 'Demo User', plan: 'pro' };
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// trigger() returns parsed events, toSSEStream() converts to SSE format
|
|
78
|
+
const events = session.trigger(triggerName, input);
|
|
79
|
+
|
|
80
|
+
return new Response(toSSEStream(events), {
|
|
81
|
+
headers: {
|
|
82
|
+
'Content-Type': 'text/event-stream',
|
|
83
|
+
'Cache-Control': 'no-cache',
|
|
84
|
+
Connection: 'keep-alive',
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Session Creation
|
|
91
|
+
|
|
92
|
+
Sessions should be created server-side before rendering the chat. There are two patterns:
|
|
93
|
+
|
|
94
|
+
### Pattern 1: Create Session on Page Load
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
// app/chat/page.tsx
|
|
98
|
+
'use client';
|
|
99
|
+
|
|
100
|
+
import { useEffect, useState } from 'react';
|
|
101
|
+
import { Chat } from '@/components/Chat';
|
|
102
|
+
|
|
103
|
+
export default function ChatPage() {
|
|
104
|
+
const [sessionId, setSessionId] = useState<string | null>(null);
|
|
105
|
+
|
|
106
|
+
useEffect(() => {
|
|
107
|
+
fetch('/api/sessions', {
|
|
108
|
+
method: 'POST',
|
|
109
|
+
headers: { 'Content-Type': 'application/json' },
|
|
110
|
+
body: JSON.stringify({
|
|
111
|
+
agentId: 'your-agent-id',
|
|
112
|
+
input: { COMPANY_NAME: 'Acme Corp' },
|
|
113
|
+
}),
|
|
114
|
+
})
|
|
115
|
+
.then(res => res.json())
|
|
116
|
+
.then(data => setSessionId(data.sessionId));
|
|
117
|
+
}, []);
|
|
118
|
+
|
|
119
|
+
if (!sessionId) {
|
|
120
|
+
return <LoadingSpinner />;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return <Chat sessionId={sessionId} />;
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Pattern 2: Server-Side Session Creation (App Router)
|
|
128
|
+
|
|
129
|
+
```tsx
|
|
130
|
+
// app/chat/page.tsx
|
|
131
|
+
import { octavus } from '@/lib/octavus';
|
|
132
|
+
import { Chat } from '@/components/Chat';
|
|
133
|
+
|
|
134
|
+
export default async function ChatPage() {
|
|
135
|
+
// Create session server-side
|
|
136
|
+
const sessionId = await octavus.agentSessions.create('your-agent-id', {
|
|
137
|
+
COMPANY_NAME: 'Acme Corp',
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
return <Chat sessionId={sessionId} />;
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
This pattern is cleaner as the session is ready before the component renders.
|
|
145
|
+
|
|
146
|
+
## Error Handling
|
|
147
|
+
|
|
148
|
+
Handle errors in both the transport and the hook:
|
|
149
|
+
|
|
150
|
+
```tsx
|
|
151
|
+
const { messages, status, error, send } = useOctavusChat({
|
|
152
|
+
transport,
|
|
153
|
+
onError: (err) => {
|
|
154
|
+
console.error('Stream error:', err);
|
|
155
|
+
// Show toast, update UI, etc.
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
// Also check error state
|
|
160
|
+
if (error) {
|
|
161
|
+
return <ErrorMessage error={error} />;
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Stop Streaming
|
|
166
|
+
|
|
167
|
+
Allow users to cancel ongoing streams:
|
|
168
|
+
|
|
169
|
+
```tsx
|
|
170
|
+
const { send, stop, status } = useOctavusChat({ transport });
|
|
171
|
+
|
|
172
|
+
return (
|
|
173
|
+
<button
|
|
174
|
+
onClick={status === 'streaming' ? stop : () => sendMessage()}
|
|
175
|
+
disabled={status === 'streaming' && !inputValue}
|
|
176
|
+
>
|
|
177
|
+
{status === 'streaming' ? 'Stop' : 'Send'}
|
|
178
|
+
</button>
|
|
179
|
+
);
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Express Server
|
|
183
|
+
|
|
184
|
+
For non-Next.js backends:
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
import express from 'express';
|
|
188
|
+
import { OctavusClient, toSSEStream } from '@octavus/server-sdk';
|
|
189
|
+
|
|
190
|
+
const app = express();
|
|
191
|
+
const client = new OctavusClient({
|
|
192
|
+
baseUrl: process.env.OCTAVUS_API_URL!,
|
|
193
|
+
apiKey: process.env.OCTAVUS_API_KEY!,
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
app.post('/api/trigger', async (req, res) => {
|
|
197
|
+
const { sessionId, triggerName, input } = req.body;
|
|
198
|
+
|
|
199
|
+
const session = client.agentSessions.attach(sessionId, {
|
|
200
|
+
tools: {
|
|
201
|
+
// Your tool handlers
|
|
202
|
+
},
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
const events = session.trigger(triggerName, input);
|
|
206
|
+
const stream = toSSEStream(events);
|
|
207
|
+
|
|
208
|
+
// Set SSE headers
|
|
209
|
+
res.setHeader('Content-Type', 'text/event-stream');
|
|
210
|
+
res.setHeader('Cache-Control', 'no-cache');
|
|
211
|
+
res.setHeader('Connection', 'keep-alive');
|
|
212
|
+
|
|
213
|
+
// Pipe the stream to the response
|
|
214
|
+
const reader = stream.getReader();
|
|
215
|
+
|
|
216
|
+
try {
|
|
217
|
+
while (true) {
|
|
218
|
+
const { done, value } = await reader.read();
|
|
219
|
+
if (done) break;
|
|
220
|
+
res.write(value);
|
|
221
|
+
}
|
|
222
|
+
} finally {
|
|
223
|
+
reader.releaseLock();
|
|
224
|
+
res.end();
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## Transport Options
|
|
230
|
+
|
|
231
|
+
```typescript
|
|
232
|
+
interface HttpTransportOptions {
|
|
233
|
+
// Function that makes the HTTP request
|
|
234
|
+
triggerRequest: (
|
|
235
|
+
triggerName: string,
|
|
236
|
+
input?: Record<string, unknown>
|
|
237
|
+
) => Promise<Response>;
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Protocol
|
|
242
|
+
|
|
243
|
+
### Request Format
|
|
244
|
+
|
|
245
|
+
The `triggerRequest` function should send a POST request with:
|
|
246
|
+
|
|
247
|
+
```json
|
|
248
|
+
{
|
|
249
|
+
"sessionId": "sess_abc123",
|
|
250
|
+
"triggerName": "user-message",
|
|
251
|
+
"input": {
|
|
252
|
+
"USER_MESSAGE": "Hello"
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### Response Format
|
|
258
|
+
|
|
259
|
+
The server responds with an SSE stream:
|
|
260
|
+
|
|
261
|
+
```
|
|
262
|
+
data: {"type":"start","messageId":"msg_xyz"}
|
|
263
|
+
|
|
264
|
+
data: {"type":"text-delta","id":"msg_xyz","delta":"Hello"}
|
|
265
|
+
|
|
266
|
+
data: {"type":"text-delta","id":"msg_xyz","delta":" there!"}
|
|
267
|
+
|
|
268
|
+
data: {"type":"finish","finishReason":"stop"}
|
|
269
|
+
|
|
270
|
+
data: [DONE]
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
See [Streaming Events](/docs/server-sdk/streaming#event-types) for the full list of event types.
|
|
274
|
+
|
|
275
|
+
## Next Steps
|
|
276
|
+
|
|
277
|
+
- [Quick Start](/docs/getting-started/quickstart) — Complete Next.js integration guide
|
|
278
|
+
- [Messages](/docs/client-sdk/messages) — Working with message state
|
|
279
|
+
- [Streaming](/docs/client-sdk/streaming) — Building streaming UIs
|
|
280
|
+
|
|
@@ -32,7 +32,7 @@ triggers:
|
|
|
32
32
|
request-human:
|
|
33
33
|
description: User clicks "Talk to Human" button
|
|
34
34
|
# No input needed - action is implicit
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
submit-feedback:
|
|
37
37
|
description: User submits feedback form
|
|
38
38
|
input:
|
|
@@ -79,29 +79,57 @@ triggers:
|
|
|
79
79
|
|
|
80
80
|
### From Client SDK
|
|
81
81
|
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
82
|
+
```tsx
|
|
83
|
+
import { useMemo } from 'react';
|
|
84
|
+
import { useOctavusChat, createHttpTransport } from '@octavus/react';
|
|
85
|
+
|
|
86
|
+
function Chat({ sessionId }: { sessionId: string }) {
|
|
87
|
+
const transport = useMemo(
|
|
88
|
+
() =>
|
|
89
|
+
createHttpTransport({
|
|
90
|
+
triggerRequest: (triggerName, input) =>
|
|
91
|
+
fetch('/api/trigger', {
|
|
92
|
+
method: 'POST',
|
|
93
|
+
headers: { 'Content-Type': 'application/json' },
|
|
94
|
+
body: JSON.stringify({ sessionId, triggerName, input }),
|
|
95
|
+
}),
|
|
96
|
+
}),
|
|
97
|
+
[sessionId],
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
const { send } = useOctavusChat({ transport });
|
|
101
|
+
|
|
102
|
+
// User message trigger with UI message
|
|
103
|
+
await send(
|
|
104
|
+
'user-message',
|
|
105
|
+
{ USER_MESSAGE: text },
|
|
106
|
+
{ userMessage: { content: text } },
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
// User action trigger (no input, no UI message)
|
|
110
|
+
await send('request-human');
|
|
111
|
+
|
|
112
|
+
// Action with input
|
|
113
|
+
await send('submit-feedback', { RATING: 5, COMMENT: 'Great help!' });
|
|
114
|
+
}
|
|
95
115
|
```
|
|
96
116
|
|
|
97
117
|
### From Server SDK
|
|
98
118
|
|
|
99
119
|
```typescript
|
|
100
|
-
|
|
101
|
-
|
|
120
|
+
// trigger() returns an async generator of events
|
|
121
|
+
const events = session.trigger('user-message', {
|
|
122
|
+
USER_MESSAGE: 'Help me with billing',
|
|
102
123
|
});
|
|
103
124
|
|
|
104
|
-
|
|
125
|
+
// Iterate events directly
|
|
126
|
+
for await (const event of events) {
|
|
127
|
+
console.log(event);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Or convert to SSE for HTTP responses
|
|
131
|
+
import { toSSEStream } from '@octavus/server-sdk';
|
|
132
|
+
return new Response(toSSEStream(events), { headers: { 'Content-Type': 'text/event-stream' } });
|
|
105
133
|
```
|
|
106
134
|
|
|
107
135
|
## Handlers
|
|
@@ -125,7 +153,7 @@ handlers:
|
|
|
125
153
|
role: user
|
|
126
154
|
prompt: user-message
|
|
127
155
|
input: [USER_MESSAGE]
|
|
128
|
-
|
|
156
|
+
|
|
129
157
|
Respond:
|
|
130
158
|
type: next-message
|
|
131
159
|
|
|
@@ -191,10 +219,10 @@ Each trigger should do one thing:
|
|
|
191
219
|
triggers:
|
|
192
220
|
send-message:
|
|
193
221
|
input: { MESSAGE: { type: string } }
|
|
194
|
-
|
|
222
|
+
|
|
195
223
|
upload-file:
|
|
196
224
|
input: { FILE_URL: { type: string } }
|
|
197
|
-
|
|
225
|
+
|
|
198
226
|
request-callback:
|
|
199
227
|
input: { PHONE: { type: string } }
|
|
200
228
|
|
|
@@ -205,4 +233,3 @@ triggers:
|
|
|
205
233
|
ACTION_TYPE: { type: string } # "message" | "file" | "callback"
|
|
206
234
|
PAYLOAD: { type: unknown } # Different structure per type
|
|
207
235
|
```
|
|
208
|
-
|
|
@@ -59,17 +59,17 @@ tools:
|
|
|
59
59
|
query:
|
|
60
60
|
type: string
|
|
61
61
|
description: Search query
|
|
62
|
-
|
|
62
|
+
|
|
63
63
|
category:
|
|
64
64
|
type: string
|
|
65
65
|
description: Filter by category
|
|
66
66
|
optional: true
|
|
67
|
-
|
|
67
|
+
|
|
68
68
|
maxPrice:
|
|
69
69
|
type: number
|
|
70
70
|
description: Maximum price filter
|
|
71
71
|
optional: true
|
|
72
|
-
|
|
72
|
+
|
|
73
73
|
inStock:
|
|
74
74
|
type: boolean
|
|
75
75
|
description: Only show in-stock items
|
|
@@ -86,7 +86,7 @@ tools:
|
|
|
86
86
|
description: Look up user account
|
|
87
87
|
parameters:
|
|
88
88
|
userId: { type: string }
|
|
89
|
-
|
|
89
|
+
|
|
90
90
|
create-support-ticket:
|
|
91
91
|
description: Create a support ticket
|
|
92
92
|
parameters:
|
|
@@ -136,17 +136,30 @@ handlers:
|
|
|
136
136
|
|
|
137
137
|
### In Prompts
|
|
138
138
|
|
|
139
|
-
Reference
|
|
139
|
+
Tool results are stored in variables. Reference the variable in prompts:
|
|
140
140
|
|
|
141
141
|
```markdown
|
|
142
142
|
<!-- prompts/ticket-directive.md -->
|
|
143
143
|
A support ticket has been created:
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
{{TICKET}}
|
|
145
|
+
|
|
146
|
+
Let the user know their ticket has been created.
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
When the `TICKET` variable contains an object, it's automatically serialized as JSON in the prompt:
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
A support ticket has been created:
|
|
153
|
+
{
|
|
154
|
+
"ticketId": "TKT-123ABC",
|
|
155
|
+
"estimatedResponse": "24 hours"
|
|
156
|
+
}
|
|
146
157
|
|
|
147
158
|
Let the user know their ticket has been created.
|
|
148
159
|
```
|
|
149
160
|
|
|
161
|
+
> **Note**: Variables use `{{VARIABLE_NAME}}` syntax with `UPPERCASE_SNAKE_CASE`. Dot notation (like `{{TICKET.ticketId}}`) is not supported. Objects are automatically JSON-serialized.
|
|
162
|
+
|
|
150
163
|
### In Variables
|
|
151
164
|
|
|
152
165
|
Store tool results for later use:
|
|
@@ -160,15 +173,13 @@ handlers:
|
|
|
160
173
|
input:
|
|
161
174
|
userId: USER_ID
|
|
162
175
|
output: ACCOUNT # Result stored here
|
|
163
|
-
|
|
176
|
+
|
|
164
177
|
Create ticket:
|
|
165
178
|
type: tool-call
|
|
166
179
|
tool: create-support-ticket
|
|
167
180
|
input:
|
|
168
181
|
summary: SUMMARY
|
|
169
182
|
priority: medium
|
|
170
|
-
# Can reference ACCOUNT here
|
|
171
|
-
email: ACCOUNT.email
|
|
172
183
|
output: TICKET
|
|
173
184
|
```
|
|
174
185
|
|
|
@@ -182,7 +193,7 @@ const session = client.agentSessions.attach(sessionId, {
|
|
|
182
193
|
'get-user-account': async (args) => {
|
|
183
194
|
const userId = args.userId as string;
|
|
184
195
|
const user = await db.users.findById(userId);
|
|
185
|
-
|
|
196
|
+
|
|
186
197
|
return {
|
|
187
198
|
name: user.name,
|
|
188
199
|
email: user.email,
|
|
@@ -190,13 +201,13 @@ const session = client.agentSessions.attach(sessionId, {
|
|
|
190
201
|
createdAt: user.createdAt.toISOString(),
|
|
191
202
|
};
|
|
192
203
|
},
|
|
193
|
-
|
|
204
|
+
|
|
194
205
|
'create-support-ticket': async (args) => {
|
|
195
206
|
const ticket = await ticketService.create({
|
|
196
207
|
summary: args.summary as string,
|
|
197
208
|
priority: args.priority as string,
|
|
198
209
|
});
|
|
199
|
-
|
|
210
|
+
|
|
200
211
|
return {
|
|
201
212
|
ticketId: ticket.id,
|
|
202
213
|
estimatedResponse: getEstimatedTime(args.priority),
|
|
@@ -218,7 +229,7 @@ tools:
|
|
|
218
229
|
Retrieves the user's account information including name, email,
|
|
219
230
|
subscription plan, and account creation date. Use this when the
|
|
220
231
|
user asks about their account or you need to verify their identity.
|
|
221
|
-
|
|
232
|
+
|
|
222
233
|
# Avoid - vague
|
|
223
234
|
get-data:
|
|
224
235
|
description: Gets some data
|
|
@@ -234,4 +245,3 @@ tools:
|
|
|
234
245
|
type: string
|
|
235
246
|
description: Ticket priority level (low, medium, high, urgent)
|
|
236
247
|
```
|
|
237
|
-
|
|
@@ -22,7 +22,7 @@ curl -H "Authorization: Bearer YOUR_API_KEY" \
|
|
|
22
22
|
https://octavus.ai/api/agents
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
API keys can be created in the Octavus Platform under
|
|
25
|
+
API keys can be created in the Octavus Platform under your project's **API Keys** page.
|
|
26
26
|
|
|
27
27
|
## Response Format
|
|
28
28
|
|
|
@@ -57,23 +57,8 @@ All responses are JSON. Success responses return the data directly (not wrapped
|
|
|
57
57
|
| 401 | Unauthorized - Missing or invalid API key |
|
|
58
58
|
| 403 | Forbidden - Insufficient permissions |
|
|
59
59
|
| 404 | Not Found |
|
|
60
|
-
| 429 | Too Many Requests - Rate limited |
|
|
61
60
|
| 500 | Internal Server Error |
|
|
62
61
|
|
|
63
|
-
## Rate Limits
|
|
64
|
-
|
|
65
|
-
- **Standard tier**: 100 requests/minute
|
|
66
|
-
- **Pro tier**: 1,000 requests/minute
|
|
67
|
-
- **Enterprise**: Custom limits
|
|
68
|
-
|
|
69
|
-
Rate limit headers are included in responses:
|
|
70
|
-
|
|
71
|
-
```
|
|
72
|
-
X-RateLimit-Limit: 100
|
|
73
|
-
X-RateLimit-Remaining: 95
|
|
74
|
-
X-RateLimit-Reset: 1735312800
|
|
75
|
-
```
|
|
76
|
-
|
|
77
62
|
## Endpoints Overview
|
|
78
63
|
|
|
79
64
|
### Agents
|
|
@@ -131,7 +116,8 @@ data: [DONE]
|
|
|
131
116
|
We recommend using our SDKs instead of calling the API directly:
|
|
132
117
|
|
|
133
118
|
- **Server SDK**: `@octavus/server-sdk` - For Node.js backends
|
|
134
|
-
- **
|
|
119
|
+
- **React SDK**: `@octavus/react` - For React applications
|
|
120
|
+
- **Client SDK**: `@octavus/client-sdk` - For other frontend frameworks
|
|
135
121
|
|
|
136
122
|
The SDKs handle authentication, streaming, and tool execution automatically.
|
|
137
123
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Overview
|
|
3
|
+
description: Complete integration examples for different architectures.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Examples
|
|
7
|
+
|
|
8
|
+
This section provides complete integration examples for different architectures. Each example walks through building a functional chat interface from scratch.
|
|
9
|
+
|
|
10
|
+
## Available Examples
|
|
11
|
+
|
|
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
|
+
|
|
17
|
+
## Choosing a Transport
|
|
18
|
+
|
|
19
|
+
**Use HTTP Transport when:**
|
|
20
|
+
- Building with Next.js, Remix, or similar frameworks
|
|
21
|
+
- You want the simplest integration
|
|
22
|
+
- Deploying to serverless (Vercel, Netlify, etc.)
|
|
23
|
+
|
|
24
|
+
**Use Socket Transport when:**
|
|
25
|
+
- Using Meteor, Phoenix, or socket-based frameworks
|
|
26
|
+
- Need custom real-time events (typing indicators, presence)
|
|
27
|
+
- Behind proxies that don't support SSE well
|