@octavus/docs 2.8.0 → 2.10.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.
@@ -106,6 +106,7 @@ The main entry point for interacting with Octavus.
106
106
  interface OctavusClientConfig {
107
107
  baseUrl: string; // Octavus API URL
108
108
  apiKey?: string; // Your API key
109
+ traceModelRequests?: boolean; // Enable model request tracing (default: false)
109
110
  }
110
111
 
111
112
  class OctavusClient {
@@ -221,3 +222,4 @@ The client uploads files directly to S3 using the presigned upload URL. See [Fil
221
222
  - [Tools](/docs/server-sdk/tools) — Implementing tool handlers
222
223
  - [Streaming](/docs/server-sdk/streaming) — Understanding stream events
223
224
  - [Workers](/docs/server-sdk/workers) — Executing worker agents
225
+ - [Debugging](/docs/server-sdk/debugging) — Model request tracing and debugging
@@ -203,6 +203,8 @@ flowchart TD
203
203
  C --> D[4. RETRIEVE]
204
204
  D --> C
205
205
  C --> E[5. EXPIRE]
206
+ C --> G[5b. CLEAR]
207
+ G --> F
206
208
  E --> F{6. RESTORE?}
207
209
  F -->|Yes| C
208
210
  F -->|No| A
@@ -227,6 +229,10 @@ flowchart TD
227
229
  E -.- E1["`Sessions expire after
228
230
  24 hours (configurable)`"]
229
231
 
232
+ G -.- G1["`**client.agentSessions.clear()**
233
+ Programmatically clear state
234
+ Session becomes expired`"]
235
+
230
236
  F -.- F1["`**client.agentSessions.restore()**
231
237
  Restore from stored messages
232
238
  Or create new session`"]
@@ -380,6 +386,26 @@ async function getOrCreateSession(chatId: string, agentId: string, input: Record
380
386
  }
381
387
  ```
382
388
 
389
+ ## Clearing Sessions
390
+
391
+ To programmatically clear a session's state (e.g., for testing reset/restore flows), use `clear()`:
392
+
393
+ ```typescript
394
+ const result = await client.agentSessions.clear(sessionId);
395
+ console.log(result.cleared); // true
396
+ ```
397
+
398
+ After clearing, the session transitions to `expired` status. You can then restore it with `restore()` or create a new session.
399
+
400
+ ```typescript
401
+ interface ClearSessionResult {
402
+ sessionId: string;
403
+ cleared: boolean;
404
+ }
405
+ ```
406
+
407
+ This is idempotent — calling `clear()` on an already expired session succeeds without error.
408
+
383
409
  ## Error Handling
384
410
 
385
411
  ```typescript
@@ -140,6 +140,27 @@ Get details about a specific agent by its slug.
140
140
  octavus get support-chat
141
141
  ```
142
142
 
143
+ ### `octavus archive <slug>`
144
+
145
+ Archive an agent by slug (soft delete). Archived agents are removed from the active agent list and their slug is freed for reuse.
146
+
147
+ ```bash
148
+ octavus archive support-chat
149
+ ```
150
+
151
+ **Options:**
152
+
153
+ - `--json` — Output as JSON (for CI/CD parsing)
154
+ - `--quiet` — Suppress non-essential output
155
+
156
+ **Example output:**
157
+
158
+ ```
159
+ ℹ Archiving support-chat...
160
+ ✓ Archived: support-chat
161
+ Agent ID: clxyz123abc456
162
+ ```
163
+
143
164
  ## Agent Directory Structure
144
165
 
145
166
  The CLI expects agent definitions in a specific directory structure:
@@ -0,0 +1,79 @@
1
+ ---
2
+ title: Debugging
3
+ description: Model request tracing and debugging tools for Octavus agents.
4
+ ---
5
+
6
+ # Debugging
7
+
8
+ ## Model Request Tracing
9
+
10
+ Model request tracing captures the full payload sent to model providers (LLM and image) during agent execution. This helps you understand exactly what was sent — system prompts, messages, tool definitions, and provider options — making it easier to debug agent behavior.
11
+
12
+ ### Enabling Tracing
13
+
14
+ Enable tracing by setting `traceModelRequests: true` in the client config:
15
+
16
+ ```typescript
17
+ import { OctavusClient } from '@octavus/server-sdk';
18
+
19
+ const client = new OctavusClient({
20
+ baseUrl: process.env.OCTAVUS_API_URL!,
21
+ apiKey: process.env.OCTAVUS_API_KEY!,
22
+ traceModelRequests: true,
23
+ });
24
+ ```
25
+
26
+ When enabled, the SDK sends an `X-Octavus-Trace: true` header with every request. The platform captures the full model request payload before each provider call and stores it in the execution logs.
27
+
28
+ You can also drive this from an environment variable for per-environment control:
29
+
30
+ ```typescript
31
+ const client = new OctavusClient({
32
+ baseUrl: process.env.OCTAVUS_API_URL!,
33
+ apiKey: process.env.OCTAVUS_API_KEY!,
34
+ traceModelRequests: process.env.TRACE_MODEL_REQUESTS === 'true',
35
+ });
36
+ ```
37
+
38
+ ### What Gets Captured
39
+
40
+ **LLM requests** include:
41
+
42
+ - Full system prompt
43
+ - All messages in AI SDK format (post-conversion)
44
+ - Tool names, descriptions, and JSON schemas
45
+ - Provider-specific options (thinking budgets, etc.)
46
+ - Temperature, max steps, and thinking configuration
47
+
48
+ **Image generation requests** include:
49
+
50
+ - Image generation prompt
51
+ - Requested size
52
+ - Whether reference images were provided
53
+
54
+ ### Where Traces Appear
55
+
56
+ Traces appear as **Model Request** entries in the execution log timeline, alongside existing entries like triggers, tool calls, and responses. Each trace is linked to the block that made the model call.
57
+
58
+ In the Octavus dashboard:
59
+
60
+ - **Session debug view** — Full execution log with expandable model request entries
61
+ - **Agent preview** — Activity panel shows model requests in the execution steps
62
+
63
+ Each entry shows the raw JSON payload with a copy button for easy inspection.
64
+
65
+ ### Storage
66
+
67
+ Traces are stored in Redis alongside other execution log entries with a 24-hour TTL. They are not permanently stored. A typical LLM trace with 10 messages and 5 tools is 10–50KB. Image traces are smaller (just prompt and metadata).
68
+
69
+ ### Recommendations
70
+
71
+ | Environment | Recommendation |
72
+ | ----------- | ---------------------------------------------------------- |
73
+ | Development | Enable — helps debug agent behavior during development |
74
+ | Staging | Enable — useful for pre-production testing |
75
+ | Production | Disable (default) — saves storage for high-volume sessions |
76
+
77
+ ### Preview Sessions
78
+
79
+ Model request tracing is always enabled for preview sessions in the Octavus dashboard. No configuration needed — the platform automatically traces all model requests when using the agent preview.
@@ -71,12 +71,14 @@ agent:
71
71
  model: MODEL # Resolved from session input
72
72
  ```
73
73
 
74
- In prompts, reference with `{{INPUT_NAME}}`:
74
+ In prompts, reference variables with `{{VARIABLE_NAME}}`:
75
75
 
76
76
  ```markdown
77
77
  You are a support agent for {{COMPANY_NAME}}.
78
78
  ```
79
79
 
80
+ To use a variable in a prompt, pass it through the `input` mapping on the [agent config](/docs/protocol/agent-config#system-prompt) or [block](/docs/protocol/handlers#block-input-mapping). Variables not listed in the `input` mapping won't be interpolated — the `{{VARIABLE}}` placeholder will be preserved as-is.
81
+
80
82
  > **Note:** Variables must be `UPPER_SNAKE_CASE`. Nested properties (dot notation like `{{VAR.property}}`) are not supported. Objects are serialized as JSON when interpolated.
81
83
 
82
84
  ## Resources
@@ -305,16 +305,23 @@ handlers:
305
305
 
306
306
  ## Block Input Mapping
307
307
 
308
- Map variables to block inputs:
308
+ The `input` field on blocks controls which variables are passed to the prompt. Only variables listed in `input` are available for interpolation.
309
+
310
+ Variables can come from `protocol.input`, `protocol.resources`, `protocol.variables`, `trigger.input`, or outputs from prior blocks.
309
311
 
310
312
  ```yaml
311
- # Simple list (variable name = prompt variable)
313
+ # Array format (same name)
312
314
  input: [USER_MESSAGE, COMPANY_NAME]
313
315
 
314
- # Mapping (different names)
316
+ # Array format (rename)
315
317
  input:
316
- - CONVERSATION: CONVERSATION_TEXT # CONVERSATION in prompt = CONVERSATION_TEXT
318
+ - CONVERSATION: CONVERSATION_TEXT # Prompt sees CONVERSATION, value comes from CONVERSATION_TEXT
317
319
  - TICKET_DETAILS: TICKET
320
+
321
+ # Object format (rename)
322
+ input:
323
+ CONVERSATION: CONVERSATION_TEXT
324
+ TICKET_DETAILS: TICKET
318
325
  ```
319
326
 
320
327
  ## Independent Blocks
@@ -23,7 +23,7 @@ agent:
23
23
  | ------------- | -------- | --------------------------------------------------------- |
24
24
  | `model` | Yes | Model identifier or variable reference |
25
25
  | `system` | Yes | System prompt filename (without .md) |
26
- | `input` | No | Variables to interpolate in system prompt |
26
+ | `input` | No | Variables to pass to the system prompt |
27
27
  | `tools` | No | List of tools the LLM can call |
28
28
  | `skills` | No | List of Octavus skills the LLM can use |
29
29
  | `imageModel` | No | Image generation model (enables agentic image generation) |
@@ -102,7 +102,7 @@ The model value is validated at runtime to ensure it's in the correct `provider/
102
102
 
103
103
  ## System Prompt
104
104
 
105
- The system prompt sets the agent's persona and instructions:
105
+ The system prompt sets the agent's persona and instructions. The `input` field controls which variables are available to the prompt — only variables listed in `input` are interpolated.
106
106
 
107
107
  ```yaml
108
108
  agent:
@@ -112,7 +112,30 @@ agent:
112
112
  - PRODUCT_NAME
113
113
  ```
114
114
 
115
- Example `prompts/system.md`:
115
+ Variables in `input` can come from `protocol.input`, `protocol.resources`, or `protocol.variables`.
116
+
117
+ ### Input Mapping Formats
118
+
119
+ ```yaml
120
+ # Array format (same name)
121
+ input:
122
+ - COMPANY_NAME
123
+ - PRODUCT_NAME
124
+
125
+ # Array format (rename)
126
+ input:
127
+ - CONTEXT: CONVERSATION_SUMMARY # Prompt sees CONTEXT, value comes from CONVERSATION_SUMMARY
128
+
129
+ # Object format (rename)
130
+ input:
131
+ CONTEXT: CONVERSATION_SUMMARY
132
+ ```
133
+
134
+ The left side (label) is what the prompt sees. The right side (source) is where the value comes from.
135
+
136
+ ### Example
137
+
138
+ `prompts/system.md`:
116
139
 
117
140
  ```markdown
118
141
  You are a friendly support agent for {{COMPANY_NAME}}.
@@ -212,6 +212,32 @@ curl -X POST https://octavus.ai/api/agent-sessions/:sessionId/restore \
212
212
 
213
213
  > **Note**: Store the `UIMessage[]` array after each interaction to enable restoration. The restore endpoint reconstructs the conversation state from these messages.
214
214
 
215
+ ## Clear Session
216
+
217
+ Clear session state, transitioning it to `expired` status. The session can be restored afterwards with the [Restore Session](#restore-session) endpoint.
218
+
219
+ This is idempotent — clearing an already expired session succeeds without error.
220
+
221
+ ```
222
+ DELETE /api/agent-sessions/:sessionId
223
+ ```
224
+
225
+ ### Response
226
+
227
+ ```json
228
+ {
229
+ "sessionId": "cm5xyz123abc456def",
230
+ "cleared": true
231
+ }
232
+ ```
233
+
234
+ ### Example
235
+
236
+ ```bash
237
+ curl -X DELETE https://octavus.ai/api/agent-sessions/:sessionId \
238
+ -H "Authorization: Bearer YOUR_API_KEY"
239
+ ```
240
+
215
241
  ## Trigger Session
216
242
 
217
243
  Execute a trigger on a session. Returns a Server-Sent Events stream.
@@ -15,6 +15,7 @@ Manage agent definitions including protocols and prompts.
15
15
  | `/api/agents/:id` | GET | Agents OR Sessions |
16
16
  | `/api/agents` | POST | Agents |
17
17
  | `/api/agents/:id` | PATCH | Agents |
18
+ | `/api/agents/:id` | DELETE | Agents |
18
19
  | `/api/agents/validate` | POST | Agents |
19
20
 
20
21
  Read endpoints work with either permission since both the CLI (for sync) and Server SDK (for sessions) need to read agent definitions.
@@ -203,6 +204,37 @@ curl -X PATCH https://octavus.ai/api/agents/:agentId \
203
204
  }'
204
205
  ```
205
206
 
207
+ ## Archive Agent
208
+
209
+ Archive an agent (soft delete). The agent is removed from the active agent list and its slug is freed for reuse. Session history is preserved.
210
+
211
+ ```
212
+ DELETE /api/agents/:id
213
+ ```
214
+
215
+ Supports `?by=slug` query parameter to look up by slug instead of ID.
216
+
217
+ ### Response
218
+
219
+ ```json
220
+ {
221
+ "agentId": "cm5xvz7k80001abcd",
222
+ "message": "Agent archived successfully"
223
+ }
224
+ ```
225
+
226
+ ### Example
227
+
228
+ ```bash
229
+ # Archive by ID
230
+ curl -X DELETE https://octavus.ai/api/agents/:agentId \
231
+ -H "Authorization: Bearer YOUR_API_KEY"
232
+
233
+ # Archive by slug
234
+ curl -X DELETE https://octavus.ai/api/agents/support-chat?by=slug \
235
+ -H "Authorization: Bearer YOUR_API_KEY"
236
+ ```
237
+
206
238
  ## Creating and Managing Agents
207
239
 
208
240
  There are two ways to manage agents: