@octavus/docs 0.0.7 → 0.0.9
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 +4 -3
- package/content/02-server-sdk/01-overview.md +11 -5
- 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 +11 -5
- package/content/03-client-sdk/05-socket-transport.md +263 -153
- package/content/03-client-sdk/06-http-transport.md +280 -0
- package/content/04-protocol/01-overview.md +1 -0
- package/content/04-protocol/03-triggers.md +10 -2
- package/content/04-protocol/04-tools.md +12 -3
- package/content/04-protocol/06-agent-config.md +36 -3
- package/content/04-protocol/07-provider-options.md +275 -0
- 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-5M7DS4DF.js +519 -0
- package/dist/chunk-5M7DS4DF.js.map +1 -0
- package/dist/chunk-7KXF63FV.js +537 -0
- package/dist/chunk-7KXF63FV.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-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-TQJG6EBM.js +537 -0
- package/dist/chunk-TQJG6EBM.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 +60 -15
- 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 +68 -15
- package/package.json +1 -1
|
@@ -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
|
+
|
|
@@ -138,4 +138,5 @@ Variables are replaced with their values at runtime. If a variable is not provid
|
|
|
138
138
|
- [Tools](/docs/protocol/tools) — External capabilities
|
|
139
139
|
- [Handlers](/docs/protocol/handlers) — Execution blocks
|
|
140
140
|
- [Agent Config](/docs/protocol/agent-config) — Model and settings
|
|
141
|
+
- [Provider Options](/docs/protocol/provider-options) — Provider-specific features
|
|
141
142
|
|
|
@@ -117,11 +117,19 @@ function Chat({ sessionId }: { sessionId: string }) {
|
|
|
117
117
|
### From Server SDK
|
|
118
118
|
|
|
119
119
|
```typescript
|
|
120
|
-
|
|
120
|
+
// trigger() returns an async generator of events
|
|
121
|
+
const events = session.trigger('user-message', {
|
|
121
122
|
USER_MESSAGE: 'Help me with billing',
|
|
122
123
|
});
|
|
123
124
|
|
|
124
|
-
|
|
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' } });
|
|
125
133
|
```
|
|
126
134
|
|
|
127
135
|
## Handlers
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Tools
|
|
3
|
-
description: Defining external tools
|
|
3
|
+
description: Defining external tools implemented in your backend.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Tools
|
|
7
7
|
|
|
8
|
-
Tools extend what agents can do.
|
|
8
|
+
Tools extend what agents can do. Octavus supports two types:
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
1. **External Tools** — Defined in the protocol, implemented in your backend
|
|
11
|
+
2. **Provider Tools** — Built-in tools executed server-side by the provider (e.g., Anthropic's web search)
|
|
12
|
+
|
|
13
|
+
This page covers external tools. For provider tools, see [Provider Options](/docs/protocol/provider-options).
|
|
14
|
+
|
|
15
|
+
## External Tools
|
|
16
|
+
|
|
17
|
+
External tools are defined in the `tools:` section and implemented in your backend.
|
|
18
|
+
|
|
19
|
+
## Defining Tools
|
|
11
20
|
|
|
12
21
|
```yaml
|
|
13
22
|
tools:
|
|
@@ -28,6 +28,7 @@ agent:
|
|
|
28
28
|
| `maxSteps` | No | Maximum agentic steps (default: 10) |
|
|
29
29
|
| `temperature` | No | Model temperature (0-2) |
|
|
30
30
|
| `thinking` | No | Extended reasoning level |
|
|
31
|
+
| `anthropic` | No | Anthropic-specific options (tools, skills) |
|
|
31
32
|
|
|
32
33
|
## Models
|
|
33
34
|
|
|
@@ -129,6 +130,28 @@ agent:
|
|
|
129
130
|
- `0.8 - 1.2`: Creative, varied responses
|
|
130
131
|
- `> 1.2`: Very creative (may be inconsistent)
|
|
131
132
|
|
|
133
|
+
## Provider Options
|
|
134
|
+
|
|
135
|
+
Enable provider-specific features like Anthropic's built-in tools and skills:
|
|
136
|
+
|
|
137
|
+
```yaml
|
|
138
|
+
agent:
|
|
139
|
+
model: anthropic/claude-sonnet-4-5
|
|
140
|
+
anthropic:
|
|
141
|
+
tools:
|
|
142
|
+
web-search:
|
|
143
|
+
display: description
|
|
144
|
+
description: Searching the web
|
|
145
|
+
skills:
|
|
146
|
+
pdf:
|
|
147
|
+
type: anthropic
|
|
148
|
+
description: Processing PDF
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Provider options are validated against the model—using `anthropic:` with a non-Anthropic model will fail validation.
|
|
152
|
+
|
|
153
|
+
See [Provider Options](/docs/protocol/provider-options) for full documentation.
|
|
154
|
+
|
|
132
155
|
## Thread-Specific Config
|
|
133
156
|
|
|
134
157
|
Override config for named threads:
|
|
@@ -163,12 +186,12 @@ tools:
|
|
|
163
186
|
description: Look up user account
|
|
164
187
|
parameters:
|
|
165
188
|
userId: { type: string }
|
|
166
|
-
|
|
189
|
+
|
|
167
190
|
search-docs:
|
|
168
191
|
description: Search help documentation
|
|
169
192
|
parameters:
|
|
170
193
|
query: { type: string }
|
|
171
|
-
|
|
194
|
+
|
|
172
195
|
create-support-ticket:
|
|
173
196
|
description: Create a support ticket
|
|
174
197
|
parameters:
|
|
@@ -188,6 +211,16 @@ agent:
|
|
|
188
211
|
agentic: true
|
|
189
212
|
maxSteps: 10
|
|
190
213
|
thinking: medium
|
|
214
|
+
# Anthropic-specific options
|
|
215
|
+
anthropic:
|
|
216
|
+
tools:
|
|
217
|
+
web-search:
|
|
218
|
+
display: description
|
|
219
|
+
description: Searching the web
|
|
220
|
+
skills:
|
|
221
|
+
pdf:
|
|
222
|
+
type: anthropic
|
|
223
|
+
description: Processing PDF
|
|
191
224
|
|
|
192
225
|
triggers:
|
|
193
226
|
user-message:
|
|
@@ -202,7 +235,7 @@ handlers:
|
|
|
202
235
|
prompt: user-message
|
|
203
236
|
input: [USER_MESSAGE]
|
|
204
237
|
display: hidden
|
|
205
|
-
|
|
238
|
+
|
|
206
239
|
Respond:
|
|
207
240
|
type: next-message
|
|
208
241
|
```
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Provider Options
|
|
3
|
+
description: Configuring provider-specific tools and features.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Provider Options
|
|
7
|
+
|
|
8
|
+
Provider options let you enable provider-specific features like Anthropic's built-in tools and skills. These features run server-side on the provider's infrastructure.
|
|
9
|
+
|
|
10
|
+
## Anthropic Options
|
|
11
|
+
|
|
12
|
+
Configure Anthropic-specific features when using `anthropic/*` models:
|
|
13
|
+
|
|
14
|
+
```yaml
|
|
15
|
+
agent:
|
|
16
|
+
model: anthropic/claude-sonnet-4-5
|
|
17
|
+
system: system
|
|
18
|
+
anthropic:
|
|
19
|
+
# Provider tools (server-side)
|
|
20
|
+
tools:
|
|
21
|
+
web-search:
|
|
22
|
+
display: description
|
|
23
|
+
description: Searching the web
|
|
24
|
+
code-execution:
|
|
25
|
+
display: description
|
|
26
|
+
description: Running code
|
|
27
|
+
|
|
28
|
+
# Skills (knowledge packages)
|
|
29
|
+
skills:
|
|
30
|
+
pdf:
|
|
31
|
+
type: anthropic
|
|
32
|
+
display: description
|
|
33
|
+
description: Processing PDF document
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
> **Note**: Provider options are validated against the model provider. Using `anthropic:` options with non-Anthropic models will result in a validation error.
|
|
37
|
+
|
|
38
|
+
## Provider Tools
|
|
39
|
+
|
|
40
|
+
Provider tools are executed server-side by the provider (Anthropic). Unlike external tools that you implement, provider tools are built-in capabilities.
|
|
41
|
+
|
|
42
|
+
### Available Tools
|
|
43
|
+
|
|
44
|
+
| Tool | Description |
|
|
45
|
+
|------|-------------|
|
|
46
|
+
| `web-search` | Search the web for current information |
|
|
47
|
+
| `code-execution` | Execute Python/Bash in a sandboxed container |
|
|
48
|
+
|
|
49
|
+
### Tool Configuration
|
|
50
|
+
|
|
51
|
+
```yaml
|
|
52
|
+
anthropic:
|
|
53
|
+
tools:
|
|
54
|
+
web-search:
|
|
55
|
+
display: description # How to show in UI
|
|
56
|
+
description: Searching... # Custom display text
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
| Field | Required | Description |
|
|
60
|
+
|-------|----------|-------------|
|
|
61
|
+
| `display` | No | `hidden`, `name`, `description`, or `stream` (default: `description`) |
|
|
62
|
+
| `description` | No | Custom text shown to users during execution |
|
|
63
|
+
|
|
64
|
+
### Web Search
|
|
65
|
+
|
|
66
|
+
Allows the agent to search the web for current information:
|
|
67
|
+
|
|
68
|
+
```yaml
|
|
69
|
+
agent:
|
|
70
|
+
model: anthropic/claude-sonnet-4-5
|
|
71
|
+
anthropic:
|
|
72
|
+
tools:
|
|
73
|
+
web-search:
|
|
74
|
+
display: description
|
|
75
|
+
description: Looking up current information
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Use cases:
|
|
79
|
+
- Current events and news
|
|
80
|
+
- Real-time data (prices, weather)
|
|
81
|
+
- Fact verification
|
|
82
|
+
- Documentation lookups
|
|
83
|
+
|
|
84
|
+
### Code Execution
|
|
85
|
+
|
|
86
|
+
Enables Python and Bash execution in a sandboxed container:
|
|
87
|
+
|
|
88
|
+
```yaml
|
|
89
|
+
agent:
|
|
90
|
+
model: anthropic/claude-sonnet-4-5
|
|
91
|
+
anthropic:
|
|
92
|
+
tools:
|
|
93
|
+
code-execution:
|
|
94
|
+
display: description
|
|
95
|
+
description: Running analysis
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Use cases:
|
|
99
|
+
- Data analysis and calculations
|
|
100
|
+
- File processing
|
|
101
|
+
- Chart generation
|
|
102
|
+
- Script execution
|
|
103
|
+
|
|
104
|
+
> **Note**: Code execution is automatically enabled when skills are configured (skills require the container environment).
|
|
105
|
+
|
|
106
|
+
## Skills
|
|
107
|
+
|
|
108
|
+
Skills are knowledge packages that give the agent specialized capabilities. They're loaded into the code execution container at `/skills/{skill-id}/`.
|
|
109
|
+
|
|
110
|
+
### Skill Configuration
|
|
111
|
+
|
|
112
|
+
```yaml
|
|
113
|
+
anthropic:
|
|
114
|
+
skills:
|
|
115
|
+
pdf:
|
|
116
|
+
type: anthropic # 'anthropic' or 'custom'
|
|
117
|
+
version: latest # Optional version
|
|
118
|
+
display: description
|
|
119
|
+
description: Processing PDF
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
| Field | Required | Description |
|
|
123
|
+
|-------|----------|-------------|
|
|
124
|
+
| `type` | Yes | `anthropic` (built-in) or `custom` (uploaded) |
|
|
125
|
+
| `version` | No | Skill version (default: `latest`) |
|
|
126
|
+
| `display` | No | `hidden`, `name`, `description`, or `stream` (default: `description`) |
|
|
127
|
+
| `description` | No | Custom text shown to users |
|
|
128
|
+
|
|
129
|
+
### Built-in Skills
|
|
130
|
+
|
|
131
|
+
Anthropic provides several built-in skills:
|
|
132
|
+
|
|
133
|
+
| Skill ID | Purpose |
|
|
134
|
+
|----------|---------|
|
|
135
|
+
| `pdf` | PDF manipulation, text extraction, form filling |
|
|
136
|
+
| `xlsx` | Excel spreadsheet operations and analysis |
|
|
137
|
+
| `docx` | Word document creation and editing |
|
|
138
|
+
| `pptx` | PowerPoint presentation creation |
|
|
139
|
+
|
|
140
|
+
### Using Skills
|
|
141
|
+
|
|
142
|
+
```yaml
|
|
143
|
+
agent:
|
|
144
|
+
model: anthropic/claude-sonnet-4-5
|
|
145
|
+
system: system
|
|
146
|
+
anthropic:
|
|
147
|
+
skills:
|
|
148
|
+
pdf:
|
|
149
|
+
type: anthropic
|
|
150
|
+
description: Processing your PDF
|
|
151
|
+
xlsx:
|
|
152
|
+
type: anthropic
|
|
153
|
+
description: Analyzing spreadsheet
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
When skills are configured:
|
|
157
|
+
1. Code execution is automatically enabled
|
|
158
|
+
2. Skill files are loaded into the container
|
|
159
|
+
3. The agent can read skill instructions and execute scripts
|
|
160
|
+
|
|
161
|
+
### Custom Skills
|
|
162
|
+
|
|
163
|
+
You can create and upload custom skills to Anthropic:
|
|
164
|
+
|
|
165
|
+
```yaml
|
|
166
|
+
anthropic:
|
|
167
|
+
skills:
|
|
168
|
+
my-custom-skill:
|
|
169
|
+
type: custom
|
|
170
|
+
version: latest
|
|
171
|
+
description: Running custom analysis
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Custom skills follow the [Agent Skills standard](https://agentskills.io) and contain:
|
|
175
|
+
- `SKILL.md` with instructions and metadata
|
|
176
|
+
- Optional `scripts/`, `references/`, and `assets/` directories
|
|
177
|
+
|
|
178
|
+
## Display Modes
|
|
179
|
+
|
|
180
|
+
Both tools and skills support display modes:
|
|
181
|
+
|
|
182
|
+
| Mode | Behavior |
|
|
183
|
+
|------|----------|
|
|
184
|
+
| `hidden` | Not shown to users |
|
|
185
|
+
| `name` | Shows the tool/skill name |
|
|
186
|
+
| `description` | Shows the description (default) |
|
|
187
|
+
| `stream` | Streams progress if available |
|
|
188
|
+
|
|
189
|
+
## Full Example
|
|
190
|
+
|
|
191
|
+
```yaml
|
|
192
|
+
input:
|
|
193
|
+
COMPANY_NAME: { type: string }
|
|
194
|
+
USER_ID: { type: string, optional: true }
|
|
195
|
+
|
|
196
|
+
tools:
|
|
197
|
+
get-user-account:
|
|
198
|
+
description: Looking up your account
|
|
199
|
+
parameters:
|
|
200
|
+
userId: { type: string }
|
|
201
|
+
|
|
202
|
+
agent:
|
|
203
|
+
model: anthropic/claude-sonnet-4-5
|
|
204
|
+
system: system
|
|
205
|
+
input: [COMPANY_NAME, USER_ID]
|
|
206
|
+
tools: [get-user-account] # External tools
|
|
207
|
+
agentic: true
|
|
208
|
+
thinking: medium
|
|
209
|
+
|
|
210
|
+
# Anthropic-specific options
|
|
211
|
+
anthropic:
|
|
212
|
+
# Provider tools (server-side)
|
|
213
|
+
tools:
|
|
214
|
+
web-search:
|
|
215
|
+
display: description
|
|
216
|
+
description: Searching the web
|
|
217
|
+
code-execution:
|
|
218
|
+
display: description
|
|
219
|
+
description: Running code
|
|
220
|
+
|
|
221
|
+
# Skills (knowledge packages)
|
|
222
|
+
skills:
|
|
223
|
+
pdf:
|
|
224
|
+
type: anthropic
|
|
225
|
+
display: description
|
|
226
|
+
description: Processing PDF document
|
|
227
|
+
xlsx:
|
|
228
|
+
type: anthropic
|
|
229
|
+
display: description
|
|
230
|
+
description: Analyzing spreadsheet
|
|
231
|
+
|
|
232
|
+
triggers:
|
|
233
|
+
user-message:
|
|
234
|
+
input:
|
|
235
|
+
USER_MESSAGE: { type: string }
|
|
236
|
+
|
|
237
|
+
handlers:
|
|
238
|
+
user-message:
|
|
239
|
+
Add message:
|
|
240
|
+
type: add-message
|
|
241
|
+
role: user
|
|
242
|
+
prompt: user-message
|
|
243
|
+
input: [USER_MESSAGE]
|
|
244
|
+
display: hidden
|
|
245
|
+
|
|
246
|
+
Respond:
|
|
247
|
+
type: next-message
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Validation
|
|
251
|
+
|
|
252
|
+
The protocol validator enforces:
|
|
253
|
+
|
|
254
|
+
1. **Model match**: Provider options must match the model provider
|
|
255
|
+
- `anthropic:` options require `anthropic/*` model
|
|
256
|
+
- Using mismatched options results in a validation error
|
|
257
|
+
|
|
258
|
+
2. **Valid tool types**: Only recognized tools are accepted
|
|
259
|
+
- `web-search` and `code-execution` for Anthropic
|
|
260
|
+
|
|
261
|
+
3. **Valid skill types**: Only `anthropic` or `custom` are accepted
|
|
262
|
+
|
|
263
|
+
### Error Example
|
|
264
|
+
|
|
265
|
+
```yaml
|
|
266
|
+
# This will fail validation
|
|
267
|
+
agent:
|
|
268
|
+
model: openai/gpt-4o # OpenAI model
|
|
269
|
+
anthropic: # Anthropic options - mismatch!
|
|
270
|
+
tools:
|
|
271
|
+
web-search: {}
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Error: `"anthropic" options require an anthropic model. Current model provider: "openai"`
|
|
275
|
+
|