@proveanything/smartlinks 2.1.39 → 2.1.41
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/README.md +754 -754
- package/dist/README.md +573 -573
- package/dist/adminCardsView.js +55 -55
- package/dist/adminViews.d.ts +1 -1
- package/dist/adminViews.js +3 -1
- package/dist/ai-tools.d.ts +2 -1
- package/dist/ai-tools.js +3 -0
- package/dist/api/ai.d.ts +2 -21
- package/dist/api/ai.js +0 -35
- package/dist/api/collection.d.ts +8 -1
- package/dist/api/collection.js +10 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/knowledge.d.ts +64 -0
- package/dist/api/knowledge.js +97 -0
- package/dist/baseline.css +194 -194
- package/dist/docs/API_SUMMARY.md +1046 -964
- package/dist/docs/admin-cards.md +189 -189
- package/dist/docs/admin-views.md +257 -255
- package/dist/docs/agent-tools.md +156 -156
- package/dist/docs/ai-tools-and-skills.md +180 -180
- package/dist/docs/ai.md +1721 -1834
- package/dist/docs/analytics.md +39 -39
- package/dist/docs/app-data-storage.md +277 -277
- package/dist/docs/app-docs.md +73 -73
- package/dist/docs/app-manifest.md +852 -852
- package/dist/docs/app-records-pattern.md +388 -388
- package/dist/docs/appConfig.md +550 -550
- package/dist/docs/assistant-apps.md +172 -172
- package/dist/docs/assistant-context.md +119 -119
- package/dist/docs/bookings.md +442 -442
- package/dist/docs/comms.md +686 -686
- package/dist/docs/connectors.md +340 -340
- package/dist/docs/css-baseline.md +133 -133
- package/dist/docs/customer-guide.md +70 -70
- package/dist/docs/deploying-apps.md +340 -340
- package/dist/docs/entitlements.md +90 -90
- package/dist/docs/files.md +69 -69
- package/dist/docs/host-dependency-contract.md +210 -210
- package/dist/docs/integrations.md +322 -322
- package/dist/docs/interactions.md +545 -545
- package/dist/docs/item-context.md +181 -181
- package/dist/docs/knowledge.md +102 -0
- package/dist/docs/lots.md +111 -111
- package/dist/docs/loyalty.md +352 -352
- package/dist/docs/members.md +182 -182
- package/dist/docs/mobile-admin-container.md +693 -693
- package/dist/docs/operations.md +281 -281
- package/dist/docs/overview.md +482 -482
- package/dist/docs/proof-comms-triggers.md +142 -142
- package/dist/docs/proof-ownership-transfer.md +155 -155
- package/dist/docs/proof-product-data-scoping.md +462 -462
- package/dist/docs/proof-share-grants.md +305 -305
- package/dist/docs/realtime.md +138 -138
- package/dist/docs/records-admin-pattern.md +304 -304
- package/dist/docs/standard-query.md +187 -187
- package/dist/docs/tag-codes.md +97 -97
- package/dist/docs/theme-tokens.md +252 -252
- package/dist/docs/wallet-passes.md +107 -107
- package/dist/docs/websites.md +123 -123
- package/dist/openapi.yaml +320 -306
- package/dist/theme-boot.js +78 -78
- package/dist/theme.css +75 -75
- package/dist/types/ai.d.ts +9 -91
- package/dist/types/appManifest.d.ts +21 -0
- package/dist/types/collection.d.ts +26 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/knowledge.d.ts +120 -0
- package/dist/types/knowledge.js +2 -0
- package/docs/API_SUMMARY.md +1046 -964
- package/docs/admin-cards.md +189 -189
- package/docs/admin-views.md +257 -255
- package/docs/agent-tools.md +156 -156
- package/docs/ai-tools-and-skills.md +180 -180
- package/docs/ai.md +1721 -1834
- package/docs/analytics.md +39 -39
- package/docs/app-data-storage.md +277 -277
- package/docs/app-docs.md +73 -73
- package/docs/app-manifest.md +852 -852
- package/docs/app-records-pattern.md +388 -388
- package/docs/appConfig.md +550 -550
- package/docs/assistant-apps.md +172 -172
- package/docs/assistant-context.md +119 -119
- package/docs/bookings.md +442 -442
- package/docs/comms.md +686 -686
- package/docs/connectors.md +340 -340
- package/docs/css-baseline.md +133 -133
- package/docs/customer-guide.md +70 -70
- package/docs/deploying-apps.md +340 -340
- package/docs/entitlements.md +90 -90
- package/docs/files.md +69 -69
- package/docs/host-dependency-contract.md +210 -210
- package/docs/integrations.md +322 -322
- package/docs/interactions.md +545 -545
- package/docs/item-context.md +181 -181
- package/docs/knowledge.md +102 -0
- package/docs/lots.md +111 -111
- package/docs/loyalty.md +352 -352
- package/docs/members.md +182 -182
- package/docs/mobile-admin-container.md +693 -693
- package/docs/operations.md +281 -281
- package/docs/overview.md +482 -482
- package/docs/proof-comms-triggers.md +142 -142
- package/docs/proof-ownership-transfer.md +155 -155
- package/docs/proof-product-data-scoping.md +462 -462
- package/docs/proof-share-grants.md +305 -305
- package/docs/realtime.md +138 -138
- package/docs/standard-query.md +187 -187
- package/docs/tag-codes.md +97 -97
- package/docs/theme-lookbook.v1.json +120 -120
- package/docs/theme-tokens.md +252 -252
- package/docs/wallet-passes.md +107 -107
- package/docs/websites.md +123 -123
- package/openapi.yaml +320 -306
- package/package.json +87 -87
- package/scripts/headless-check.mjs +87 -87
- package/scripts/lib/bare-imports.mjs +57 -57
- package/scripts/lib/keyed-app-data.mjs +21 -21
- package/scripts/publish.mjs +272 -272
- package/scripts/register-release.mjs +91 -91
package/dist/docs/agent-tools.md
CHANGED
|
@@ -1,156 +1,156 @@
|
|
|
1
|
-
# Agent tools — exposing your app's actions to the SmartLinks agent
|
|
2
|
-
|
|
3
|
-
> **SmartLinks SDK 2.x.** Redraft of the earlier "Agent Skills & Tools" RFC, now built on
|
|
4
|
-
> [server functions](server-functions.md). **Staged rollout:** the *declaration + discovery* ship in
|
|
5
|
-
> V2 (do them now); the *live agent loop* (a parent chat agent calling your tools) lights up when the
|
|
6
|
-
> platform agent can consume them. Everything you declare is useful before then — a tool is a server
|
|
7
|
-
> function, already invocable via http/event.
|
|
8
|
-
|
|
9
|
-
## The model: app-authored capabilities
|
|
10
|
-
|
|
11
|
-
An app declares **capabilities** — app-authored logic the platform runs, each with a declared
|
|
12
|
-
security envelope (`visibility` / `authority` / `capabilities`). There is **one engine** (the
|
|
13
|
-
server-functions runtime) and several **triggers** into it: `http`, `event`, `cron`, and **`agent`**.
|
|
14
|
-
|
|
15
|
-
**An agent tool is not a new runtime — it's an MCP-shaped facade over a capability.** By default a
|
|
16
|
-
tool *is a server function*: the agent's `tools/call` routes into the same `(ctx, event) => result`
|
|
17
|
-
with the same capability envelope. You author the logic once; the agent is just another caller.
|
|
18
|
-
|
|
19
|
-
Use a **client tool** (a `postMessage` handler in your live admin iframe) only for genuinely
|
|
20
|
-
UI-coupled actions that must run in the open app. It is **not** the default — headless server
|
|
21
|
-
functions are, because they work whether or not your UI is mounted.
|
|
22
|
-
|
|
23
|
-
## Declaring a tool
|
|
24
|
-
|
|
25
|
-
You already declare server functions in `app.manifest.json` (see
|
|
26
|
-
[server-functions.md](server-functions.md)). Mark one **agent-invocable** and give the agent what it
|
|
27
|
-
needs to call it — a description and an input schema:
|
|
28
|
-
|
|
29
|
-
```jsonc
|
|
30
|
-
{
|
|
31
|
-
"functions": {
|
|
32
|
-
"files": { "js": { "umd": "functions.umd.js" } },
|
|
33
|
-
"definitions": [
|
|
34
|
-
{
|
|
35
|
-
"name": "createFaq",
|
|
36
|
-
"trigger": { "type": "http", "methods": ["POST"] },
|
|
37
|
-
"visibility": "admin",
|
|
38
|
-
"authority": "collection",
|
|
39
|
-
"capabilities": ["sl:records:write"],
|
|
40
|
-
|
|
41
|
-
// ── makes it an agent tool ──
|
|
42
|
-
"agent": {
|
|
43
|
-
"tool": true,
|
|
44
|
-
"title": "Create an FAQ entry",
|
|
45
|
-
"description": "Add a question/answer to this collection's FAQ. Use when the user asks to add or draft an FAQ.",
|
|
46
|
-
"input": { /* JSON Schema for the arguments the agent supplies as event.body */ },
|
|
47
|
-
"approval": "auto", // auto | require (require = human confirmation before the call)
|
|
48
|
-
"audience": ["app"] // optional: app | public | assistant — where it is offered (absent = everywhere)
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
]
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
The handler is an ordinary server function — the agent-supplied arguments arrive as `event.body`:
|
|
57
|
-
|
|
58
|
-
```js
|
|
59
|
-
export async function createFaq(ctx, event) {
|
|
60
|
-
const { question, answer } = event.body || {}
|
|
61
|
-
// validate, then act with your declared authority/capabilities:
|
|
62
|
-
const rec = await ctx.sl.appRecords.create({ recordType: 'faq', data: { question, answer } })
|
|
63
|
-
return { id: rec.id }
|
|
64
|
-
}
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
## What the agent sees (MCP shape)
|
|
68
|
-
|
|
69
|
-
The platform derives an **MCP tool list** from your manifest and drives the standard flow — `tools/list`
|
|
70
|
-
→ `tools/call` → structured result — with streaming, cancellation, and approval layered on. You don't
|
|
71
|
-
implement the wire protocol; you declare tools and write handlers. (The live loop is the staged part.)
|
|
72
|
-
|
|
73
|
-
## Client tools (front-end)
|
|
74
|
-
|
|
75
|
-
For genuinely UI-coupled actions — read a field the user is editing, open a picker, update on-page
|
|
76
|
-
state — declare a **client tool**: the model calls it, but it runs in your page, not on the server.
|
|
77
|
-
Build each with `ai.defineClientTool` and drive the loop with `ai.runWithClientTools`, which resolves
|
|
78
|
-
every client call automatically (suspend → run handler → resubmit) until the assistant answers:
|
|
79
|
-
|
|
80
|
-
```ts
|
|
81
|
-
const pickDate = SL.ai.defineClientTool(
|
|
82
|
-
'ui.pickDate',
|
|
83
|
-
{ description: 'Open the date picker and return the chosen ISO date.',
|
|
84
|
-
input: { type: 'object', properties: { min: { type: 'string' } } } },
|
|
85
|
-
async ({ min }) => ({ date: await openDatePicker({ min }) }) // runs in the browser
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
const result = await SL.ai.runWithClientTools(collectionId, {
|
|
89
|
-
input: 'Book me the earliest slot next week',
|
|
90
|
-
tools: [pickDate],
|
|
91
|
-
toolbelt: { builtins: ['web.search'], appFunctions: [{ appId: 'booking' }] }, // mix all three kinds
|
|
92
|
-
// surface: 'public' // for a consumer assistant
|
|
93
|
-
})
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
The handler runs with the user's own session (auto-scoped), and only tools you declared can be called
|
|
97
|
-
(a call for anything else throws). A client-tool name can never collide with a built-in or a server
|
|
98
|
-
function — those always win. This is the third tool **kind**, alongside built-in tools and app
|
|
99
|
-
functions, all declared together in one `toolbelt`.
|
|
100
|
-
|
|
101
|
-
## Security
|
|
102
|
-
|
|
103
|
-
Identical to server functions — nothing new to reason about:
|
|
104
|
-
- **`visibility`** — who may call (admin/public).
|
|
105
|
-
- **`authority`** — whose identity `ctx.sl` carries (`caller` vs `collection`).
|
|
106
|
-
- **`capabilities`** — least-privilege, capped even when elevated.
|
|
107
|
-
- **`agent.audience`** — where the tool is offered: `'app'` (the app's own agent runs, admin surface),
|
|
108
|
-
`'public'` (public assistants), `'assistant'` (the Studio assistant, the admin's agent —
|
|
109
|
-
[assistant-apps.md](assistant-apps.md)). Absent = everywhere the function's visibility allows. An
|
|
110
|
-
assistant-only tool declares `["assistant"]` and never joins an in-app or public run.
|
|
111
|
-
- **`agent.approval: "require"`** — the agent must get human confirmation before invoking (use for
|
|
112
|
-
destructive or public-facing actions).
|
|
113
|
-
|
|
114
|
-
Untrusted third-party tools run in the platform's isolated runner — the same boundary as untrusted
|
|
115
|
-
server functions.
|
|
116
|
-
|
|
117
|
-
## Working with `app.admin.json` (complement, not replacement)
|
|
118
|
-
|
|
119
|
-
`app.admin.json` stays the **canonical declarative config contract** — setup questions, config schema,
|
|
120
|
-
import fields, tunable settings, content hints. It's inspectable, validatable, deterministic, and
|
|
121
|
-
reused by many consumers at once (the admin form renderer, AI setup, a signup journey asking the same
|
|
122
|
-
questions, bulk import). Agent tools **do not replace it — they serve and adapt it**:
|
|
123
|
-
|
|
124
|
-
- Keep the declarative schema as the default and source of truth.
|
|
125
|
-
- When you want *dynamic, contextual* behaviour — "which questions for **this** collection?", "the
|
|
126
|
-
config schema as it stands right now", "apply these answers" — expose a small function/tool that
|
|
127
|
-
reads the declaration and returns a tailored result. **Static-first; dynamic only where it earns its
|
|
128
|
-
keep.**
|
|
129
|
-
|
|
130
|
-
There's no rip-and-replace and nothing to migrate off: an app happy with its `app.admin.json` keeps
|
|
131
|
-
it untouched.
|
|
132
|
-
|
|
133
|
-
## What ships now vs staged
|
|
134
|
-
|
|
135
|
-
| Now (V2) | Staged (on the platform agent) |
|
|
136
|
-
|---|---|
|
|
137
|
-
| The `agent` declaration in the manifest | The live agent conversation calling your tools |
|
|
138
|
-
| SDK types for it; tool descriptors surfaced for discovery | `tools/call` streaming, cancellation, cross-app toolbelt arbitration |
|
|
139
|
-
| Your handlers run today via http/event | Human-approval UX for `approval: "require"` |
|
|
140
|
-
|
|
141
|
-
## Adopting this — opt-in, per app, no fleet migration
|
|
142
|
-
|
|
143
|
-
Agent tools are **purely additive**. There is **no migration pass**, and nothing breaks if you never
|
|
144
|
-
adopt them — an existing app on the V2 SDK simply *gains the ability* to add them whenever you want.
|
|
145
|
-
You do **not** touch every app; you turn it on for one app at a time.
|
|
146
|
-
|
|
147
|
-
To turn them on for a single app (say, an FAQ app), once it's on the V2 SDK:
|
|
148
|
-
|
|
149
|
-
1. **Server functions** — add the `functions` block + build target + test harness if the app doesn't
|
|
150
|
-
already have them. See [server-functions.md](server-functions.md).
|
|
151
|
-
2. **Expose tools** — add the `agent` block to the functions you want the agent to call; give each a
|
|
152
|
-
title / description / input schema and an approval mode.
|
|
153
|
-
|
|
154
|
-
That's it — declare and build. The live agent loop is staged (see the table above); until it ships,
|
|
155
|
-
your handlers still run via http/event, so declaring tools now is **forward-compatible, not
|
|
156
|
-
speculative breakage**. `app.admin.json` stays as-is throughout — nothing to retire.
|
|
1
|
+
# Agent tools — exposing your app's actions to the SmartLinks agent
|
|
2
|
+
|
|
3
|
+
> **SmartLinks SDK 2.x.** Redraft of the earlier "Agent Skills & Tools" RFC, now built on
|
|
4
|
+
> [server functions](server-functions.md). **Staged rollout:** the *declaration + discovery* ship in
|
|
5
|
+
> V2 (do them now); the *live agent loop* (a parent chat agent calling your tools) lights up when the
|
|
6
|
+
> platform agent can consume them. Everything you declare is useful before then — a tool is a server
|
|
7
|
+
> function, already invocable via http/event.
|
|
8
|
+
|
|
9
|
+
## The model: app-authored capabilities
|
|
10
|
+
|
|
11
|
+
An app declares **capabilities** — app-authored logic the platform runs, each with a declared
|
|
12
|
+
security envelope (`visibility` / `authority` / `capabilities`). There is **one engine** (the
|
|
13
|
+
server-functions runtime) and several **triggers** into it: `http`, `event`, `cron`, and **`agent`**.
|
|
14
|
+
|
|
15
|
+
**An agent tool is not a new runtime — it's an MCP-shaped facade over a capability.** By default a
|
|
16
|
+
tool *is a server function*: the agent's `tools/call` routes into the same `(ctx, event) => result`
|
|
17
|
+
with the same capability envelope. You author the logic once; the agent is just another caller.
|
|
18
|
+
|
|
19
|
+
Use a **client tool** (a `postMessage` handler in your live admin iframe) only for genuinely
|
|
20
|
+
UI-coupled actions that must run in the open app. It is **not** the default — headless server
|
|
21
|
+
functions are, because they work whether or not your UI is mounted.
|
|
22
|
+
|
|
23
|
+
## Declaring a tool
|
|
24
|
+
|
|
25
|
+
You already declare server functions in `app.manifest.json` (see
|
|
26
|
+
[server-functions.md](server-functions.md)). Mark one **agent-invocable** and give the agent what it
|
|
27
|
+
needs to call it — a description and an input schema:
|
|
28
|
+
|
|
29
|
+
```jsonc
|
|
30
|
+
{
|
|
31
|
+
"functions": {
|
|
32
|
+
"files": { "js": { "umd": "functions.umd.js" } },
|
|
33
|
+
"definitions": [
|
|
34
|
+
{
|
|
35
|
+
"name": "createFaq",
|
|
36
|
+
"trigger": { "type": "http", "methods": ["POST"] },
|
|
37
|
+
"visibility": "admin",
|
|
38
|
+
"authority": "collection",
|
|
39
|
+
"capabilities": ["sl:records:write"],
|
|
40
|
+
|
|
41
|
+
// ── makes it an agent tool ──
|
|
42
|
+
"agent": {
|
|
43
|
+
"tool": true,
|
|
44
|
+
"title": "Create an FAQ entry",
|
|
45
|
+
"description": "Add a question/answer to this collection's FAQ. Use when the user asks to add or draft an FAQ.",
|
|
46
|
+
"input": { /* JSON Schema for the arguments the agent supplies as event.body */ },
|
|
47
|
+
"approval": "auto", // auto | require (require = human confirmation before the call)
|
|
48
|
+
"audience": ["app"] // optional: app | public | assistant — where it is offered (absent = everywhere)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
The handler is an ordinary server function — the agent-supplied arguments arrive as `event.body`:
|
|
57
|
+
|
|
58
|
+
```js
|
|
59
|
+
export async function createFaq(ctx, event) {
|
|
60
|
+
const { question, answer } = event.body || {}
|
|
61
|
+
// validate, then act with your declared authority/capabilities:
|
|
62
|
+
const rec = await ctx.sl.appRecords.create({ recordType: 'faq', data: { question, answer } })
|
|
63
|
+
return { id: rec.id }
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## What the agent sees (MCP shape)
|
|
68
|
+
|
|
69
|
+
The platform derives an **MCP tool list** from your manifest and drives the standard flow — `tools/list`
|
|
70
|
+
→ `tools/call` → structured result — with streaming, cancellation, and approval layered on. You don't
|
|
71
|
+
implement the wire protocol; you declare tools and write handlers. (The live loop is the staged part.)
|
|
72
|
+
|
|
73
|
+
## Client tools (front-end)
|
|
74
|
+
|
|
75
|
+
For genuinely UI-coupled actions — read a field the user is editing, open a picker, update on-page
|
|
76
|
+
state — declare a **client tool**: the model calls it, but it runs in your page, not on the server.
|
|
77
|
+
Build each with `ai.defineClientTool` and drive the loop with `ai.runWithClientTools`, which resolves
|
|
78
|
+
every client call automatically (suspend → run handler → resubmit) until the assistant answers:
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
const pickDate = SL.ai.defineClientTool(
|
|
82
|
+
'ui.pickDate',
|
|
83
|
+
{ description: 'Open the date picker and return the chosen ISO date.',
|
|
84
|
+
input: { type: 'object', properties: { min: { type: 'string' } } } },
|
|
85
|
+
async ({ min }) => ({ date: await openDatePicker({ min }) }) // runs in the browser
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
const result = await SL.ai.runWithClientTools(collectionId, {
|
|
89
|
+
input: 'Book me the earliest slot next week',
|
|
90
|
+
tools: [pickDate],
|
|
91
|
+
toolbelt: { builtins: ['web.search'], appFunctions: [{ appId: 'booking' }] }, // mix all three kinds
|
|
92
|
+
// surface: 'public' // for a consumer assistant
|
|
93
|
+
})
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
The handler runs with the user's own session (auto-scoped), and only tools you declared can be called
|
|
97
|
+
(a call for anything else throws). A client-tool name can never collide with a built-in or a server
|
|
98
|
+
function — those always win. This is the third tool **kind**, alongside built-in tools and app
|
|
99
|
+
functions, all declared together in one `toolbelt`.
|
|
100
|
+
|
|
101
|
+
## Security
|
|
102
|
+
|
|
103
|
+
Identical to server functions — nothing new to reason about:
|
|
104
|
+
- **`visibility`** — who may call (admin/public).
|
|
105
|
+
- **`authority`** — whose identity `ctx.sl` carries (`caller` vs `collection`).
|
|
106
|
+
- **`capabilities`** — least-privilege, capped even when elevated.
|
|
107
|
+
- **`agent.audience`** — where the tool is offered: `'app'` (the app's own agent runs, admin surface),
|
|
108
|
+
`'public'` (public assistants), `'assistant'` (the Studio assistant, the admin's agent —
|
|
109
|
+
[assistant-apps.md](assistant-apps.md)). Absent = everywhere the function's visibility allows. An
|
|
110
|
+
assistant-only tool declares `["assistant"]` and never joins an in-app or public run.
|
|
111
|
+
- **`agent.approval: "require"`** — the agent must get human confirmation before invoking (use for
|
|
112
|
+
destructive or public-facing actions).
|
|
113
|
+
|
|
114
|
+
Untrusted third-party tools run in the platform's isolated runner — the same boundary as untrusted
|
|
115
|
+
server functions.
|
|
116
|
+
|
|
117
|
+
## Working with `app.admin.json` (complement, not replacement)
|
|
118
|
+
|
|
119
|
+
`app.admin.json` stays the **canonical declarative config contract** — setup questions, config schema,
|
|
120
|
+
import fields, tunable settings, content hints. It's inspectable, validatable, deterministic, and
|
|
121
|
+
reused by many consumers at once (the admin form renderer, AI setup, a signup journey asking the same
|
|
122
|
+
questions, bulk import). Agent tools **do not replace it — they serve and adapt it**:
|
|
123
|
+
|
|
124
|
+
- Keep the declarative schema as the default and source of truth.
|
|
125
|
+
- When you want *dynamic, contextual* behaviour — "which questions for **this** collection?", "the
|
|
126
|
+
config schema as it stands right now", "apply these answers" — expose a small function/tool that
|
|
127
|
+
reads the declaration and returns a tailored result. **Static-first; dynamic only where it earns its
|
|
128
|
+
keep.**
|
|
129
|
+
|
|
130
|
+
There's no rip-and-replace and nothing to migrate off: an app happy with its `app.admin.json` keeps
|
|
131
|
+
it untouched.
|
|
132
|
+
|
|
133
|
+
## What ships now vs staged
|
|
134
|
+
|
|
135
|
+
| Now (V2) | Staged (on the platform agent) |
|
|
136
|
+
|---|---|
|
|
137
|
+
| The `agent` declaration in the manifest | The live agent conversation calling your tools |
|
|
138
|
+
| SDK types for it; tool descriptors surfaced for discovery | `tools/call` streaming, cancellation, cross-app toolbelt arbitration |
|
|
139
|
+
| Your handlers run today via http/event | Human-approval UX for `approval: "require"` |
|
|
140
|
+
|
|
141
|
+
## Adopting this — opt-in, per app, no fleet migration
|
|
142
|
+
|
|
143
|
+
Agent tools are **purely additive**. There is **no migration pass**, and nothing breaks if you never
|
|
144
|
+
adopt them — an existing app on the V2 SDK simply *gains the ability* to add them whenever you want.
|
|
145
|
+
You do **not** touch every app; you turn it on for one app at a time.
|
|
146
|
+
|
|
147
|
+
To turn them on for a single app (say, an FAQ app), once it's on the V2 SDK:
|
|
148
|
+
|
|
149
|
+
1. **Server functions** — add the `functions` block + build target + test harness if the app doesn't
|
|
150
|
+
already have them. See [server-functions.md](server-functions.md).
|
|
151
|
+
2. **Expose tools** — add the `agent` block to the functions you want the agent to call; give each a
|
|
152
|
+
title / description / input schema and an approval mode.
|
|
153
|
+
|
|
154
|
+
That's it — declare and build. The live agent loop is staged (see the table above); until it ships,
|
|
155
|
+
your handlers still run via http/event, so declaring tools now is **forward-compatible, not
|
|
156
|
+
speculative breakage**. `app.admin.json` stays as-is throughout — nothing to retire.
|