@databricks/appkit-ui 0.48.0 → 0.49.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/CLAUDE.md +11 -1
- package/docs/api/appkit/Class.DatabricksAdapter.md +34 -0
- package/docs/api/appkit/Class.SupervisorApiAdapter.md +121 -0
- package/docs/api/appkit/Function.fromSupervisorApi.md +63 -0
- package/docs/api/appkit/Function.isSupervisorTool.md +18 -0
- package/docs/api/appkit/Interface.AgentAdapter.md +24 -0
- package/docs/api/appkit/Interface.AgentInput.md +13 -0
- package/docs/api/appkit/Interface.HostedSupervisorTool.md +21 -0
- package/docs/api/appkit/Interface.SupervisorApiAdapterOptions.md +38 -0
- package/docs/api/appkit/Interface.SupervisorExtension.md +12 -0
- package/docs/api/appkit/Interface.WorkspaceClientLike.md +67 -0
- package/docs/api/appkit/TypeAlias.AgentTool.md +3 -2
- package/docs/api/appkit/TypeAlias.ResolvedToolEntry.md +167 -0
- package/docs/api/appkit/TypeAlias.SupervisorTool.md +45 -0
- package/docs/api/appkit/Variable.SUPERVISOR_EXTENSION_KEY.md +8 -0
- package/docs/api/appkit/Variable.supervisorTools.md +176 -0
- package/docs/api/appkit.md +118 -108
- package/docs/plugins/agents.md +131 -1
- package/llms.txt +11 -1
- package/package.json +1 -1
- package/sbom.cdx.json +1 -1
package/CLAUDE.md
CHANGED
|
@@ -74,6 +74,7 @@ npx @databricks/appkit docs <query>
|
|
|
74
74
|
- [Class: PolicyDeniedError](./docs/api/appkit/Class.PolicyDeniedError.md): Thrown when a policy denies an action.
|
|
75
75
|
- [Class: ResourceRegistry](./docs/api/appkit/Class.ResourceRegistry.md): Central registry for tracking plugin resource requirements.
|
|
76
76
|
- [Class: ServerError](./docs/api/appkit/Class.ServerError.md): Error thrown when server lifecycle operations fail.
|
|
77
|
+
- [Class: SupervisorApiAdapter](./docs/api/appkit/Class.SupervisorApiAdapter.md): Adapter that calls the Databricks AI Gateway Responses API
|
|
77
78
|
- [Class: TunnelError](./docs/api/appkit/Class.TunnelError.md): Error thrown when remote tunnel operations fail.
|
|
78
79
|
- [Class: ValidationError](./docs/api/appkit/Class.ValidationError.md): Error thrown when input validation fails.
|
|
79
80
|
- [Enumeration: RequestedClaimsPermissionSet](./docs/api/appkit/Enumeration.RequestedClaimsPermissionSet.md): Permission set for Unity Catalog table access
|
|
@@ -89,6 +90,7 @@ npx @databricks/appkit docs <query>
|
|
|
89
90
|
- [Function: executeFromRegistry()](./docs/api/appkit/Function.executeFromRegistry.md): Validates tool-call arguments against the entry's schema and invokes its
|
|
90
91
|
- [Function: extractServingEndpoints()](./docs/api/appkit/Function.extractServingEndpoints.md): Extract serving endpoint config from a server file by AST-parsing it.
|
|
91
92
|
- [Function: findServerFile()](./docs/api/appkit/Function.findServerFile.md): Find the server entry file by checking candidate paths in order.
|
|
93
|
+
- [Function: fromSupervisorApi()](./docs/api/appkit/Function.fromSupervisorApi.md): Creates an AgentAdapter backed by the Databricks AI Gateway
|
|
92
94
|
- [Function: functionToolToDefinition()](./docs/api/appkit/Function.functionToolToDefinition.md): Parameters
|
|
93
95
|
- [Function: generateDatabaseCredential()](./docs/api/appkit/Function.generateDatabaseCredential.md): Generate OAuth credentials for Postgres database connection using the proper Postgres API.
|
|
94
96
|
- [Function: getExecutionContext()](./docs/api/appkit/Function.getExecutionContext.md): Get the current execution context.
|
|
@@ -101,6 +103,7 @@ npx @databricks/appkit docs <query>
|
|
|
101
103
|
- [Function: isFunctionTool()](./docs/api/appkit/Function.isFunctionTool.md): Parameters
|
|
102
104
|
- [Function: isHostedTool()](./docs/api/appkit/Function.isHostedTool.md): Parameters
|
|
103
105
|
- [Function: isSQLTypeMarker()](./docs/api/appkit/Function.isSQLTypeMarker.md): Type guard to check if a value is a SQL type marker
|
|
106
|
+
- [Function: isSupervisorTool()](./docs/api/appkit/Function.isSupervisorTool.md): Type guard for HostedSupervisorTool. Used by the agents plugin
|
|
104
107
|
- [Function: isToolkitEntry()](./docs/api/appkit/Function.isToolkitEntry.md): Type guard for ToolkitEntry — used by the agents plugin to differentiate
|
|
105
108
|
- [Function: loadAgentFromFile()](./docs/api/appkit/Function.loadAgentFromFile.md): Loads a single markdown agent file and resolves its frontmatter against
|
|
106
109
|
- [Function: loadAgentsFromDir()](./docs/api/appkit/Function.loadAgentsFromDir.md): Scans a directory for one subdirectory per agent, each containing
|
|
@@ -110,7 +113,7 @@ npx @databricks/appkit docs <query>
|
|
|
110
113
|
- [Function: runAgent()](./docs/api/appkit/Function.runAgent.md): Standalone agent execution without createApp. Resolves the adapter, binds
|
|
111
114
|
- [Function: tool()](./docs/api/appkit/Function.tool.md): Factory for defining function tools with Zod schemas.
|
|
112
115
|
- [Function: toolsFromRegistry()](./docs/api/appkit/Function.toolsFromRegistry.md): Produces the AgentToolDefinition[] a ToolProvider exposes to the LLM,
|
|
113
|
-
- [Interface: AgentAdapter](./docs/api/appkit/Interface.AgentAdapter.md):
|
|
116
|
+
- [Interface: AgentAdapter](./docs/api/appkit/Interface.AgentAdapter.md): Properties
|
|
114
117
|
- [Interface: AgentDefinition](./docs/api/appkit/Interface.AgentDefinition.md): Properties
|
|
115
118
|
- [Interface: AgentInput](./docs/api/appkit/Interface.AgentInput.md): Properties
|
|
116
119
|
- [Interface: AgentRunContext](./docs/api/appkit/Interface.AgentRunContext.md): Properties
|
|
@@ -126,6 +129,7 @@ npx @databricks/appkit docs <query>
|
|
|
126
129
|
- [Interface: FunctionTool](./docs/api/appkit/Interface.FunctionTool.md): Properties
|
|
127
130
|
- [Interface: GenerateDatabaseCredentialRequest](./docs/api/appkit/Interface.GenerateDatabaseCredentialRequest.md): Request parameters for generating database OAuth credentials
|
|
128
131
|
- [Interface: GenerationParams](./docs/api/appkit/Interface.GenerationParams.md): Optional generation parameters forwarded to the OpenAI-compatible serving
|
|
132
|
+
- [Interface: HostedSupervisorTool](./docs/api/appkit/Interface.HostedSupervisorTool.md): Tagged record returned by every supervisorTools factory. The
|
|
129
133
|
- [Interface: IJobsConfig](./docs/api/appkit/Interface.IJobsConfig.md): Configuration for the Jobs plugin.
|
|
130
134
|
- [Interface: ITelemetry](./docs/api/appkit/Interface.ITelemetry.md): Plugin-facing interface for OpenTelemetry instrumentation.
|
|
131
135
|
- [Interface: JobAPI](./docs/api/appkit/Interface.JobAPI.md): User-facing API for a single configured job.
|
|
@@ -149,6 +153,8 @@ npx @databricks/appkit docs <query>
|
|
|
149
153
|
- [Interface: ServingEndpointEntry](./docs/api/appkit/Interface.ServingEndpointEntry.md): Shape of a single registry entry.
|
|
150
154
|
- [Interface: ServingEndpointRegistry](./docs/api/appkit/Interface.ServingEndpointRegistry.md): Registry interface for serving endpoint type generation.
|
|
151
155
|
- [Interface: StreamExecutionSettings](./docs/api/appkit/Interface.StreamExecutionSettings.md): Execution settings for streaming endpoints. Extends PluginExecutionSettings with SSE stream configuration.
|
|
156
|
+
- [Interface: SupervisorApiAdapterOptions](./docs/api/appkit/Interface.SupervisorApiAdapterOptions.md): Properties
|
|
157
|
+
- [Interface: SupervisorExtension](./docs/api/appkit/Interface.SupervisorExtension.md): Shape of the value at AgentInput.extensions[SUPERVISOREXTENSIONKEY].
|
|
152
158
|
- [Interface: TelemetryConfig](./docs/api/appkit/Interface.TelemetryConfig.md): OpenTelemetry configuration for AppKit applications
|
|
153
159
|
- [Interface: Thread](./docs/api/appkit/Interface.Thread.md): Properties
|
|
154
160
|
- [Interface: ThreadStore](./docs/api/appkit/Interface.ThreadStore.md): Methods
|
|
@@ -159,6 +165,7 @@ npx @databricks/appkit docs <query>
|
|
|
159
165
|
- [Interface: ToolkitOptions](./docs/api/appkit/Interface.ToolkitOptions.md): Properties
|
|
160
166
|
- [Interface: ToolProvider](./docs/api/appkit/Interface.ToolProvider.md): Methods
|
|
161
167
|
- [Interface: ValidationResult](./docs/api/appkit/Interface.ValidationResult.md): Result of validating all registered resources against the environment.
|
|
168
|
+
- [Interface: WorkspaceClientLike](./docs/api/appkit/Interface.WorkspaceClientLike.md): Structural shape of a Databricks SDK client used by fromSupervisorApi.
|
|
162
169
|
- [Type Alias: AgentEvent](./docs/api/appkit/TypeAlias.AgentEvent.md): Type Declaration
|
|
163
170
|
- [Type Alias: AgentTool](./docs/api/appkit/TypeAlias.AgentTool.md): Any tool an agent can invoke: inline function tools (tool()), hosted MCP
|
|
164
171
|
- [Type Alias: AgentTools](./docs/api/appkit/TypeAlias.AgentTools.md): Per-agent tool record. String keys map to inline tools, toolkit entries,
|
|
@@ -178,11 +185,14 @@ npx @databricks/appkit docs <query>
|
|
|
178
185
|
- [Type Alias: ResourceFieldEntry](./docs/api/appkit/TypeAlias.ResourceFieldEntry.md)
|
|
179
186
|
- [Type Alias: ResourcePermission](./docs/api/appkit/TypeAlias.ResourcePermission.md): Union of all possible permission levels across all resource types.
|
|
180
187
|
- [Type Alias: ServingFactory](./docs/api/appkit/TypeAlias.ServingFactory.md): Factory function returned by AppKit.serving.
|
|
188
|
+
- [Type Alias: SupervisorTool](./docs/api/appkit/TypeAlias.SupervisorTool.md): Tools supported by the Databricks AI Gateway Responses API. The shapes match
|
|
181
189
|
- [Type Alias: ToolRegistry](./docs/api/appkit/TypeAlias.ToolRegistry.md)
|
|
182
190
|
- [Type Alias: ToPlugin()<T, U, N>](./docs/api/appkit/TypeAlias.ToPlugin.md): Factory function type returned by toPlugin(). Accepts optional config and returns a PluginData tuple.
|
|
183
191
|
- [Variable: agents](./docs/api/appkit/Variable.agents.md): Plugin factory for the agents plugin. Reads config/agents/*.md by default,
|
|
184
192
|
- [Variable: READ_ACTIONS](./docs/api/appkit/Variable.READ_ACTIONS.md): Actions that only read data.
|
|
185
193
|
- [Variable: sql](./docs/api/appkit/Variable.sql.md): SQL helper namespace
|
|
194
|
+
- [Variable: SUPERVISOR_EXTENSION_KEY](./docs/api/appkit/Variable.SUPERVISOR_EXTENSION_KEY.md): Namespace key under which the adapter reads its hosted-tool payload
|
|
195
|
+
- [Variable: supervisorTools](./docs/api/appkit/Variable.supervisorTools.md): Concise factories for declaring Supervisor API tools.
|
|
186
196
|
- [Variable: WRITE_ACTIONS](./docs/api/appkit/Variable.WRITE_ACTIONS.md): Actions that mutate data.
|
|
187
197
|
|
|
188
198
|
## appkit-ui API reference [collapsed]
|
|
@@ -149,3 +149,37 @@ Routes through the shared `connectors/serving/stream` helper, which delegates to
|
|
|
149
149
|
#### Returns[](#returns-3 "Direct link to Returns")
|
|
150
150
|
|
|
151
151
|
`Promise`<`DatabricksAdapter`>
|
|
152
|
+
|
|
153
|
+
***
|
|
154
|
+
|
|
155
|
+
### fromSupervisorApi()[](#fromsupervisorapi "Direct link to fromSupervisorApi()")
|
|
156
|
+
|
|
157
|
+
```ts
|
|
158
|
+
static fromSupervisorApi(options: SupervisorApiAdapterOptions): Promise<AgentAdapter>;
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Discoverability shim for the Supervisor API adapter. Returns an [AgentAdapter](./docs/api/appkit/Interface.AgentAdapter.md) (a `SupervisorApiAdapter` at runtime), NOT a DatabricksAdapter — the two are separate classes (different wire formats, different lifecycle). The return type is the [AgentAdapter](./docs/api/appkit/Interface.AgentAdapter.md) interface so callers aren't bound to the concrete class. Surfaced here so application developers see a single `DatabricksAdapter.from*` autocomplete root.
|
|
163
|
+
|
|
164
|
+
Dynamic-imports `./supervisor-api` to avoid forming a load-time cycle: both files share `connectors/serving/client.ts`.
|
|
165
|
+
|
|
166
|
+
#### Parameters[](#parameters-4 "Direct link to Parameters")
|
|
167
|
+
|
|
168
|
+
| Parameter | Type |
|
|
169
|
+
| --------- | ------------------------------------------------------------------------------------------------- |
|
|
170
|
+
| `options` | [`SupervisorApiAdapterOptions`](./docs/api/appkit/Interface.SupervisorApiAdapterOptions.md) |
|
|
171
|
+
|
|
172
|
+
#### Returns[](#returns-4 "Direct link to Returns")
|
|
173
|
+
|
|
174
|
+
`Promise`<[`AgentAdapter`](./docs/api/appkit/Interface.AgentAdapter.md)>
|
|
175
|
+
|
|
176
|
+
#### Example[](#example-1 "Direct link to Example")
|
|
177
|
+
|
|
178
|
+
```ts
|
|
179
|
+
import { DatabricksAdapter } from "@databricks/appkit/beta";
|
|
180
|
+
|
|
181
|
+
const model = await DatabricksAdapter.fromSupervisorApi({
|
|
182
|
+
model: "databricks-claude-sonnet-4-5",
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
```
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# Class: SupervisorApiAdapter
|
|
2
|
+
|
|
3
|
+
Adapter that calls the Databricks AI Gateway Responses API (`/ai-gateway/mlflow/v1/responses`).
|
|
4
|
+
|
|
5
|
+
Streams SSE events in the OpenAI Responses API wire format and maps them to the AppKit `AgentEvent` protocol. Tool execution is handled server-side, so the adapter ignores the agents-plugin tool index.
|
|
6
|
+
|
|
7
|
+
Authentication is handled via the Databricks SDK credential chain — the same mechanism used by `DatabricksAdapter.fromModelServing`. The transport is injected via SupervisorApiAdapterCtorOptions.streamBody; the [fromSupervisorApi](./docs/api/appkit/Function.fromSupervisorApi.md) factory wires it through the SDK's `apiClient.request({ raw: true })`.
|
|
8
|
+
|
|
9
|
+
Set `DEBUG=appkit:agents:supervisor-api` to log the outbound request shape (model, instructions length, input shape, tool count) and to be notified when the recovery path engages (no incremental deltas, text pulled from `response.completed.output[]`). The no-delta warning includes a per-turn event-type histogram and the SA-reported status/error/ incomplete\_details, so it's already actionable without DEBUG.
|
|
10
|
+
|
|
11
|
+
Tools are not configured on the adapter. Declare them via `createAgent({ tools: () => ({ key: supervisorTools.genieSpace({...}) }) })` (or markdown frontmatter referencing an ambient `supervisorTools.*` entry); the agents plugin / standalone `runAgent` aggregates hosted-supervisor entries and routes them to the adapter via `AgentInput.extensions[SUPERVISOR_EXTENSION_KEY]`. Advanced callers invoking `adapter.run(...)` directly populate that key themselves.
|
|
12
|
+
|
|
13
|
+
## Example[](#example "Direct link to Example")
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { createApp, createAgent } from "@databricks/appkit";
|
|
17
|
+
import {
|
|
18
|
+
agents,
|
|
19
|
+
DatabricksAdapter,
|
|
20
|
+
supervisorTools,
|
|
21
|
+
} from "@databricks/appkit/beta";
|
|
22
|
+
|
|
23
|
+
await createApp({
|
|
24
|
+
plugins: [
|
|
25
|
+
agents({
|
|
26
|
+
agents: {
|
|
27
|
+
assistant: createAgent({
|
|
28
|
+
instructions: "You are a helpful assistant.",
|
|
29
|
+
model: DatabricksAdapter.fromSupervisorApi({
|
|
30
|
+
model: "databricks-claude-sonnet-4",
|
|
31
|
+
}),
|
|
32
|
+
tools: () => ({
|
|
33
|
+
nyc: supervisorTools.genieSpace({
|
|
34
|
+
id: "01ABCDEF12345678",
|
|
35
|
+
description: "NYC taxi trip records and zones",
|
|
36
|
+
}),
|
|
37
|
+
}),
|
|
38
|
+
}),
|
|
39
|
+
},
|
|
40
|
+
}),
|
|
41
|
+
],
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Implements[](#implements "Direct link to Implements")
|
|
47
|
+
|
|
48
|
+
* [`AgentAdapter`](./docs/api/appkit/Interface.AgentAdapter.md)
|
|
49
|
+
|
|
50
|
+
## Constructors[](#constructors "Direct link to Constructors")
|
|
51
|
+
|
|
52
|
+
### Constructor[](#constructor "Direct link to Constructor")
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
new SupervisorApiAdapter(options: SupervisorApiAdapterCtorOptions): SupervisorApiAdapter;
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
#### Parameters[](#parameters "Direct link to Parameters")
|
|
60
|
+
|
|
61
|
+
| Parameter | Type |
|
|
62
|
+
| --------- | --------------------------------- |
|
|
63
|
+
| `options` | `SupervisorApiAdapterCtorOptions` |
|
|
64
|
+
|
|
65
|
+
#### Returns[](#returns "Direct link to Returns")
|
|
66
|
+
|
|
67
|
+
`SupervisorApiAdapter`
|
|
68
|
+
|
|
69
|
+
## Properties[](#properties "Direct link to Properties")
|
|
70
|
+
|
|
71
|
+
### acceptsExtensions[](#acceptsextensions "Direct link to acceptsExtensions")
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
readonly acceptsExtensions: readonly ["databricks.supervisor"];
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Capability negotiation: the adapter reads its hosted-tool payload from [AgentInput.extensions](./docs/api/appkit/Interface.AgentInput.md#extensions) under [SUPERVISOR\_EXTENSION\_KEY](./docs/api/appkit/Variable.SUPERVISOR_EXTENSION_KEY.md). The agents plugin uses this list to warn at registration when the tool index produces extensions the adapter wouldn't consume.
|
|
79
|
+
|
|
80
|
+
#### Implementation of[](#implementation-of "Direct link to Implementation of")
|
|
81
|
+
|
|
82
|
+
[`AgentAdapter`](./docs/api/appkit/Interface.AgentAdapter.md).[`acceptsExtensions`](./docs/api/appkit/Interface.AgentAdapter.md#acceptsextensions)
|
|
83
|
+
|
|
84
|
+
***
|
|
85
|
+
|
|
86
|
+
### consumesInputTools[](#consumesinputtools "Direct link to consumesInputTools")
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
readonly consumesInputTools: false = false;
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Capability negotiation: the adapter does not consume `input.tools`. Tool execution is owned by the Databricks AI Gateway server-side, so any function tools or local sub-agents declared on this agent would be silently dropped — the agents plugin warns at registration when that combination is detected.
|
|
94
|
+
|
|
95
|
+
#### Implementation of[](#implementation-of-1 "Direct link to Implementation of")
|
|
96
|
+
|
|
97
|
+
[`AgentAdapter`](./docs/api/appkit/Interface.AgentAdapter.md).[`consumesInputTools`](./docs/api/appkit/Interface.AgentAdapter.md#consumesinputtools)
|
|
98
|
+
|
|
99
|
+
## Methods[](#methods "Direct link to Methods")
|
|
100
|
+
|
|
101
|
+
### run()[](#run "Direct link to run()")
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
run(input: AgentInput, context: AgentRunContext): AsyncGenerator<AgentEvent, void, unknown>;
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
#### Parameters[](#parameters-1 "Direct link to Parameters")
|
|
109
|
+
|
|
110
|
+
| Parameter | Type |
|
|
111
|
+
| --------- | ------------------------------------------------------------------------- |
|
|
112
|
+
| `input` | [`AgentInput`](./docs/api/appkit/Interface.AgentInput.md) |
|
|
113
|
+
| `context` | [`AgentRunContext`](./docs/api/appkit/Interface.AgentRunContext.md) |
|
|
114
|
+
|
|
115
|
+
#### Returns[](#returns-1 "Direct link to Returns")
|
|
116
|
+
|
|
117
|
+
`AsyncGenerator`<[`AgentEvent`](./docs/api/appkit/TypeAlias.AgentEvent.md), `void`, `unknown`>
|
|
118
|
+
|
|
119
|
+
#### Implementation of[](#implementation-of-2 "Direct link to Implementation of")
|
|
120
|
+
|
|
121
|
+
[`AgentAdapter`](./docs/api/appkit/Interface.AgentAdapter.md).[`run`](./docs/api/appkit/Interface.AgentAdapter.md#run)
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Function: fromSupervisorApi()
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
function fromSupervisorApi(options: SupervisorApiAdapterOptions): Promise<AgentAdapter>;
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
Creates an [AgentAdapter](./docs/api/appkit/Interface.AgentAdapter.md) backed by the Databricks AI Gateway Responses API (`/ai-gateway/mlflow/v1/responses`).
|
|
9
|
+
|
|
10
|
+
Uses the SDK's default credential chain for auth (reads DATABRICKS\_HOST, DATABRICKS\_TOKEN, OAuth config, etc.). Tools are declared on the agent (via `createAgent({ tools })`), not on this factory.
|
|
11
|
+
|
|
12
|
+
Application code should prefer the [DatabricksAdapter.fromSupervisorApi](./docs/api/appkit/Class.DatabricksAdapter.md#fromsupervisorapi) static — it delegates here and keeps a single `DatabricksAdapter.from*` autocomplete root for all Databricks-backed adapters. This free function is the implementation behind the static and remains exported for callers that want to import it directly without pulling in [DatabricksAdapter](./docs/api/appkit/Class.DatabricksAdapter.md).
|
|
13
|
+
|
|
14
|
+
## Parameters[](#parameters "Direct link to Parameters")
|
|
15
|
+
|
|
16
|
+
| Parameter | Type |
|
|
17
|
+
| --------- | ------------------------------------------------------------------------------------------------- |
|
|
18
|
+
| `options` | [`SupervisorApiAdapterOptions`](./docs/api/appkit/Interface.SupervisorApiAdapterOptions.md) |
|
|
19
|
+
|
|
20
|
+
## Returns[](#returns "Direct link to Returns")
|
|
21
|
+
|
|
22
|
+
`Promise`<[`AgentAdapter`](./docs/api/appkit/Interface.AgentAdapter.md)>
|
|
23
|
+
|
|
24
|
+
## Example[](#example "Direct link to Example")
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { createApp, createAgent } from "@databricks/appkit";
|
|
28
|
+
import {
|
|
29
|
+
agents,
|
|
30
|
+
DatabricksAdapter,
|
|
31
|
+
supervisorTools,
|
|
32
|
+
} from "@databricks/appkit/beta";
|
|
33
|
+
|
|
34
|
+
await createApp({
|
|
35
|
+
plugins: [
|
|
36
|
+
agents({
|
|
37
|
+
agents: {
|
|
38
|
+
assistant: createAgent({
|
|
39
|
+
instructions: "You are a helpful assistant.",
|
|
40
|
+
model: DatabricksAdapter.fromSupervisorApi({
|
|
41
|
+
model: "databricks-claude-sonnet-4",
|
|
42
|
+
}),
|
|
43
|
+
tools: () => ({
|
|
44
|
+
nyc: supervisorTools.genieSpace({
|
|
45
|
+
id: "01ABCDEF12345678",
|
|
46
|
+
description: "NYC taxi trip records and zones",
|
|
47
|
+
}),
|
|
48
|
+
}),
|
|
49
|
+
}),
|
|
50
|
+
},
|
|
51
|
+
}),
|
|
52
|
+
],
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Remarks[](#remarks "Direct link to Remarks")
|
|
58
|
+
|
|
59
|
+
⚠ When passing your own `workspaceClient`, see the warning on [SupervisorApiAdapterOptions.workspaceClient](./docs/api/appkit/Interface.SupervisorApiAdapterOptions.md#workspaceclient) — the client is captured once and reused, so per-request OBO clients would leak identity across requests.
|
|
60
|
+
|
|
61
|
+
## See[](#see "Direct link to See")
|
|
62
|
+
|
|
63
|
+
[DatabricksAdapter.fromSupervisorApi](./docs/api/appkit/Class.DatabricksAdapter.md#fromsupervisorapi) — the recommended application-facing entry point.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Function: isSupervisorTool()
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
function isSupervisorTool(value: unknown): value is HostedSupervisorTool;
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
Type guard for [HostedSupervisorTool](./docs/api/appkit/Interface.HostedSupervisorTool.md). Used by the agents plugin (`buildToolIndex`) and standalone `runAgent` (`classifyTool`) to route supervisor-hosted tools to the extensions payload rather than the adapter's `tools` array.
|
|
9
|
+
|
|
10
|
+
## Parameters[](#parameters "Direct link to Parameters")
|
|
11
|
+
|
|
12
|
+
| Parameter | Type |
|
|
13
|
+
| --------- | --------- |
|
|
14
|
+
| `value` | `unknown` |
|
|
15
|
+
|
|
16
|
+
## Returns[](#returns "Direct link to Returns")
|
|
17
|
+
|
|
18
|
+
`value is HostedSupervisorTool`
|
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Interface: AgentAdapter
|
|
2
2
|
|
|
3
|
+
## Properties[](#properties "Direct link to Properties")
|
|
4
|
+
|
|
5
|
+
### acceptsExtensions?[](#acceptsextensions "Direct link to acceptsExtensions?")
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
readonly optional acceptsExtensions: readonly string[];
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Extension keys this adapter consumes from [AgentInput.extensions](./docs/api/appkit/Interface.AgentInput.md#extensions). The agents plugin (and standalone `runAgent`) warns at registration if the tool index produces extensions whose keys aren't listed here.
|
|
13
|
+
|
|
14
|
+
Adapters that don't read extensions can omit this field.
|
|
15
|
+
|
|
16
|
+
***
|
|
17
|
+
|
|
18
|
+
### consumesInputTools?[](#consumesinputtools "Direct link to consumesInputTools?")
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
readonly optional consumesInputTools: boolean;
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Whether the adapter consumes tools from `input.tools`. Defaults to true. Adapters whose tool execution happens elsewhere (e.g. the Supervisor API, where SA owns the tool loop server-side) declare false; the agents plugin warns at registration if the agent declares function tools or local sub-agents alongside such an adapter, since those tools would never reach the model.
|
|
26
|
+
|
|
3
27
|
## Methods[](#methods "Direct link to Methods")
|
|
4
28
|
|
|
5
29
|
### run()[](#run "Direct link to run()")
|
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
## Properties[](#properties "Direct link to Properties")
|
|
4
4
|
|
|
5
|
+
### extensions?[](#extensions "Direct link to extensions?")
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
optional extensions: Readonly<Record<string, unknown>>;
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Adapter-specific opaque payloads, keyed by adapter namespace. The shared contract intentionally does not enumerate keys — see each adapter's docs for which keys it reads and the shape of each value.
|
|
13
|
+
|
|
14
|
+
The agents plugin and standalone `runAgent` populate this from the agent's tool index when entries declare an adapter-side spec (e.g. Supervisor API hosted tools). Adapters that don't read extensions should leave it untouched.
|
|
15
|
+
|
|
16
|
+
***
|
|
17
|
+
|
|
5
18
|
### messages[](#messages "Direct link to messages")
|
|
6
19
|
|
|
7
20
|
```ts
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Interface: HostedSupervisorTool
|
|
2
|
+
|
|
3
|
+
Tagged record returned by every [supervisorTools](./docs/api/appkit/Variable.supervisorTools.md) factory. The `__kind` discriminator lets the agents plugin (and standalone `runAgent`) classify these tools without a structural match against the wire format — keeps the SA wire shape free to evolve and avoids namespace collisions with MCP hosted tools (which use `type: "genie-space"` hyphenated, vs SA's `type: "genie_space"` underscored).
|
|
4
|
+
|
|
5
|
+
## Properties[](#properties "Direct link to Properties")
|
|
6
|
+
|
|
7
|
+
### \_\_kind[](#__kind "Direct link to __kind")
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
readonly __kind: "hosted-supervisor";
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
***
|
|
15
|
+
|
|
16
|
+
### spec[](#spec "Direct link to spec")
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
readonly spec: SupervisorTool;
|
|
20
|
+
|
|
21
|
+
```
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Interface: SupervisorApiAdapterOptions
|
|
2
|
+
|
|
3
|
+
## Properties[](#properties "Direct link to Properties")
|
|
4
|
+
|
|
5
|
+
### model[](#model "Direct link to model")
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
model: string;
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Model identifier to pass in the request body (e.g. "databricks-claude-sonnet-4").
|
|
13
|
+
|
|
14
|
+
***
|
|
15
|
+
|
|
16
|
+
### timeoutMs?[](#timeoutms "Direct link to timeoutMs?")
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
optional timeoutMs: number;
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Total wall-clock budget (ms) for a single `run()`. When the SSE stream runs longer than this — e.g. an upstream that stalls without closing — the adapter aborts it and emits a terminal `transport` error rather than hanging the request indefinitely.
|
|
24
|
+
|
|
25
|
+
This is a total-duration cap, not an idle cap. Defaults to 5 minutes, generous enough for multi-tool server-side orchestration.
|
|
26
|
+
|
|
27
|
+
***
|
|
28
|
+
|
|
29
|
+
### workspaceClient?[](#workspaceclient "Direct link to workspaceClient?")
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
optional workspaceClient: WorkspaceClientLike;
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
A WorkspaceClient (or structural equivalent) used for host resolution and per-request authentication. When omitted, a `WorkspaceClient({})` is created internally using the default SDK credential chain (`DATABRICKS_HOST`, OAuth, PAT, etc.).
|
|
37
|
+
|
|
38
|
+
⚠ The `workspaceClient` is captured at construction and reused across every request. Passing a per-request OBO (On-Behalf-Of) client here would silently leak the first request's identity into all subsequent requests served by this adapter instance. Use the default credential chain or pass a service-principal client. (CWE-664)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Interface: SupervisorExtension
|
|
2
|
+
|
|
3
|
+
Shape of the value at `AgentInput.extensions[SUPERVISOR_EXTENSION_KEY]`. The agents plugin / `runAgent` build this from the tool index; advanced callers invoking `adapter.run(...)` directly populate it themselves.
|
|
4
|
+
|
|
5
|
+
## Properties[](#properties "Direct link to Properties")
|
|
6
|
+
|
|
7
|
+
### hostedTools?[](#hostedtools "Direct link to hostedTools?")
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
optional hostedTools: SupervisorTool[];
|
|
11
|
+
|
|
12
|
+
```
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Interface: WorkspaceClientLike
|
|
2
|
+
|
|
3
|
+
Structural shape of a Databricks SDK client used by [fromSupervisorApi](./docs/api/appkit/Function.fromSupervisorApi.md). Only what we need: `apiClient.request` for streaming and `config.ensureResolved` to materialise the host/credentials.
|
|
4
|
+
|
|
5
|
+
Exported because [SupervisorApiAdapterOptions.workspaceClient](./docs/api/appkit/Interface.SupervisorApiAdapterOptions.md#workspaceclient) (a public type) references it — callers passing their own client can name the shape they need to satisfy.
|
|
6
|
+
|
|
7
|
+
## Extends[](#extends "Direct link to Extends")
|
|
8
|
+
|
|
9
|
+
* `ApiClientLike`
|
|
10
|
+
|
|
11
|
+
## Properties[](#properties "Direct link to Properties")
|
|
12
|
+
|
|
13
|
+
### apiClient[](#apiclient "Direct link to apiClient")
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
apiClient: {
|
|
17
|
+
request: Promise<unknown>;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
#### request()[](#request "Direct link to request()")
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
request(options: Record<string, unknown>, context?: unknown): Promise<unknown>;
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
##### Parameters[](#parameters "Direct link to Parameters")
|
|
30
|
+
|
|
31
|
+
| Parameter | Type |
|
|
32
|
+
| ---------- | ----------------------------- |
|
|
33
|
+
| `options` | `Record`<`string`, `unknown`> |
|
|
34
|
+
| `context?` | `unknown` |
|
|
35
|
+
|
|
36
|
+
##### Returns[](#returns "Direct link to Returns")
|
|
37
|
+
|
|
38
|
+
`Promise`<`unknown`>
|
|
39
|
+
|
|
40
|
+
#### Inherited from[](#inherited-from "Direct link to Inherited from")
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
ApiClientLike.apiClient
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
***
|
|
48
|
+
|
|
49
|
+
### config[](#config "Direct link to config")
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
config: {
|
|
53
|
+
ensureResolved: Promise<void>;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
#### ensureResolved()[](#ensureresolved "Direct link to ensureResolved()")
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
ensureResolved(): Promise<void>;
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
##### Returns[](#returns-1 "Direct link to Returns")
|
|
66
|
+
|
|
67
|
+
`Promise`<`void`>
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
type AgentTool =
|
|
5
5
|
| FunctionTool
|
|
6
6
|
| HostedTool
|
|
7
|
-
| ToolkitEntry
|
|
7
|
+
| ToolkitEntry
|
|
8
|
+
| HostedSupervisorTool;
|
|
8
9
|
|
|
9
10
|
```
|
|
10
11
|
|
|
11
|
-
Any tool an agent can invoke: inline function tools (`tool()`), hosted MCP tools (`mcpServer()` / raw hosted),
|
|
12
|
+
Any tool an agent can invoke: inline function tools (`tool()`), hosted MCP tools (`mcpServer()` / raw hosted), toolkit references from plugins (`analytics().toolkit()`), or adapter-hosted Supervisor-API tools (`supervisorTools.*`).
|