@octavus/docs 3.4.0 → 3.6.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.
@@ -75,6 +75,67 @@ console.log({
75
75
 
76
76
  > **Note**: Use `getMessages()` for client-facing code. The `get()` method returns internal message format that includes hidden content not intended for end users.
77
77
 
78
+ ## Getting Execution Logs
79
+
80
+ `getLogs()` returns the chronological execution trace for a session - triggers, messages, tool calls, LLM responses, errors, and other events emitted while the agent ran. Useful for debugging, observability, and building custom timeline views.
81
+
82
+ ```typescript
83
+ const result = await client.agentSessions.getLogs(sessionId);
84
+
85
+ if (result.status === 'expired') {
86
+ console.log('Session expired:', result.sessionId);
87
+ } else {
88
+ for (const entry of result.entries) {
89
+ console.log(entry.type, entry.timestamp);
90
+ }
91
+ }
92
+ ```
93
+
94
+ Each entry is a typed variant of `ExecutionLogEntry` (a discriminated union) so consumers can narrow on `entry.type`:
95
+
96
+ ```typescript
97
+ const result = await client.agentSessions.getLogs(sessionId);
98
+
99
+ if (result.status !== 'expired') {
100
+ const toolCalls = result.entries.filter((e) => e.type === 'tool-call');
101
+ for (const call of toolCalls) {
102
+ // call.toolName, call.toolArguments are typed without optional chaining
103
+ console.log(call.toolName, call.toolArguments);
104
+ }
105
+ }
106
+ ```
107
+
108
+ ### Excluding Model Request Payloads
109
+
110
+ Model-request entries include the full provider request body and can be large. Pass `excludeModelRequests: true` to skip them:
111
+
112
+ ```typescript
113
+ const result = await client.agentSessions.getLogs(sessionId, {
114
+ excludeModelRequests: true,
115
+ });
116
+ ```
117
+
118
+ ### Truncation
119
+
120
+ Responses are capped at 1000 entries (most recent). When the log exceeds that cap, the response includes `total` and `truncated` so consumers can detect this:
121
+
122
+ ```typescript
123
+ const result = await client.agentSessions.getLogs(sessionId);
124
+
125
+ if (result.status !== 'expired' && result.truncated) {
126
+ console.warn(`Showing latest 1000 of ${result.total} entries`);
127
+ }
128
+ ```
129
+
130
+ ### Response Types
131
+
132
+ | Status | Type | Description |
133
+ | --------- | --------------------- | -------------------------------------------------------------------------------------------- |
134
+ | `active` | `ExecutionLogsResult` | `{ sessionId, entries, total?, truncated? }`. `total` and `truncated` are present when known |
135
+ | `expired` | `ExpiredSessionState` | `{ sessionId, agentId, status: 'expired', createdAt }` |
136
+
137
+ > **Forward-compatible types**: `ExecutionLogEntry` may gain new variants over time. Include a `default` case when switching on `entry.type` so unknown variants are handled gracefully.
138
+
78
139
  ## Attaching to Sessions
79
140
 
80
141
  To trigger actions on a session, you need to attach to it first:
@@ -59,18 +59,25 @@ const sessionId = await client.agentSessions.create('support-chat', {
59
59
  });
60
60
  ```
61
61
 
62
- Inputs can also be used for [dynamic model selection](/docs/protocol/agent-config#dynamic-model-selection):
62
+ Inputs can also drive agent configuration at session creation time. The `model`, `backupModel`, `imageModel`, `temperature`, `thinking`, and `maxSteps` fields all accept variable references:
63
63
 
64
64
  ```yaml
65
65
  input:
66
66
  MODEL:
67
67
  type: string
68
68
  description: The LLM model to use
69
+ TEMPERATURE:
70
+ type: number
71
+ description: Override temperature
72
+ optional: true
69
73
 
70
74
  agent:
71
75
  model: MODEL # Resolved from session input
76
+ temperature: TEMPERATURE # Same pattern works for thinking, maxSteps
72
77
  ```
73
78
 
79
+ Each setting accepts the natural type for that field - declare `temperature: number`, `maxSteps: integer`, `thinking: string`. See [Dynamic Model Selection](/docs/protocol/agent-config#dynamic-model-selection) and [Dynamic Configuration](/docs/protocol/agent-config#dynamic-configuration) for details.
80
+
74
81
  In prompts, reference variables with `{{VARIABLE_NAME}}`:
75
82
 
76
83
  ```markdown
@@ -42,12 +42,31 @@ tools:
42
42
 
43
43
  ### Display Modes
44
44
 
45
- | Mode | Behavior |
46
- | ------------- | ------------------------------------------- |
47
- | `hidden` | Tool runs silently, user doesn't see it |
48
- | `name` | Shows tool name while executing |
49
- | `description` | Shows description while executing (default) |
50
- | `stream` | Streams tool progress if available |
45
+ Controls what the client sees about tool execution. The default is `description`.
46
+
47
+ | Mode | Behavior |
48
+ | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
49
+ | `hidden` | No UI events emitted. The tool executes silently and the user has no awareness it was called. Use for internal plumbing tools (title setting, context management). |
50
+ | `name` | Shows the raw tool name while executing. Arguments and result are not displayed. |
51
+ | `description` | Shows the tool's description while executing (default). Arguments are visible during live streaming but the result is not preserved after page refresh. |
52
+ | `stream` | Full visibility. Arguments stream progressively as the LLM generates them, and the result is shown after execution. The result is preserved after page refresh. |
53
+
54
+ **When to use `stream`:**
55
+
56
+ - Client tools where the user benefits from seeing arguments or results
57
+ - Interactive client tools (user provides input via the tool card)
58
+ - Tools whose result is rendered via `renderToolCallResult`
59
+ - Any tool where transparency into what was sent/received matters
60
+
61
+ **When to use `hidden`:**
62
+
63
+ - Internal lifecycle tools (e.g., session title setting)
64
+ - Context-setting tools that would clutter the UI
65
+ - Tools that are implementation details of the agent's protocol
66
+
67
+ **Refresh and restore behavior:**
68
+
69
+ `stream` is the only mode that preserves the tool result after a page refresh. For all other modes, the result is available during the live session but stripped on refresh. On session restore (when the session expires and is rebuilt from stored `UIMessage[]`), `stream` tools retain their original result while other modes receive a placeholder.
51
70
 
52
71
  ## Parameters
53
72
 
@@ -53,12 +53,14 @@ skills:
53
53
 
54
54
  ### Display Modes
55
55
 
56
- | Mode | Behavior |
57
- | ------------- | ------------------------------------------- |
58
- | `hidden` | Skill usage not shown to users |
59
- | `name` | Shows skill name while executing |
60
- | `description` | Shows description while executing (default) |
61
- | `stream` | Streams progress if available |
56
+ The `display` setting on a skill applies to all tools under that skill namespace. See [Tool Display Modes](/docs/protocol/tools#display-modes) for full details on each mode.
57
+
58
+ | Mode | Behavior |
59
+ | ------------- | -------------------------------------------------------------------------------------------------------------------- |
60
+ | `hidden` | Skill tools run silently, no UI events emitted |
61
+ | `name` | Shows skill name while executing |
62
+ | `description` | Shows description while executing (default). Result not preserved after page refresh. |
63
+ | `stream` | Full visibility - arguments stream progressively, result shown after execution, result preserved after page refresh. |
62
64
 
63
65
  ## Enabling Skills
64
66
 
@@ -158,7 +158,7 @@ Start summary thread:
158
158
 
159
159
  The `cache` field controls prompt caching for this thread and defaults to `auto` when omitted. Threads do not inherit the agent's `cache` value - see [Prompt Caching](/docs/protocol/agent-config#prompt-caching).
160
160
 
161
- The `model` field can also reference a variable for dynamic model selection. The `backupModel` field follows the same format and supports variable references.
161
+ The `model` field can also reference a variable for dynamic model selection. The `backupModel`, `temperature`, `thinking`, and `maxSteps` fields also support variable references - see [Dynamic Configuration](/docs/protocol/agent-config#dynamic-configuration).
162
162
 
163
163
  ```yaml
164
164
  Start summary thread:
@@ -21,25 +21,25 @@ agent:
21
21
 
22
22
  ## Configuration Options
23
23
 
24
- | Field | Required | Description |
25
- | ---------------- | -------- | ------------------------------------------------------------------------------ |
26
- | `model` | Yes | Model identifier or variable reference |
27
- | `backupModel` | No | Backup model for automatic failover on provider errors |
28
- | `system` | Yes | System prompt filename (without .md) |
29
- | `input` | No | Variables to pass to the system prompt |
30
- | `tools` | No | List of tools the LLM can call |
31
- | `mcpServers` | No | List of MCP servers to connect (see [MCP Servers](/docs/protocol/mcp-servers)) |
32
- | `skills` | No | List of Octavus skills the LLM can use |
33
- | `references` | No | List of references the LLM can fetch on demand |
34
- | `sandboxTimeout` | No | Skill sandbox timeout in ms (default: 5 min, max: 1 hour) |
35
- | `imageModel` | No | Image generation model (enables agentic image generation) |
36
- | `webSearch` | No | Enable built-in web search tool (provider-agnostic) |
37
- | `agentic` | No | Allow multiple tool call cycles |
38
- | `maxSteps` | No | Maximum agentic steps (default: 10) |
39
- | `temperature` | No | Model temperature (0-2) |
40
- | `thinking` | No | Extended reasoning level |
41
- | `cache` | No | Prompt caching mode: `auto` (default), `extended`, or `off` |
42
- | `anthropic` | No | Anthropic-specific options (tools, skills) |
24
+ | Field | Required | Description |
25
+ | ---------------- | -------- | ---------------------------------------------------------------------------------------- |
26
+ | `model` | Yes | Model identifier or variable reference |
27
+ | `backupModel` | No | Backup model for automatic failover on provider errors |
28
+ | `system` | Yes | System prompt filename (without .md) |
29
+ | `input` | No | Variables to pass to the system prompt |
30
+ | `tools` | No | List of tools the LLM can call |
31
+ | `mcpServers` | No | List of MCP servers to connect (see [MCP Servers](/docs/protocol/mcp-servers)) |
32
+ | `skills` | No | List of Octavus skills the LLM can use |
33
+ | `references` | No | List of references the LLM can fetch on demand |
34
+ | `sandboxTimeout` | No | Skill sandbox timeout in ms (default: 5 min, max: 1 hour) |
35
+ | `imageModel` | No | Image generation model (enables agentic image generation) |
36
+ | `webSearch` | No | Enable built-in web search tool (provider-agnostic) |
37
+ | `agentic` | No | Allow multiple tool call cycles |
38
+ | `maxSteps` | No | Maximum agentic steps (default: 10) - literal or variable reference |
39
+ | `temperature` | No | Model temperature (0-2), `"off"`, or a variable reference |
40
+ | `thinking` | No | Extended reasoning level (`low`/`medium`/`high`/`max`), `"off"`, or a variable reference |
41
+ | `cache` | No | Prompt caching mode: `auto` (default), `extended`, or `off` |
42
+ | `anthropic` | No | Anthropic-specific options (tools, skills) |
43
43
 
44
44
  ## Models
45
45
 
@@ -222,14 +222,15 @@ Enable extended reasoning for complex tasks:
222
222
  ```yaml
223
223
  agent:
224
224
  model: anthropic/claude-sonnet-4-5
225
- thinking: medium # low | medium | high
225
+ thinking: medium # low | medium | high | max
226
226
  ```
227
227
 
228
- | Level | Use Case |
229
- | -------- | ------------------- |
230
- | `low` | Simple reasoning |
231
- | `medium` | Moderate complexity |
232
- | `high` | Complex analysis |
228
+ | Level | Use Case |
229
+ | -------- | ---------------------------------- |
230
+ | `low` | Simple reasoning |
231
+ | `medium` | Moderate complexity |
232
+ | `high` | Complex analysis |
233
+ | `max` | Maximum reasoning budget available |
233
234
 
234
235
  Thinking content streams to the UI and can be displayed to users.
235
236
 
@@ -237,15 +238,15 @@ Thinking content streams to the UI and can be displayed to users.
237
238
 
238
239
  Each provider translates `thinking` into its own reasoning controls:
239
240
 
240
- | Provider | Level mapping |
241
- | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
242
- | Anthropic 4.6+ (`claude-opus-4-7`, `claude-opus-4-6`, `claude-sonnet-4-6`) | Adaptive thinking - the model decides how much to reason, guided by `effort: low / medium / high` |
243
- | Anthropic older (4.5 and earlier) | Fixed token budgets: `low` ~5,000, `medium` ~10,000, `high` ~20,000 |
244
- | OpenAI (GPT-5.x, o-series) | `reasoningEffort: low / medium / high` |
245
- | Google (Gemini 3.x) | `thinkingLevel: low / high` (`medium` rounds up to `high`) |
246
- | Google (Gemini 1.x / 2.x) | Token budgets: `low` 1,024, `medium` 8,192, `high` 24,576 |
247
- | OpenRouter | Unified `reasoning.max_tokens` (translated upstream) |
248
- | Vercel AI Gateway | Forwards the underlying provider's options |
241
+ | Provider | Level mapping |
242
+ | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
243
+ | Anthropic 4.6+ (`claude-opus-4-7`, `claude-opus-4-6`, `claude-sonnet-4-6`) | Adaptive thinking - the model decides how much to reason, guided by `effort: low / medium / high / max` |
244
+ | Anthropic older (4.5 and earlier) | Fixed token budgets: `low` ~5,000, `medium` ~10,000, `high` ~20,000, `max` ~40,000 |
245
+ | OpenAI (GPT-5.x, o-series) | `reasoningEffort: low / medium / high` (`max` maps to `high`) |
246
+ | Google (Gemini 3.x) | `thinkingLevel: low / high` (`medium` rounds up to `high`) |
247
+ | Google (Gemini 1.x / 2.x) | Token budgets: `low` 1,024, `medium` 8,192, `high` 24,576, `max` 65,536 |
248
+ | OpenRouter | Unified `reasoning.max_tokens` (translated upstream) |
249
+ | Vercel AI Gateway | Forwards the underlying provider's options |
249
250
 
250
251
  ## Prompt Caching
251
252
 
@@ -453,6 +454,68 @@ agent:
453
454
  - `0.8 - 1.2`: Creative, varied responses
454
455
  - `> 1.2`: Very creative (may be inconsistent)
455
456
 
457
+ ## Dynamic Configuration
458
+
459
+ Like `model`, the `temperature`, `thinking`, and `maxSteps` fields can also reference an input variable. Consumers choose values at session creation, so the same agent can be tuned per call without protocol changes:
460
+
461
+ ```yaml
462
+ input:
463
+ TEMPERATURE:
464
+ type: number
465
+ description: Override temperature (0-2)
466
+ optional: true
467
+ THINKING:
468
+ type: string
469
+ description: Override thinking effort (low/medium/high/max, or "off")
470
+ optional: true
471
+ MAX_STEPS:
472
+ type: integer
473
+ description: Override max agentic steps
474
+ optional: true
475
+
476
+ agent:
477
+ model: anthropic/claude-sonnet-4-5
478
+ temperature: TEMPERATURE
479
+ thinking: THINKING
480
+ maxSteps: MAX_STEPS
481
+ system: system
482
+ ```
483
+
484
+ When creating a session, pass the values in their natural type:
485
+
486
+ ```typescript
487
+ const sessionId = await client.agentSessions.create('my-agent', {
488
+ TEMPERATURE: 0.7,
489
+ THINKING: 'medium',
490
+ MAX_STEPS: 5,
491
+ });
492
+ ```
493
+
494
+ ### Accepted values
495
+
496
+ The resolver accepts the natural type for each field, plus a string fallback so consumers can pass values from form inputs without coercing first.
497
+
498
+ | Field | Suggested input type | Value at session creation |
499
+ | ------------- | ------------------------------------------ | -------------------------------------------------- |
500
+ | `temperature` | `number` (or `string` for `"off"` support) | A number `0`-`2`, a numeric string, or `"off"` |
501
+ | `thinking` | `string` | `"low"`, `"medium"`, `"high"`, `"max"`, or `"off"` |
502
+ | `maxSteps` | `integer` (or `string`) | A positive integer or a positive integer string |
503
+
504
+ The protocol's `input:` declaration enforces what the consumer can pass. Pick `type: number` / `type: integer` if you want native numeric overrides; pick `type: string` (or `type: unknown`) if you also need to pass the `"off"` sentinel for `temperature`.
505
+
506
+ ### Explicit "off" vs not set
507
+
508
+ `temperature` and `thinking` accept an explicit `"off"` value to disable the field at session creation. This is different from omitting the variable:
509
+
510
+ - **Variable not provided** -> the field is unset; the provider uses its default behavior
511
+ - **Variable provided as `"off"`** -> the field is explicitly disabled (no temperature emitted, reasoning disabled)
512
+
513
+ The distinction matters because `temperature` and `thinking` are mutually exclusive at the provider level - several providers ignore temperature when reasoning is enabled. Use `"off"` to opt one out so the other takes effect.
514
+
515
+ ### Validation
516
+
517
+ Variable references are caught at protocol validation time. If `temperature: TEMPERATURE` is declared but `TEMPERATURE` is missing from `input:` or `variables:`, the validator surfaces the error in the dashboard before the agent runs.
518
+
456
519
  ## Provider Options
457
520
 
458
521
  Enable provider-specific features like Anthropic's built-in tools and skills:
@@ -219,21 +219,21 @@ steps:
219
219
 
220
220
  All LLM configuration goes here:
221
221
 
222
- | Field | Description |
223
- | ------------- | ----------------------------------------------------------- |
224
- | `thread` | Thread name (defaults to block name) |
225
- | `model` | LLM model to use |
226
- | `system` | System prompt filename (required) |
227
- | `input` | Variables for system prompt |
228
- | `tools` | Tools available in this thread |
229
- | `skills` | Octavus skills available in this thread |
230
- | `mcpServers` | MCP servers available in this thread |
231
- | `imageModel` | Image generation model |
232
- | `webSearch` | Enable built-in web search tool |
233
- | `thinking` | Extended reasoning level |
234
- | `cache` | Prompt caching mode: `auto` (default), `extended`, or `off` |
235
- | `temperature` | Model temperature |
236
- | `maxSteps` | Maximum tool call cycles (enables agentic if > 1) |
222
+ | Field | Description |
223
+ | ------------- | -------------------------------------------------------------------------------------- |
224
+ | `thread` | Thread name (defaults to block name) |
225
+ | `model` | LLM model to use |
226
+ | `system` | System prompt filename (required) |
227
+ | `input` | Variables for system prompt |
228
+ | `tools` | Tools available in this thread |
229
+ | `skills` | Octavus skills available in this thread |
230
+ | `mcpServers` | MCP servers available in this thread |
231
+ | `imageModel` | Image generation model |
232
+ | `webSearch` | Enable built-in web search tool |
233
+ | `thinking` | Extended reasoning level (`low`/`medium`/`high`/`max`), `"off"`, or variable reference |
234
+ | `cache` | Prompt caching mode: `auto` (default), `extended`, or `off` |
235
+ | `temperature` | Model temperature (0-2), `"off"`, or variable reference |
236
+ | `maxSteps` | Maximum tool call cycles (enables agentic if > 1), or variable reference |
237
237
 
238
238
  ## Simple Example
239
239
 
@@ -520,14 +520,20 @@ The LLM can then call workers as tools during conversation.
520
520
 
521
521
  ### Display Modes
522
522
 
523
- Control how worker execution appears to users:
523
+ Controls how worker execution appears to users. The default for workers is `stream`.
524
524
 
525
- | Mode | Behavior |
526
- | ------------- | --------------------------------- |
527
- | `hidden` | Worker runs silently |
528
- | `name` | Shows worker name |
529
- | `description` | Shows description text |
530
- | `stream` | Streams all worker events to user |
525
+ | Mode | Behavior |
526
+ | ------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
527
+ | `hidden` | Worker runs silently. No events reach the client - no `UIWorkerPart` is created. |
528
+ | `name` | Shows a running/done indicator with the worker name. No nested content (text, tool calls, reasoning) is forwarded. |
529
+ | `description` | Shows a running/done indicator with the worker description. No nested content is forwarded. |
530
+ | `stream` | Full visibility. All nested events are forwarded - text, reasoning, tool calls, sources, files. Worker input is included on start. |
531
+
532
+ **Progressive input streaming:** When a worker with `display: stream` is invoked agentically (LLM calls it as a tool), the `UIWorkerPart` appears in the UI immediately as the LLM starts generating the worker's arguments. The worker input streams progressively into the worker part, the same way text tokens stream into a text part. Once input finishes, worker execution begins and nested content flows into the same worker part. There is no intermediate tool card.
533
+
534
+ **`name` and `description` modes:** Worker input is stripped from the `worker-start` event (it may contain sensitive data). Only the running/done status and the final `worker-result` are forwarded to the parent stream. Use these for workers where the user only needs to know the worker ran, not what it did internally.
535
+
536
+ **`hidden` mode:** The worker executes normally but produces no UI presence at all. Use for internal workers that are implementation details.
531
537
 
532
538
  ### Tool Mapping
533
539