@octavus/docs 5.0.0 → 5.1.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.
- package/content/04-protocol/04-tools.md +21 -11
- package/content/04-protocol/05-skills.md +6 -5
- package/content/04-protocol/06-handlers.md +7 -6
- package/content/04-protocol/08-provider-options.md +12 -10
- package/content/04-protocol/11-workers.md +1 -0
- package/content/04-protocol/13-mcp-servers.md +2 -1
- package/content/07-workforce-agents/01-overview.md +60 -0
- package/content/07-workforce-agents/02-sdk.md +105 -0
- package/content/07-workforce-agents/03-api-reference.md +146 -0
- package/content/07-workforce-agents/_meta.md +4 -0
- package/dist/{chunk-Z2OPVMHI.js → chunk-RW7WOZKG.js} +83 -21
- package/dist/chunk-RW7WOZKG.js.map +1 -0
- package/dist/content.js +1 -1
- package/dist/docs.json +37 -10
- 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 +45 -10
- package/package.json +1 -1
- package/dist/chunk-Z2OPVMHI.js.map +0 -1
|
@@ -34,22 +34,24 @@ tools:
|
|
|
34
34
|
|
|
35
35
|
### Tool Fields
|
|
36
36
|
|
|
37
|
-
| Field | Required | Description
|
|
38
|
-
| ------------- | -------- |
|
|
39
|
-
| `description` | Yes | What the tool does (shown to LLM and optionally user)
|
|
40
|
-
| `display` | No | How to show in UI: `hidden`, `name`, `description`, `stream`
|
|
41
|
-
| `
|
|
37
|
+
| Field | Required | Description |
|
|
38
|
+
| ------------- | -------- | -------------------------------------------------------------------------- |
|
|
39
|
+
| `description` | Yes | What the tool does (shown to LLM and optionally user) |
|
|
40
|
+
| `display` | No | How to show in UI: `hidden`, `name`, `description`, `stream`, `title` |
|
|
41
|
+
| `title` | No | UI label shown when `display: title` (hides the description and arguments) |
|
|
42
|
+
| `parameters` | No | Input parameters the tool accepts |
|
|
42
43
|
|
|
43
44
|
### Display Modes
|
|
44
45
|
|
|
45
46
|
Controls what the client sees about tool execution. The default is `description`.
|
|
46
47
|
|
|
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.
|
|
48
|
+
| Mode | Behavior |
|
|
49
|
+
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
50
|
+
| `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). |
|
|
51
|
+
| `name` | Shows the raw tool name while executing. Arguments and result are not displayed. |
|
|
52
|
+
| `description` | Shows the tool's description while executing (default). Arguments are visible during live streaming but the result is not preserved after page refresh. |
|
|
53
|
+
| `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. |
|
|
54
|
+
| `title` | Shows the tool's `title` plus the tool name only. The description, arguments, and result are hidden in the UI; the `description` is still sent to the LLM. Use for server-side tools that should appear as a labeled step without exposing their inputs/outputs. |
|
|
53
55
|
|
|
54
56
|
**When to use `stream`:**
|
|
55
57
|
|
|
@@ -64,6 +66,14 @@ Controls what the client sees about tool execution. The default is `description`
|
|
|
64
66
|
- Context-setting tools that would clutter the UI
|
|
65
67
|
- Tools that are implementation details of the agent's protocol
|
|
66
68
|
|
|
69
|
+
**When to use `title`:**
|
|
70
|
+
|
|
71
|
+
- Server-side tools that should appear in the UI as a clean, labeled step (e.g. "Looking up your account") without exposing their arguments or result
|
|
72
|
+
- Tools whose `description` is written for the LLM and shouldn't be shown verbatim to the user
|
|
73
|
+
- This is the recommended mode for server-executed tools that should be visible: give them a human-readable `title` for the UI and keep `description` focused on instructing the model
|
|
74
|
+
|
|
75
|
+
`title` is the preferred choice for server-side tools that should surface in the UI. `name` and `description` remain supported for backward compatibility, but for new server-side tools prefer `title` (a clean UI label) - or `stream` for client tools where the user benefits from seeing the arguments and result.
|
|
76
|
+
|
|
67
77
|
**Refresh and restore behavior:**
|
|
68
78
|
|
|
69
79
|
`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.
|
|
@@ -45,11 +45,12 @@ skills:
|
|
|
45
45
|
|
|
46
46
|
### Skill Fields
|
|
47
47
|
|
|
48
|
-
| Field | Required | Description
|
|
49
|
-
| ------------- | -------- |
|
|
50
|
-
| `display` | No | How to show in UI: `hidden`, `name`, `description`, `stream` (default: `description`) |
|
|
51
|
-
| `
|
|
52
|
-
| `
|
|
48
|
+
| Field | Required | Description |
|
|
49
|
+
| ------------- | -------- | ---------------------------------------------------------------------------------------------- |
|
|
50
|
+
| `display` | No | How to show in UI: `hidden`, `name`, `description`, `stream`, `title` (default: `description`) |
|
|
51
|
+
| `title` | No | UI label shown when `display: title` (hides the description and arguments) |
|
|
52
|
+
| `description` | No | Custom description shown to users (overrides skill's built-in description) |
|
|
53
|
+
| `execution` | No | Where the skill runs: `sandbox` (default) or `device` |
|
|
53
54
|
|
|
54
55
|
### Display Modes
|
|
55
56
|
|
|
@@ -224,12 +224,13 @@ For agentic image generation where the LLM decides when to generate, configure `
|
|
|
224
224
|
|
|
225
225
|
Every block has a `display` property:
|
|
226
226
|
|
|
227
|
-
| Mode | Default For | Behavior
|
|
228
|
-
| ------------- | ------------------------- |
|
|
229
|
-
| `hidden` | add-message | Not shown to user
|
|
230
|
-
| `name` | set-resource | Shows block name
|
|
231
|
-
| `description` | tool-call, generate-image | Shows description
|
|
232
|
-
| `stream` | next-message | Streams content
|
|
227
|
+
| Mode | Default For | Behavior |
|
|
228
|
+
| ------------- | ------------------------- | ------------------------------- |
|
|
229
|
+
| `hidden` | add-message | Not shown to user |
|
|
230
|
+
| `name` | set-resource | Shows block name |
|
|
231
|
+
| `description` | tool-call, generate-image | Shows description |
|
|
232
|
+
| `stream` | next-message | Streams content |
|
|
233
|
+
| `title` | - | Shows the block's `title` field |
|
|
233
234
|
|
|
234
235
|
## Complete Example
|
|
235
236
|
|
|
@@ -58,10 +58,11 @@ anthropic:
|
|
|
58
58
|
description: Searching... # Custom display text
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
| Field | Required | Description
|
|
62
|
-
| ------------- | -------- |
|
|
63
|
-
| `display` | No | `hidden`, `name`, `description`, or `
|
|
64
|
-
| `
|
|
61
|
+
| Field | Required | Description |
|
|
62
|
+
| ------------- | -------- | ------------------------------------------------------------------------------ |
|
|
63
|
+
| `display` | No | `hidden`, `name`, `description`, `stream`, or `title` (default: `description`) |
|
|
64
|
+
| `title` | No | UI label shown when `display: title` (hides description and arguments) |
|
|
65
|
+
| `description` | No | Custom text shown to users during execution |
|
|
65
66
|
|
|
66
67
|
### Web Search
|
|
67
68
|
|
|
@@ -120,12 +121,13 @@ anthropic:
|
|
|
120
121
|
description: Processing PDF
|
|
121
122
|
```
|
|
122
123
|
|
|
123
|
-
| Field | Required | Description
|
|
124
|
-
| ------------- | -------- |
|
|
125
|
-
| `type` | Yes | `anthropic` (built-in) or `custom` (uploaded)
|
|
126
|
-
| `version` | No | Skill version (default: `latest`)
|
|
127
|
-
| `display` | No | `hidden`, `name`, `description`, or `
|
|
128
|
-
| `
|
|
124
|
+
| Field | Required | Description |
|
|
125
|
+
| ------------- | -------- | ------------------------------------------------------------------------------ |
|
|
126
|
+
| `type` | Yes | `anthropic` (built-in) or `custom` (uploaded) |
|
|
127
|
+
| `version` | No | Skill version (default: `latest`) |
|
|
128
|
+
| `display` | No | `hidden`, `name`, `description`, `stream`, or `title` (default: `description`) |
|
|
129
|
+
| `title` | No | UI label shown when `display: title` (hides description and arguments) |
|
|
130
|
+
| `description` | No | Custom text shown to users |
|
|
129
131
|
|
|
130
132
|
### Built-in Skills
|
|
131
133
|
|
|
@@ -530,6 +530,7 @@ Controls how worker execution appears to users. The default for workers is `stre
|
|
|
530
530
|
| `name` | Shows a running/done indicator with the worker name. No nested content (text, tool calls, reasoning) is forwarded. |
|
|
531
531
|
| `description` | Shows a running/done indicator with the worker description. No nested content is forwarded. |
|
|
532
532
|
| `stream` | Full visibility. All nested events are forwarded - text, reasoning, tool calls, sources, files. Worker input is included on start. |
|
|
533
|
+
| `title` | Like `description`, but shows the worker's `title` field instead of its description. No nested content or input is forwarded. |
|
|
533
534
|
|
|
534
535
|
**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.
|
|
535
536
|
|
|
@@ -43,7 +43,8 @@ mcpServers:
|
|
|
43
43
|
| ------------- | -------- | ---------------------------------------------------------------------------------------------------------------------- |
|
|
44
44
|
| `description` | Yes | What the MCP server provides |
|
|
45
45
|
| `source` | Yes | `remote`, `device`, or `consumer` (see source types above) |
|
|
46
|
-
| `display` | No | How tool calls appear in UI: `hidden`, `name`, `description` (default: `description`)
|
|
46
|
+
| `display` | No | How tool calls appear in UI: `hidden`, `name`, `description`, `stream`, `title` (default: `description`) |
|
|
47
|
+
| `title` | No | UI label shown when `display: title`; applies to every tool in this namespace (hides description and arguments) |
|
|
47
48
|
| `connection` | No | When to connect: `eager` or `lazy` (default: `lazy`). `remote` only. |
|
|
48
49
|
| `execution` | No | Where the MCP process runs: `sandbox` (default) or `device`. `remote` only. See [Device Execution](#device-execution). |
|
|
49
50
|
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Overview
|
|
3
|
+
description: What Workforce Agents are and how to drive them programmatically.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Workforce Agents
|
|
7
|
+
|
|
8
|
+
Workforce Agents are Octavus's autonomous AI teammates - specialized agents you hire and configure in the dashboard, each with its own computer, skills, and tools. Browse and hire them at [octavus.ai/agents](https://octavus.ai/agents), and see the full roster at [octavus.ai/agents/discover](https://octavus.ai/agents/discover).
|
|
9
|
+
|
|
10
|
+
The **Workforce Agents API** lets you drive one of your agents without a browser: give it a task, wait for it to finish, and read what it did. It is built for automation - CI pipelines, scheduled jobs, and backend integrations that hand work to an agent and collect the result.
|
|
11
|
+
|
|
12
|
+
> Workforce Agents are distinct from agents you build yourself with the SDK. The [Sessions API](/docs/api-reference/sessions) drives agents you define and host; the Workforce Agents API drives the managed agents you hire and configure in the dashboard.
|
|
13
|
+
|
|
14
|
+
## How it works
|
|
15
|
+
|
|
16
|
+
A run follows a simple dispatch-then-poll model - there is no stream or webhook to manage:
|
|
17
|
+
|
|
18
|
+
1. **Dispatch** a message to an agent. This starts a **thread** (a conversation) and returns a `threadId` right away.
|
|
19
|
+
2. **Poll** the thread until its `status` is terminal.
|
|
20
|
+
3. **Read** the thread's messages to get the agent's work.
|
|
21
|
+
|
|
22
|
+
```mermaid
|
|
23
|
+
sequenceDiagram
|
|
24
|
+
participant C as Your code
|
|
25
|
+
participant A as Workforce Agent
|
|
26
|
+
C->>A: dispatch a task
|
|
27
|
+
A-->>C: threadId and status
|
|
28
|
+
loop until terminal status
|
|
29
|
+
C->>A: get thread
|
|
30
|
+
A-->>C: status and messages
|
|
31
|
+
end
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Thread status
|
|
35
|
+
|
|
36
|
+
| Status | Meaning |
|
|
37
|
+
| ----------- | ----------------------------------------------------------------------------------- |
|
|
38
|
+
| `pending` | Dispatched, waiting to start |
|
|
39
|
+
| `queued` | Waiting for the agent to free up - an agent runs one task at a time on its computer |
|
|
40
|
+
| `running` | The agent is working |
|
|
41
|
+
| `completed` | Finished successfully (terminal) |
|
|
42
|
+
| `failed` | Ended with an error - see `failureReason` (terminal) |
|
|
43
|
+
| `cancelled` | Stopped (terminal) |
|
|
44
|
+
|
|
45
|
+
Poll while the status is `pending`, `queued`, or `running`, and stop once it is `completed`, `failed`, or `cancelled`.
|
|
46
|
+
|
|
47
|
+
## Authentication
|
|
48
|
+
|
|
49
|
+
Each agent has its own **API key**, created from the agent's settings in the dashboard (Settings -> API). The key:
|
|
50
|
+
|
|
51
|
+
- Drives only that one agent - a key for one agent can never call another.
|
|
52
|
+
- Is a secret. Use it from a backend, script, or CI, never in a browser or client app.
|
|
53
|
+
- Is sent as a bearer token: `Authorization: Bearer oct_agt_...`.
|
|
54
|
+
|
|
55
|
+
Create a key, copy it once (it is shown only at creation), and store it securely.
|
|
56
|
+
|
|
57
|
+
## Next steps
|
|
58
|
+
|
|
59
|
+
- [Using the SDK](/docs/workforce-agents/sdk) - the `@octavus/server-sdk` `workforce` client, including a run-and-wait helper.
|
|
60
|
+
- [API reference](/docs/workforce-agents/api-reference) - the REST endpoints, for any language.
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Using the SDK
|
|
3
|
+
description: Drive a Workforce Agent with the @octavus/server-sdk workforce client.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Using the SDK
|
|
7
|
+
|
|
8
|
+
`@octavus/server-sdk` ships a `workforce` client for driving an agent with its per-agent key.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @octavus/server-sdk@{{VERSION:@octavus/server-sdk}}
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Set up the client
|
|
17
|
+
|
|
18
|
+
Construct `OctavusClient` with your agent's API key:
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { OctavusClient } from '@octavus/server-sdk';
|
|
22
|
+
|
|
23
|
+
const client = new OctavusClient({
|
|
24
|
+
baseUrl: 'https://octavus.ai',
|
|
25
|
+
apiKey: process.env.OCTAVUS_AGENT_KEY, // oct_agt_...
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Run a task and wait for the result
|
|
30
|
+
|
|
31
|
+
`run()` is the all-in-one method: it dispatches a message, polls until the run finishes, and returns the completed thread.
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
const thread = await client.workforce.run(agentId, 'Summarize the latest sales report');
|
|
35
|
+
|
|
36
|
+
console.log(thread.status); // 'completed' | 'failed' | 'cancelled'
|
|
37
|
+
console.log(thread.messages); // the full conversation, including the agent's reply
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The agent's latest turn is at the end of `thread.messages`.
|
|
41
|
+
|
|
42
|
+
## Dispatch and poll manually
|
|
43
|
+
|
|
44
|
+
For more control, dispatch and read the thread yourself:
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
const { threadId } = await client.workforce.dispatch(agentId, 'Research our top 3 competitors');
|
|
48
|
+
|
|
49
|
+
const thread = await client.workforce.getThread(agentId, threadId);
|
|
50
|
+
if (thread.status === 'completed') {
|
|
51
|
+
// ...
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
`waitForCompletion()` does the polling loop for you until the thread is terminal:
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
const { threadId } = await client.workforce.dispatch(agentId, 'Draft the Q3 board update');
|
|
59
|
+
const thread = await client.workforce.waitForCompletion(agentId, threadId);
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Follow up in the same thread
|
|
63
|
+
|
|
64
|
+
Continue a thread with another message. It runs after the current turn finishes.
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
await client.workforce.followUp(agentId, threadId, 'Now turn that into a slide deck');
|
|
68
|
+
const thread = await client.workforce.waitForCompletion(agentId, threadId);
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Options
|
|
72
|
+
|
|
73
|
+
`run()` and `waitForCompletion()` accept polling options. Full runs can take several minutes, so the defaults are generous.
|
|
74
|
+
|
|
75
|
+
| Option | Type | Default | Description |
|
|
76
|
+
| ---------------- | ----------- | -------- | --------------------------------------------- |
|
|
77
|
+
| `pollIntervalMs` | number | `3000` | Delay between status checks |
|
|
78
|
+
| `timeoutMs` | number | `900000` | Max time to wait before throwing (15 minutes) |
|
|
79
|
+
| `signal` | AbortSignal | - | Cancel the wait early |
|
|
80
|
+
|
|
81
|
+
`dispatch()`, `followUp()`, and `run()` also accept `files` (an array of `FileReference`) to attach hosted files to the message.
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
const thread = await client.workforce.run(agentId, 'Review this spec', {
|
|
85
|
+
timeoutMs: 30 * 60 * 1000, // 30 minutes
|
|
86
|
+
pollIntervalMs: 5000,
|
|
87
|
+
});
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
If the timeout elapses first, `waitForCompletion()` and `run()` throw. The run keeps going on the server, so you can read it later with `getThread()`.
|
|
91
|
+
|
|
92
|
+
## Result shape
|
|
93
|
+
|
|
94
|
+
`getThread()`, `waitForCompletion()`, and `run()` return a thread:
|
|
95
|
+
|
|
96
|
+
| Field | Type | Description |
|
|
97
|
+
| --------------- | -------------- | -------------------------------------------------------------------------------------------------------------- |
|
|
98
|
+
| `threadId` | string | The thread identifier |
|
|
99
|
+
| `status` | string | `idle`, `queued`, `pending`, `running`, `completed`, `failed`, or `cancelled` |
|
|
100
|
+
| `failureReason` | string \| null | Why the run failed, when `status` is `failed` |
|
|
101
|
+
| `messages` | UIMessage[] | The conversation - text, tool and skill steps, and files (see [UIMessage parts](/docs/api-reference/sessions)) |
|
|
102
|
+
|
|
103
|
+
Use `isTerminalThreadStatus(status)` to check whether a run has finished.
|
|
104
|
+
|
|
105
|
+
The same operations are available as plain HTTP - see the [API reference](/docs/workforce-agents/api-reference).
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: API Reference
|
|
3
|
+
description: REST endpoints for the Workforce Agents API.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Workforce Agents API
|
|
7
|
+
|
|
8
|
+
Drive a single agent over HTTP. Every request is authenticated with that agent's API key, sent as a bearer token:
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
Authorization: Bearer oct_agt_...
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
All endpoints are scoped to one agent through the `{agentId}` path segment - find the agent ID in the agent's page URL in the dashboard. A key only works for the agent it was created for.
|
|
15
|
+
|
|
16
|
+
## Start a thread
|
|
17
|
+
|
|
18
|
+
Dispatch a message to the agent. This starts a new thread and returns immediately.
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
POST /api/v1/workforce/agents/{agentId}/threads
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Request Body
|
|
25
|
+
|
|
26
|
+
```json
|
|
27
|
+
{
|
|
28
|
+
"message": "Summarize the latest sales report"
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
| Field | Type | Required | Description |
|
|
33
|
+
| --------- | --------------- | -------- | --------------------------------- |
|
|
34
|
+
| `message` | string | Yes | The task or message for the agent |
|
|
35
|
+
| `files` | FileReference[] | No | Hosted file attachments |
|
|
36
|
+
|
|
37
|
+
### Response
|
|
38
|
+
|
|
39
|
+
Returns `201`.
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"threadId": "cm5xyz123abc456def",
|
|
44
|
+
"status": "pending"
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Poll the [Get a thread](#get-a-thread) endpoint until the status is terminal.
|
|
49
|
+
|
|
50
|
+
### Example
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
curl -X POST https://octavus.ai/api/v1/workforce/agents/AGENT_ID/threads \
|
|
54
|
+
-H "Authorization: Bearer oct_agt_..." \
|
|
55
|
+
-H "Content-Type: application/json" \
|
|
56
|
+
-d '{ "message": "Summarize the latest sales report" }'
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Get a thread
|
|
60
|
+
|
|
61
|
+
Read a thread's status and messages. Poll this until the run finishes.
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
GET /api/v1/workforce/agents/{agentId}/threads/{threadId}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Response
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"threadId": "cm5xyz123abc456def",
|
|
72
|
+
"status": "completed",
|
|
73
|
+
"failureReason": null,
|
|
74
|
+
"messages": []
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
| Field | Type | Description |
|
|
79
|
+
| --------------- | -------------- | ----------------------------------------------------------------------------- |
|
|
80
|
+
| `threadId` | string | The thread identifier |
|
|
81
|
+
| `status` | string | `idle`, `queued`, `pending`, `running`, `completed`, `failed`, or `cancelled` |
|
|
82
|
+
| `failureReason` | string \| null | Why the run failed, when `status` is `failed` |
|
|
83
|
+
| `messages` | UIMessage[] | The conversation - see [UIMessage parts](/docs/api-reference/sessions) |
|
|
84
|
+
|
|
85
|
+
Keep polling while the status is `pending`, `queued`, or `running`. Stop when it is `completed`, `failed`, or `cancelled`.
|
|
86
|
+
|
|
87
|
+
### Example
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
curl https://octavus.ai/api/v1/workforce/agents/AGENT_ID/threads/THREAD_ID \
|
|
91
|
+
-H "Authorization: Bearer oct_agt_..."
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Follow up in a thread
|
|
95
|
+
|
|
96
|
+
Send another message into an existing thread. If the agent is still working the message runs after the current turn finishes; otherwise it starts immediately.
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
POST /api/v1/workforce/agents/{agentId}/threads/{threadId}/messages
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Request Body
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"message": "Now turn that into a slide deck"
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
| Field | Type | Required | Description |
|
|
111
|
+
| --------- | --------------- | -------- | ----------------------- |
|
|
112
|
+
| `message` | string | Yes | The follow-up message |
|
|
113
|
+
| `files` | FileReference[] | No | Hosted file attachments |
|
|
114
|
+
|
|
115
|
+
### Response
|
|
116
|
+
|
|
117
|
+
Returns `202`.
|
|
118
|
+
|
|
119
|
+
```json
|
|
120
|
+
{
|
|
121
|
+
"threadId": "cm5xyz123abc456def",
|
|
122
|
+
"status": "running"
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Poll [Get a thread](#get-a-thread) for the new run's result.
|
|
127
|
+
|
|
128
|
+
### Example
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
curl -X POST https://octavus.ai/api/v1/workforce/agents/AGENT_ID/threads/THREAD_ID/messages \
|
|
132
|
+
-H "Authorization: Bearer oct_agt_..." \
|
|
133
|
+
-H "Content-Type: application/json" \
|
|
134
|
+
-d '{ "message": "Now turn that into a slide deck" }'
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Errors
|
|
138
|
+
|
|
139
|
+
Errors return `{ "error": string, "code": string }` with an HTTP status:
|
|
140
|
+
|
|
141
|
+
| Status | Meaning |
|
|
142
|
+
| ------ | ------------------------------------------------- |
|
|
143
|
+
| `401` | Missing or invalid API key |
|
|
144
|
+
| `402` | The agent is blocked by a usage or spending limit |
|
|
145
|
+
| `403` | The key is not authorized for this agent |
|
|
146
|
+
| `404` | The thread does not exist for this agent |
|