@databricks/appkit-ui 0.31.0 → 0.33.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 +54 -1
- package/NOTICE.md +2 -0
- package/dist/react/hooks/index.d.ts +1 -0
- package/dist/react/hooks/index.js +1 -0
- package/dist/react/hooks/types.d.ts +11 -5
- package/dist/react/hooks/types.d.ts.map +1 -1
- package/dist/react/hooks/use-agent-chat.d.ts +128 -0
- package/dist/react/hooks/use-agent-chat.d.ts.map +1 -0
- package/dist/react/hooks/use-agent-chat.js +133 -0
- package/dist/react/hooks/use-agent-chat.js.map +1 -0
- package/dist/react/hooks/use-analytics-query.d.ts +4 -4
- package/dist/react/hooks/use-analytics-query.d.ts.map +1 -1
- package/dist/react/hooks/use-analytics-query.js +4 -4
- package/dist/react/hooks/use-analytics-query.js.map +1 -1
- package/dist/react/hooks/use-chart-data.js +9 -9
- package/dist/react/hooks/use-chart-data.js.map +1 -1
- package/dist/react/index.d.ts +2 -1
- package/dist/react/index.js +2 -1
- package/dist/shared/src/plugin.d.ts.map +1 -1
- package/docs/api/appkit/Class.AppKitMcpClient.md +157 -0
- package/docs/api/appkit/Class.DatabricksAdapter.md +151 -0
- package/docs/api/appkit/Class.Plugin.md +65 -23
- package/docs/api/appkit/Function.agentIdFromMarkdownPath.md +18 -0
- package/docs/api/appkit/Function.createAgent.md +33 -0
- package/docs/api/appkit/Function.createApp.md +10 -8
- package/docs/api/appkit/Function.defineTool.md +26 -0
- package/docs/api/appkit/Function.executeFromRegistry.md +25 -0
- package/docs/api/appkit/Function.functionToolToDefinition.md +16 -0
- package/docs/api/appkit/Function.isFunctionTool.md +16 -0
- package/docs/api/appkit/Function.isHostedTool.md +16 -0
- package/docs/api/appkit/Function.isToolkitEntry.md +18 -0
- package/docs/api/appkit/Function.loadAgentFromFile.md +21 -0
- package/docs/api/appkit/Function.loadAgentsFromDir.md +26 -0
- package/docs/api/appkit/Function.mcpServer.md +28 -0
- package/docs/api/appkit/Function.parseTextToolCalls.md +26 -0
- package/docs/api/appkit/Function.resolveHostedTools.md +16 -0
- package/docs/api/appkit/Function.runAgent.md +26 -0
- package/docs/api/appkit/Function.tool.md +28 -0
- package/docs/api/appkit/Function.toolsFromRegistry.md +20 -0
- package/docs/api/appkit/Interface.AgentAdapter.md +21 -0
- package/docs/api/appkit/Interface.AgentDefinition.md +112 -0
- package/docs/api/appkit/Interface.AgentInput.md +37 -0
- package/docs/api/appkit/Interface.AgentRunContext.md +32 -0
- package/docs/api/appkit/Interface.AgentToolDefinition.md +37 -0
- package/docs/api/appkit/Interface.AgentsPluginConfig.md +241 -0
- package/docs/api/appkit/Interface.AutoInheritToolsConfig.md +27 -0
- package/docs/api/appkit/Interface.BasePluginConfig.md +1 -0
- package/docs/api/appkit/Interface.FunctionTool.md +80 -0
- package/docs/api/appkit/Interface.McpConnectAllResult.md +38 -0
- package/docs/api/appkit/Interface.Message.md +55 -0
- package/docs/api/appkit/Interface.PluginToolkitProvider.md +22 -0
- package/docs/api/appkit/Interface.PromptContext.md +30 -0
- package/docs/api/appkit/Interface.RegisteredAgent.md +75 -0
- package/docs/api/appkit/Interface.RunAgentInput.md +34 -0
- package/docs/api/appkit/Interface.RunAgentResult.md +23 -0
- package/docs/api/appkit/Interface.Thread.md +46 -0
- package/docs/api/appkit/Interface.ThreadStore.md +103 -0
- package/docs/api/appkit/Interface.ToolAnnotations.md +56 -0
- package/docs/api/appkit/Interface.ToolConfig.md +72 -0
- package/docs/api/appkit/Interface.ToolEntry.md +73 -0
- package/docs/api/appkit/Interface.ToolProvider.md +38 -0
- package/docs/api/appkit/Interface.ToolkitEntry.md +59 -0
- package/docs/api/appkit/Interface.ToolkitOptions.md +45 -0
- package/docs/api/appkit/TypeAlias.AgentEvent.md +299 -0
- package/docs/api/appkit/TypeAlias.AgentTool.md +11 -0
- package/docs/api/appkit/TypeAlias.AgentTools.md +8 -0
- package/docs/api/appkit/TypeAlias.AgentToolsFn.md +20 -0
- package/docs/api/appkit/TypeAlias.BaseSystemPromptOption.md +9 -0
- package/docs/api/appkit/TypeAlias.HostedTool.md +10 -0
- package/docs/api/appkit/TypeAlias.Plugins.md +26 -0
- package/docs/api/appkit/TypeAlias.ResolvedToolEntry.md +29 -0
- package/docs/api/appkit/TypeAlias.ToolRegistry.md +6 -0
- package/docs/api/appkit/Variable.agents.md +19 -0
- package/docs/api/appkit.md +113 -62
- package/docs/plugins/agents.md +441 -0
- package/docs/privacy.md +41 -0
- package/llms.txt +54 -1
- package/package.json +1 -1
- package/sbom.cdx.json +1 -1
|
@@ -139,6 +139,15 @@ protected config: TConfig;
|
|
|
139
139
|
|
|
140
140
|
***
|
|
141
141
|
|
|
142
|
+
### context?[](#context "Direct link to context?")
|
|
143
|
+
|
|
144
|
+
```ts
|
|
145
|
+
protected optional context: PluginContext;
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
***
|
|
150
|
+
|
|
142
151
|
### devFileReader[](#devfilereader "Direct link to devFileReader")
|
|
143
152
|
|
|
144
153
|
```ts
|
|
@@ -255,6 +264,39 @@ AuthenticationError if user token is not available in request headers (productio
|
|
|
255
264
|
|
|
256
265
|
***
|
|
257
266
|
|
|
267
|
+
### attachContext()[](#attachcontext "Direct link to attachContext()")
|
|
268
|
+
|
|
269
|
+
```ts
|
|
270
|
+
attachContext(deps: {
|
|
271
|
+
context?: unknown;
|
|
272
|
+
telemetryConfig?: TelemetryOptions;
|
|
273
|
+
}): void;
|
|
274
|
+
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
Binds runtime dependencies (telemetry provider, cache, plugin context) to this plugin. Called by `AppKit._createApp` after construction and before `setup()`. Idempotent: safe to call if the constructor already bound them eagerly. Kept separate so factories can eagerly construct plugin instances without running this before `TelemetryManager.initialize()` / `CacheManager.getInstance()` have run.
|
|
278
|
+
|
|
279
|
+
#### Parameters[](#parameters-2 "Direct link to Parameters")
|
|
280
|
+
|
|
281
|
+
| Parameter | Type |
|
|
282
|
+
| ----------------------- | ------------------------------------------------------------------ |
|
|
283
|
+
| `deps` | { `context?`: `unknown`; `telemetryConfig?`: `TelemetryOptions`; } |
|
|
284
|
+
| `deps.context?` | `unknown` |
|
|
285
|
+
| `deps.telemetryConfig?` | `TelemetryOptions` |
|
|
286
|
+
|
|
287
|
+
#### Returns[](#returns-3 "Direct link to Returns")
|
|
288
|
+
|
|
289
|
+
`void`
|
|
290
|
+
|
|
291
|
+
#### Implementation of[](#implementation-of-2 "Direct link to Implementation of")
|
|
292
|
+
|
|
293
|
+
```ts
|
|
294
|
+
BasePlugin.attachContext
|
|
295
|
+
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
***
|
|
299
|
+
|
|
258
300
|
### clientConfig()[](#clientconfig "Direct link to clientConfig()")
|
|
259
301
|
|
|
260
302
|
```ts
|
|
@@ -272,7 +314,7 @@ Values must be JSON-serializable plain data (no functions, Dates, classes, Maps,
|
|
|
272
314
|
|
|
273
315
|
On the client, read the config with the `usePluginClientConfig` hook (React) or the `getPluginClientConfig` function (vanilla JS), both from `@databricks/appkit-ui`.
|
|
274
316
|
|
|
275
|
-
#### Returns[](#returns-
|
|
317
|
+
#### Returns[](#returns-4 "Direct link to Returns")
|
|
276
318
|
|
|
277
319
|
`Record`<`string`, `unknown`>
|
|
278
320
|
|
|
@@ -304,7 +346,7 @@ const config = getPluginClientConfig<MyPluginConfig>("myPlugin");
|
|
|
304
346
|
|
|
305
347
|
```
|
|
306
348
|
|
|
307
|
-
#### Implementation of[](#implementation-of-
|
|
349
|
+
#### Implementation of[](#implementation-of-3 "Direct link to Implementation of")
|
|
308
350
|
|
|
309
351
|
```ts
|
|
310
352
|
BasePlugin.clientConfig
|
|
@@ -338,7 +380,7 @@ Errors are never thrown — the method is production-safe.
|
|
|
338
380
|
| -------------- |
|
|
339
381
|
| `T` |
|
|
340
382
|
|
|
341
|
-
#### Parameters[](#parameters-
|
|
383
|
+
#### Parameters[](#parameters-3 "Direct link to Parameters")
|
|
342
384
|
|
|
343
385
|
| Parameter | Type |
|
|
344
386
|
| ---------- | -------------------------------------------- |
|
|
@@ -346,7 +388,7 @@ Errors are never thrown — the method is production-safe.
|
|
|
346
388
|
| `options` | `PluginExecutionSettings` |
|
|
347
389
|
| `userKey?` | `string` |
|
|
348
390
|
|
|
349
|
-
#### Returns[](#returns-
|
|
391
|
+
#### Returns[](#returns-5 "Direct link to Returns")
|
|
350
392
|
|
|
351
393
|
`Promise`<[`ExecutionResult`](./docs/api/appkit/TypeAlias.ExecutionResult.md)<`T`>>
|
|
352
394
|
|
|
@@ -369,7 +411,7 @@ userKey?: string): Promise<void>;
|
|
|
369
411
|
| -------------- |
|
|
370
412
|
| `T` |
|
|
371
413
|
|
|
372
|
-
#### Parameters[](#parameters-
|
|
414
|
+
#### Parameters[](#parameters-4 "Direct link to Parameters")
|
|
373
415
|
|
|
374
416
|
| Parameter | Type |
|
|
375
417
|
| ---------- | ----------------------------------------------------------------------------------------- |
|
|
@@ -378,7 +420,7 @@ userKey?: string): Promise<void>;
|
|
|
378
420
|
| `options` | [`StreamExecutionSettings`](./docs/api/appkit/Interface.StreamExecutionSettings.md) |
|
|
379
421
|
| `userKey?` | `string` |
|
|
380
422
|
|
|
381
|
-
#### Returns[](#returns-
|
|
423
|
+
#### Returns[](#returns-6 "Direct link to Returns")
|
|
382
424
|
|
|
383
425
|
`Promise`<`void`>
|
|
384
426
|
|
|
@@ -395,7 +437,7 @@ Returns the public exports for this plugin. Override this to define a custom pub
|
|
|
395
437
|
|
|
396
438
|
The returned object becomes the plugin's public API on the AppKit instance (e.g. `appkit.myPlugin.method()`). AppKit automatically binds method context and adds `asUser(req)` for user-scoped execution.
|
|
397
439
|
|
|
398
|
-
#### Returns[](#returns-
|
|
440
|
+
#### Returns[](#returns-7 "Direct link to Returns")
|
|
399
441
|
|
|
400
442
|
`unknown`
|
|
401
443
|
|
|
@@ -416,7 +458,7 @@ appkit.myPlugin.getData();
|
|
|
416
458
|
|
|
417
459
|
```
|
|
418
460
|
|
|
419
|
-
#### Implementation of[](#implementation-of-
|
|
461
|
+
#### Implementation of[](#implementation-of-4 "Direct link to Implementation of")
|
|
420
462
|
|
|
421
463
|
```ts
|
|
422
464
|
BasePlugin.exports
|
|
@@ -432,11 +474,11 @@ getEndpoints(): PluginEndpointMap;
|
|
|
432
474
|
|
|
433
475
|
```
|
|
434
476
|
|
|
435
|
-
#### Returns[](#returns-
|
|
477
|
+
#### Returns[](#returns-8 "Direct link to Returns")
|
|
436
478
|
|
|
437
479
|
`PluginEndpointMap`
|
|
438
480
|
|
|
439
|
-
#### Implementation of[](#implementation-of-
|
|
481
|
+
#### Implementation of[](#implementation-of-5 "Direct link to Implementation of")
|
|
440
482
|
|
|
441
483
|
```ts
|
|
442
484
|
BasePlugin.getEndpoints
|
|
@@ -452,11 +494,11 @@ getSkipBodyParsingPaths(): ReadonlySet<string>;
|
|
|
452
494
|
|
|
453
495
|
```
|
|
454
496
|
|
|
455
|
-
#### Returns[](#returns-
|
|
497
|
+
#### Returns[](#returns-9 "Direct link to Returns")
|
|
456
498
|
|
|
457
499
|
`ReadonlySet`<`string`>
|
|
458
500
|
|
|
459
|
-
#### Implementation of[](#implementation-of-
|
|
501
|
+
#### Implementation of[](#implementation-of-6 "Direct link to Implementation of")
|
|
460
502
|
|
|
461
503
|
```ts
|
|
462
504
|
BasePlugin.getSkipBodyParsingPaths
|
|
@@ -472,17 +514,17 @@ injectRoutes(_: Router): void;
|
|
|
472
514
|
|
|
473
515
|
```
|
|
474
516
|
|
|
475
|
-
#### Parameters[](#parameters-
|
|
517
|
+
#### Parameters[](#parameters-5 "Direct link to Parameters")
|
|
476
518
|
|
|
477
519
|
| Parameter | Type |
|
|
478
520
|
| --------- | -------- |
|
|
479
521
|
| `_` | `Router` |
|
|
480
522
|
|
|
481
|
-
#### Returns[](#returns-
|
|
523
|
+
#### Returns[](#returns-10 "Direct link to Returns")
|
|
482
524
|
|
|
483
525
|
`void`
|
|
484
526
|
|
|
485
|
-
#### Implementation of[](#implementation-of-
|
|
527
|
+
#### Implementation of[](#implementation-of-7 "Direct link to Implementation of")
|
|
486
528
|
|
|
487
529
|
```ts
|
|
488
530
|
BasePlugin.injectRoutes
|
|
@@ -498,14 +540,14 @@ protected registerEndpoint(name: string, path: string): void;
|
|
|
498
540
|
|
|
499
541
|
```
|
|
500
542
|
|
|
501
|
-
#### Parameters[](#parameters-
|
|
543
|
+
#### Parameters[](#parameters-6 "Direct link to Parameters")
|
|
502
544
|
|
|
503
545
|
| Parameter | Type |
|
|
504
546
|
| --------- | -------- |
|
|
505
547
|
| `name` | `string` |
|
|
506
548
|
| `path` | `string` |
|
|
507
549
|
|
|
508
|
-
#### Returns[](#returns-
|
|
550
|
+
#### Returns[](#returns-11 "Direct link to Returns")
|
|
509
551
|
|
|
510
552
|
`void`
|
|
511
553
|
|
|
@@ -522,13 +564,13 @@ Resolve the effective user ID from a request.
|
|
|
522
564
|
|
|
523
565
|
Returns the `x-forwarded-user` header when present. In development mode (`NODE_ENV=development`) falls back to the current context user ID so that callers outside an active `runInUserContext` scope still get a consistent value.
|
|
524
566
|
|
|
525
|
-
#### Parameters[](#parameters-
|
|
567
|
+
#### Parameters[](#parameters-7 "Direct link to Parameters")
|
|
526
568
|
|
|
527
569
|
| Parameter | Type |
|
|
528
570
|
| --------- | --------- |
|
|
529
571
|
| `req` | `Request` |
|
|
530
572
|
|
|
531
|
-
#### Returns[](#returns-
|
|
573
|
+
#### Returns[](#returns-12 "Direct link to Returns")
|
|
532
574
|
|
|
533
575
|
`string`
|
|
534
576
|
|
|
@@ -551,14 +593,14 @@ protected route<_TResponse>(router: Router, config: RouteConfig): void;
|
|
|
551
593
|
| -------------- |
|
|
552
594
|
| `_TResponse` |
|
|
553
595
|
|
|
554
|
-
#### Parameters[](#parameters-
|
|
596
|
+
#### Parameters[](#parameters-8 "Direct link to Parameters")
|
|
555
597
|
|
|
556
598
|
| Parameter | Type |
|
|
557
599
|
| --------- | ------------- |
|
|
558
600
|
| `router` | `Router` |
|
|
559
601
|
| `config` | `RouteConfig` |
|
|
560
602
|
|
|
561
|
-
#### Returns[](#returns-
|
|
603
|
+
#### Returns[](#returns-13 "Direct link to Returns")
|
|
562
604
|
|
|
563
605
|
`void`
|
|
564
606
|
|
|
@@ -571,11 +613,11 @@ setup(): Promise<void>;
|
|
|
571
613
|
|
|
572
614
|
```
|
|
573
615
|
|
|
574
|
-
#### Returns[](#returns-
|
|
616
|
+
#### Returns[](#returns-14 "Direct link to Returns")
|
|
575
617
|
|
|
576
618
|
`Promise`<`void`>
|
|
577
619
|
|
|
578
|
-
#### Implementation of[](#implementation-of-
|
|
620
|
+
#### Implementation of[](#implementation-of-8 "Direct link to Implementation of")
|
|
579
621
|
|
|
580
622
|
```ts
|
|
581
623
|
BasePlugin.setup
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Function: agentIdFromMarkdownPath()
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
function agentIdFromMarkdownPath(filePath: string): string;
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
Derives the logical agent id from a markdown path. When the file is named `agent.md`, the id is the parent directory name (folder-based layout); otherwise the id is the file stem (e.g. legacy single-file paths).
|
|
9
|
+
|
|
10
|
+
## Parameters[](#parameters "Direct link to Parameters")
|
|
11
|
+
|
|
12
|
+
| Parameter | Type |
|
|
13
|
+
| ---------- | -------- |
|
|
14
|
+
| `filePath` | `string` |
|
|
15
|
+
|
|
16
|
+
## Returns[](#returns "Direct link to Returns")
|
|
17
|
+
|
|
18
|
+
`string`
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Function: createAgent()
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
function createAgent(def: AgentDefinition): AgentDefinition;
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
Pure factory for agent definitions. Returns the passed-in definition after cycle-detecting the sub-agent graph. Accepts the full `AgentDefinition` shape and is safe to call at module top-level.
|
|
9
|
+
|
|
10
|
+
The returned value is a plain `AgentDefinition` — no adapter construction, no side effects. Register it with `agents({ agents: { name: def } })` or run it standalone via `runAgent(def, input)`.
|
|
11
|
+
|
|
12
|
+
## Parameters[](#parameters "Direct link to Parameters")
|
|
13
|
+
|
|
14
|
+
| Parameter | Type |
|
|
15
|
+
| --------- | ------------------------------------------------------------------------- |
|
|
16
|
+
| `def` | [`AgentDefinition`](./docs/api/appkit/Interface.AgentDefinition.md) |
|
|
17
|
+
|
|
18
|
+
## Returns[](#returns "Direct link to Returns")
|
|
19
|
+
|
|
20
|
+
[`AgentDefinition`](./docs/api/appkit/Interface.AgentDefinition.md)
|
|
21
|
+
|
|
22
|
+
## Example[](#example "Direct link to Example")
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
const support = createAgent({
|
|
26
|
+
instructions: "You help customers.",
|
|
27
|
+
model: "databricks-claude-sonnet-4-5",
|
|
28
|
+
tools: {
|
|
29
|
+
get_weather: tool({ ... }),
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
```
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
function createApp<T>(config: {
|
|
5
5
|
cache?: CacheConfig;
|
|
6
6
|
client?: WorkspaceClient;
|
|
7
|
+
disableInternalTelemetry?: boolean;
|
|
7
8
|
onPluginsReady?: (appkit: PluginMap<T>) => void | Promise<void>;
|
|
8
9
|
plugins?: T;
|
|
9
10
|
telemetry?: TelemetryConfig;
|
|
@@ -23,14 +24,15 @@ Initializes telemetry, cache, and service context, then registers plugins in pha
|
|
|
23
24
|
|
|
24
25
|
## Parameters[](#parameters "Direct link to Parameters")
|
|
25
26
|
|
|
26
|
-
| Parameter
|
|
27
|
-
|
|
|
28
|
-
| `config`
|
|
29
|
-
| `config.cache?`
|
|
30
|
-
| `config.client?`
|
|
31
|
-
| `config.
|
|
32
|
-
| `config.
|
|
33
|
-
| `config.
|
|
27
|
+
| Parameter | Type |
|
|
28
|
+
| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
29
|
+
| `config` | { `cache?`: [`CacheConfig`](./docs/api/appkit/Interface.CacheConfig.md); `client?`: `WorkspaceClient`; `disableInternalTelemetry?`: `boolean`; `onPluginsReady?`: (`appkit`: `PluginMap`<`T`>) => `void` \| `Promise`<`void`>; `plugins?`: `T`; `telemetry?`: [`TelemetryConfig`](./docs/api/appkit/Interface.TelemetryConfig.md); } |
|
|
30
|
+
| `config.cache?` | [`CacheConfig`](./docs/api/appkit/Interface.CacheConfig.md) |
|
|
31
|
+
| `config.client?` | `WorkspaceClient` |
|
|
32
|
+
| `config.disableInternalTelemetry?` | `boolean` |
|
|
33
|
+
| `config.onPluginsReady?` | (`appkit`: `PluginMap`<`T`>) => `void` \| `Promise`<`void`> |
|
|
34
|
+
| `config.plugins?` | `T` |
|
|
35
|
+
| `config.telemetry?` | [`TelemetryConfig`](./docs/api/appkit/Interface.TelemetryConfig.md) |
|
|
34
36
|
|
|
35
37
|
## Returns[](#returns "Direct link to Returns")
|
|
36
38
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Function: defineTool()
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
function defineTool<S>(config: ToolEntry<S>): ToolEntry<S>;
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
Defines a single tool entry for a plugin's internal registry.
|
|
9
|
+
|
|
10
|
+
The generic `S` flows from `schema` through to the `handler` callback so `args` is fully typed from the Zod schema. Names are assigned by the registry key, so they are not repeated inside the entry.
|
|
11
|
+
|
|
12
|
+
## Type Parameters[](#type-parameters "Direct link to Type Parameters")
|
|
13
|
+
|
|
14
|
+
| Type Parameter |
|
|
15
|
+
| ---------------------------------------------------------------------------------------- |
|
|
16
|
+
| `S` *extends* `ZodType`<`unknown`, `unknown`, `$ZodTypeInternals`<`unknown`, `unknown`>> |
|
|
17
|
+
|
|
18
|
+
## Parameters[](#parameters "Direct link to Parameters")
|
|
19
|
+
|
|
20
|
+
| Parameter | Type |
|
|
21
|
+
| --------- | ------------------------------------------------------------------ |
|
|
22
|
+
| `config` | [`ToolEntry`](./docs/api/appkit/Interface.ToolEntry.md)<`S`> |
|
|
23
|
+
|
|
24
|
+
## Returns[](#returns "Direct link to Returns")
|
|
25
|
+
|
|
26
|
+
[`ToolEntry`](./docs/api/appkit/Interface.ToolEntry.md)<`S`>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Function: executeFromRegistry()
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
function executeFromRegistry(
|
|
5
|
+
registry: ToolRegistry,
|
|
6
|
+
name: string,
|
|
7
|
+
args: unknown,
|
|
8
|
+
signal?: AbortSignal): Promise<unknown>;
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Validates tool-call arguments against the entry's schema and invokes its handler. On validation failure, returns an LLM-friendly error string (matching the behavior of `tool()`) rather than throwing, so the model can self-correct on its next turn.
|
|
13
|
+
|
|
14
|
+
## Parameters[](#parameters "Direct link to Parameters")
|
|
15
|
+
|
|
16
|
+
| Parameter | Type |
|
|
17
|
+
| ---------- | ------------------------------------------------------------------- |
|
|
18
|
+
| `registry` | [`ToolRegistry`](./docs/api/appkit/TypeAlias.ToolRegistry.md) |
|
|
19
|
+
| `name` | `string` |
|
|
20
|
+
| `args` | `unknown` |
|
|
21
|
+
| `signal?` | `AbortSignal` |
|
|
22
|
+
|
|
23
|
+
## Returns[](#returns "Direct link to Returns")
|
|
24
|
+
|
|
25
|
+
`Promise`<`unknown`>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Function: functionToolToDefinition()
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
function functionToolToDefinition(tool: FunctionTool): AgentToolDefinition;
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
## Parameters[](#parameters "Direct link to Parameters")
|
|
9
|
+
|
|
10
|
+
| Parameter | Type |
|
|
11
|
+
| --------- | ------------------------------------------------------------------- |
|
|
12
|
+
| `tool` | [`FunctionTool`](./docs/api/appkit/Interface.FunctionTool.md) |
|
|
13
|
+
|
|
14
|
+
## Returns[](#returns "Direct link to Returns")
|
|
15
|
+
|
|
16
|
+
[`AgentToolDefinition`](./docs/api/appkit/Interface.AgentToolDefinition.md)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Function: isFunctionTool()
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
function isFunctionTool(value: unknown): value is FunctionTool;
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
## Parameters[](#parameters "Direct link to Parameters")
|
|
9
|
+
|
|
10
|
+
| Parameter | Type |
|
|
11
|
+
| --------- | --------- |
|
|
12
|
+
| `value` | `unknown` |
|
|
13
|
+
|
|
14
|
+
## Returns[](#returns "Direct link to Returns")
|
|
15
|
+
|
|
16
|
+
`value is FunctionTool`
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Function: isHostedTool()
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
function isHostedTool(value: unknown): value is HostedTool;
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
## Parameters[](#parameters "Direct link to Parameters")
|
|
9
|
+
|
|
10
|
+
| Parameter | Type |
|
|
11
|
+
| --------- | --------- |
|
|
12
|
+
| `value` | `unknown` |
|
|
13
|
+
|
|
14
|
+
## Returns[](#returns "Direct link to Returns")
|
|
15
|
+
|
|
16
|
+
`value is HostedTool`
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Function: isToolkitEntry()
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
function isToolkitEntry(value: unknown): value is ToolkitEntry;
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
Type guard for `ToolkitEntry` — used by the agents plugin to differentiate toolkit references from inline tools in a mixed `tools` record.
|
|
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 ToolkitEntry`
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Function: loadAgentFromFile()
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
function loadAgentFromFile(filePath: string, ctx: LoadContext): Promise<AgentDefinition>;
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
Loads a single markdown agent file and resolves its frontmatter against registered plugin toolkits + ambient tool library.
|
|
9
|
+
|
|
10
|
+
Rejects non-empty `agents:` frontmatter because single-file loads have no siblings to resolve sub-agent references against — callers must use [loadAgentsFromDir](./docs/api/appkit/Function.loadAgentsFromDir.md) when markdown agents delegate to one another.
|
|
11
|
+
|
|
12
|
+
## Parameters[](#parameters "Direct link to Parameters")
|
|
13
|
+
|
|
14
|
+
| Parameter | Type |
|
|
15
|
+
| ---------- | ------------- |
|
|
16
|
+
| `filePath` | `string` |
|
|
17
|
+
| `ctx` | `LoadContext` |
|
|
18
|
+
|
|
19
|
+
## Returns[](#returns "Direct link to Returns")
|
|
20
|
+
|
|
21
|
+
`Promise`<[`AgentDefinition`](./docs/api/appkit/Interface.AgentDefinition.md)>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Function: loadAgentsFromDir()
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
function loadAgentsFromDir(dir: string, ctx: LoadContext): Promise<LoadResult>;
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
Scans a directory for one subdirectory per agent, each containing `agent.md` (frontmatter + body). Produces an `AgentDefinition` record keyed by agent id (folder name). Throws on frontmatter errors or unresolved references. Returns an empty map if the directory does not exist.
|
|
9
|
+
|
|
10
|
+
Legacy top-level `*.md` files are rejected with an error — migrate each to `<id>/agent.md` under a sibling folder named for the agent id.
|
|
11
|
+
|
|
12
|
+
Runs in two passes so sub-agent references in frontmatter (`agents: [...]`) can be resolved regardless of directory iteration order:
|
|
13
|
+
|
|
14
|
+
1. Build every agent's definition from its own `agent.md`.
|
|
15
|
+
2. Walk `agents:` references and wire `def.agents = { child: childDef }` by looking them up in the complete map. Dangling names and self-references fail loudly; mutual delegation is allowed and bounded at runtime by `limits.maxSubAgentDepth`.
|
|
16
|
+
|
|
17
|
+
## Parameters[](#parameters "Direct link to Parameters")
|
|
18
|
+
|
|
19
|
+
| Parameter | Type |
|
|
20
|
+
| --------- | ------------- |
|
|
21
|
+
| `dir` | `string` |
|
|
22
|
+
| `ctx` | `LoadContext` |
|
|
23
|
+
|
|
24
|
+
## Returns[](#returns "Direct link to Returns")
|
|
25
|
+
|
|
26
|
+
`Promise`<`LoadResult`>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Function: mcpServer()
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
function mcpServer(name: string, url: string): CustomMcpServerTool;
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
Factory for declaring a custom MCP server tool.
|
|
9
|
+
|
|
10
|
+
Replaces the verbose `{ type: "custom_mcp_server", custom_mcp_server: { app_name, app_url } }` wrapper with a concise positional call.
|
|
11
|
+
|
|
12
|
+
Example:
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
mcpServer("my-app", "https://my-app.databricksapps.com/mcp")
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Parameters[](#parameters "Direct link to Parameters")
|
|
20
|
+
|
|
21
|
+
| Parameter | Type |
|
|
22
|
+
| --------- | -------- |
|
|
23
|
+
| `name` | `string` |
|
|
24
|
+
| `url` | `string` |
|
|
25
|
+
|
|
26
|
+
## Returns[](#returns "Direct link to Returns")
|
|
27
|
+
|
|
28
|
+
`CustomMcpServerTool`
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Function: parseTextToolCalls()
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
function parseTextToolCalls(text: string): {
|
|
5
|
+
args: unknown;
|
|
6
|
+
name: string;
|
|
7
|
+
}[];
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Parses text-based tool calls from model output.
|
|
12
|
+
|
|
13
|
+
Handles two formats:
|
|
14
|
+
|
|
15
|
+
1. Llama native: `[{"name": "tool_name", "parameters": {"arg": "val"}}]`
|
|
16
|
+
2. Python-style: `[tool_name(arg1='val1', arg2='val2')]`
|
|
17
|
+
|
|
18
|
+
## Parameters[](#parameters "Direct link to Parameters")
|
|
19
|
+
|
|
20
|
+
| Parameter | Type |
|
|
21
|
+
| --------- | -------- |
|
|
22
|
+
| `text` | `string` |
|
|
23
|
+
|
|
24
|
+
## Returns[](#returns "Direct link to Returns")
|
|
25
|
+
|
|
26
|
+
{ `args`: `unknown`; `name`: `string`; }\[]
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Function: resolveHostedTools()
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
function resolveHostedTools(tools: HostedTool[]): McpEndpointConfig[];
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
## Parameters[](#parameters "Direct link to Parameters")
|
|
9
|
+
|
|
10
|
+
| Parameter | Type |
|
|
11
|
+
| --------- | ------------------------------------------------------------------ |
|
|
12
|
+
| `tools` | [`HostedTool`](./docs/api/appkit/TypeAlias.HostedTool.md)\[] |
|
|
13
|
+
|
|
14
|
+
## Returns[](#returns "Direct link to Returns")
|
|
15
|
+
|
|
16
|
+
`McpEndpointConfig`\[]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Function: runAgent()
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
function runAgent(def: AgentDefinition, input: RunAgentInput): Promise<RunAgentResult>;
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
Standalone agent execution without `createApp`. Resolves the adapter, binds inline tools, and drives the adapter's `run()` loop to completion.
|
|
9
|
+
|
|
10
|
+
Limitations vs. running through the agents() plugin:
|
|
11
|
+
|
|
12
|
+
* **No OBO and no approval gate** — there is no HTTP request, so plugin tools run as the service principal. The agents-plugin approval gate that prompts for human confirmation on `effect: "write" | "update" | "destructive"` tools is also absent. LLM-controlled tool arguments flow straight through to the SP. Treat standalone runAgent as a trusted-prompt environment (CI, batch eval, internal scripts) — not as an exposed user-facing surface.
|
|
13
|
+
* **Hosted tools (MCP) are not supported** — they require a live MCP client that only exists inside the agents plugin's lifecycle. `runAgent` rejects them at index-build time with a clear error.
|
|
14
|
+
* **Sub-agents** (`agents: { ... }` on the def) are executed as nested `runAgent` calls with no shared thread state. Plugin instances ARE shared across the recursion (same cache as the parent).
|
|
15
|
+
* **Plugin tools** (used inside the function form via `plugins.<name>.toolkit(...)`) require passing `plugins: [...]` via `RunAgentInput`. Each plugin in that array is constructed once, `attachContext({})` and `await setup()` are called eagerly, and the resulting instance is shared across the top-level run and all sub-agent recursions. Plugins whose `setup()` requires runtime that only `createApp` provides (e.g. `WorkspaceClient`, `ServiceContext`, `PluginContext`) throw at standalone-init time with a clear "use createApp instead" message — not mid-stream.
|
|
16
|
+
|
|
17
|
+
## Parameters[](#parameters "Direct link to Parameters")
|
|
18
|
+
|
|
19
|
+
| Parameter | Type |
|
|
20
|
+
| --------- | ------------------------------------------------------------------------- |
|
|
21
|
+
| `def` | [`AgentDefinition`](./docs/api/appkit/Interface.AgentDefinition.md) |
|
|
22
|
+
| `input` | [`RunAgentInput`](./docs/api/appkit/Interface.RunAgentInput.md) |
|
|
23
|
+
|
|
24
|
+
## Returns[](#returns "Direct link to Returns")
|
|
25
|
+
|
|
26
|
+
`Promise`<[`RunAgentResult`](./docs/api/appkit/Interface.RunAgentResult.md)>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Function: tool()
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
function tool<S>(config: ToolConfig<S>): FunctionTool;
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
Factory for defining function tools with Zod schemas.
|
|
9
|
+
|
|
10
|
+
* Generates JSON Schema (for the LLM) from the Zod schema via `z.toJSONSchema()`.
|
|
11
|
+
* Infers the `execute` argument type from the schema.
|
|
12
|
+
* Validates tool call arguments at runtime. On validation failure, returns a formatted error string to the LLM instead of throwing, so the model can self-correct on its next turn.
|
|
13
|
+
|
|
14
|
+
## Type Parameters[](#type-parameters "Direct link to Type Parameters")
|
|
15
|
+
|
|
16
|
+
| Type Parameter |
|
|
17
|
+
| ---------------------------------------------------------------------------------------- |
|
|
18
|
+
| `S` *extends* `ZodType`<`unknown`, `unknown`, `$ZodTypeInternals`<`unknown`, `unknown`>> |
|
|
19
|
+
|
|
20
|
+
## Parameters[](#parameters "Direct link to Parameters")
|
|
21
|
+
|
|
22
|
+
| Parameter | Type |
|
|
23
|
+
| --------- | -------------------------------------------------------------------- |
|
|
24
|
+
| `config` | [`ToolConfig`](./docs/api/appkit/Interface.ToolConfig.md)<`S`> |
|
|
25
|
+
|
|
26
|
+
## Returns[](#returns "Direct link to Returns")
|
|
27
|
+
|
|
28
|
+
[`FunctionTool`](./docs/api/appkit/Interface.FunctionTool.md)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Function: toolsFromRegistry()
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
function toolsFromRegistry(registry: ToolRegistry): AgentToolDefinition[];
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
Produces the `AgentToolDefinition[]` a ToolProvider exposes to the LLM, deriving `parameters` JSON Schema from each entry's Zod schema.
|
|
9
|
+
|
|
10
|
+
Tool names come from registry keys (supports dotted names like `uploads.list` for dynamic plugins).
|
|
11
|
+
|
|
12
|
+
## Parameters[](#parameters "Direct link to Parameters")
|
|
13
|
+
|
|
14
|
+
| Parameter | Type |
|
|
15
|
+
| ---------- | ------------------------------------------------------------------- |
|
|
16
|
+
| `registry` | [`ToolRegistry`](./docs/api/appkit/TypeAlias.ToolRegistry.md) |
|
|
17
|
+
|
|
18
|
+
## Returns[](#returns "Direct link to Returns")
|
|
19
|
+
|
|
20
|
+
[`AgentToolDefinition`](./docs/api/appkit/Interface.AgentToolDefinition.md)\[]
|