ai-sdk-azure-durable-task 0.0.0-stage → 1.0.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/CHANGELOG.md +90 -0
- package/CONTRIBUTING.md +69 -0
- package/LICENSE +22 -0
- package/README.md +325 -2
- package/dist/src/agent.d.ts +110 -0
- package/dist/src/agent.js +1336 -0
- package/dist/src/agent.js.map +1 -0
- package/dist/src/approvals.d.ts +20 -0
- package/dist/src/approvals.js +100 -0
- package/dist/src/approvals.js.map +1 -0
- package/dist/src/client-entry.d.ts +12 -0
- package/dist/src/client-entry.js +7 -0
- package/dist/src/client-entry.js.map +1 -0
- package/dist/src/client.d.ts +109 -0
- package/dist/src/client.js +498 -0
- package/dist/src/client.js.map +1 -0
- package/dist/src/decisions.d.ts +54 -0
- package/dist/src/decisions.js +44 -0
- package/dist/src/decisions.js.map +1 -0
- package/dist/src/durable-chat-transport.d.ts +48 -0
- package/dist/src/durable-chat-transport.js +173 -0
- package/dist/src/durable-chat-transport.js.map +1 -0
- package/dist/src/history-types.d.ts +21 -0
- package/dist/src/history-types.js +6 -0
- package/dist/src/history-types.js.map +1 -0
- package/dist/src/history.d.ts +35 -0
- package/dist/src/history.js +163 -0
- package/dist/src/history.js.map +1 -0
- package/dist/src/http.d.ts +9 -0
- package/dist/src/http.js +67 -0
- package/dist/src/http.js.map +1 -0
- package/dist/src/index.d.ts +25 -0
- package/dist/src/index.js +14 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/logging.d.ts +4 -0
- package/dist/src/logging.js +8 -0
- package/dist/src/logging.js.map +1 -0
- package/dist/src/mcp.d.ts +41 -0
- package/dist/src/mcp.js +112 -0
- package/dist/src/mcp.js.map +1 -0
- package/dist/src/status.d.ts +29 -0
- package/dist/src/status.js +50 -0
- package/dist/src/status.js.map +1 -0
- package/dist/src/steps.d.ts +41 -0
- package/dist/src/steps.js +125 -0
- package/dist/src/steps.js.map +1 -0
- package/dist/src/stores/postgres.d.ts +53 -0
- package/dist/src/stores/postgres.js +140 -0
- package/dist/src/stores/postgres.js.map +1 -0
- package/dist/src/stores/sqlite.d.ts +1 -0
- package/dist/src/stores/sqlite.js +2 -0
- package/dist/src/stores/sqlite.js.map +1 -0
- package/dist/src/streaming/redis.d.ts +33 -0
- package/dist/src/streaming/redis.js +55 -0
- package/dist/src/streaming/redis.js.map +1 -0
- package/dist/src/streaming.d.ts +29 -0
- package/dist/src/streaming.js +64 -0
- package/dist/src/streaming.js.map +1 -0
- package/dist/src/telemetry.d.ts +10 -0
- package/dist/src/telemetry.js +49 -0
- package/dist/src/telemetry.js.map +1 -0
- package/dist/src/testing/index.d.ts +70 -0
- package/dist/src/testing/index.js +165 -0
- package/dist/src/testing/index.js.map +1 -0
- package/dist/src/tools.d.ts +96 -0
- package/dist/src/tools.js +69 -0
- package/dist/src/tools.js.map +1 -0
- package/dist/src/types.d.ts +321 -0
- package/dist/src/types.js +19 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/validation.d.ts +1 -0
- package/dist/src/validation.js +19 -0
- package/dist/src/validation.js.map +1 -0
- package/dist/src/worker-entry.d.ts +7 -0
- package/dist/src/worker-entry.js +6 -0
- package/dist/src/worker-entry.js.map +1 -0
- package/dist/src/worker.d.ts +24 -0
- package/dist/src/worker.js +107 -0
- package/dist/src/worker.js.map +1 -0
- package/docs/Hosted-DTS.md +115 -0
- package/docs/architecture.md +76 -0
- package/docs/decisions/0001-dual-surface-authoring.md +14 -0
- package/docs/decisions/0002-generator-turn-stepper.md +8 -0
- package/docs/decisions/0003-tools-deps-and-mcp.md +19 -0
- package/docs/decisions/0004-approvals-and-status.md +18 -0
- package/docs/decisions/0005-state-streaming-subagents-versioning.md +19 -0
- package/docs/decisions/0006-maf-entity-session-comparison-and-hybrid-model.md +360 -0
- package/docs/decisions/0007-workflow-world-dts-and-durable-functions-sketch.md +191 -0
- package/docs/decisions/README.md +17 -0
- package/docs/development.md +139 -0
- package/docs/getting-started.md +325 -0
- package/docs/limitations.md +130 -0
- package/docs/operations.md +178 -0
- package/docs/security-and-tenancy.md +41 -0
- package/docs/support-matrix.md +26 -0
- package/docs/user-guide.md +1120 -0
- package/package.json +129 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Interactive Next.js `useChat` starter with native approval/denial controls,
|
|
13
|
+
run ID, reader status/reconnect and a matching AI SDK React dependency.
|
|
14
|
+
- Supported public settings wrapper/getter defaults for `attachDurability` and
|
|
15
|
+
`extractToolLoopAgentSettings`, with explicit overrides and no reads of the
|
|
16
|
+
current native SDK's private settings field.
|
|
17
|
+
- `npm run test:dts` for authenticated Azure Managed DTS E2E qualification,
|
|
18
|
+
sharing the emulator scenarios and adding durable-tool/native attachment,
|
|
19
|
+
child/custom orchestration, parallel approvals and claim-check wire assertions.
|
|
20
|
+
Opt-in restricted traces record root/child instance IDs and timings.
|
|
21
|
+
- `DurableTaskAgent` / `defineDurableTaskAgent` as the primary names; `DurableAgent` /
|
|
22
|
+
`defineDurableAgent` remain as deprecated, identity-preserving aliases.
|
|
23
|
+
- AI SDK 6 and 7 compatibility, including V4 model test helpers and SDK 7 option aliases
|
|
24
|
+
(`instructions`, `runtimeContext`, `telemetry`, `include`).
|
|
25
|
+
- Native provider retries, recoverable tool errors, explicit fatal errors and configurable
|
|
26
|
+
step budgets with graceful exhaustion.
|
|
27
|
+
- Native tool approval/denial parts, parent-visible child approvals and parallel approval
|
|
28
|
+
batches that publish each decision immediately under a shared timeout.
|
|
29
|
+
- Automatic 512,000-byte generation budgets and worker-side claim checks for tool outputs
|
|
30
|
+
above 32,768 bytes when a history store is configured.
|
|
31
|
+
- Turn-local `prepareStep`, parsed agent/tool context schemas and native final-event
|
|
32
|
+
aggregation.
|
|
33
|
+
- Browser transport: persisted approval/deferred tokens, tool-result submissions,
|
|
34
|
+
framed mid-part stream resume and latest-message-only submission by default.
|
|
35
|
+
- Optional `logger` on `MCPClientPool`, `PostgresHistoryStore`/`PostgresDecisionStore`
|
|
36
|
+
and background MCP cleanup; callers handle PostgreSQL/Redis connection errors.
|
|
37
|
+
|
|
38
|
+
### Changed
|
|
39
|
+
|
|
40
|
+
- Package name and source repository are now `ai-sdk-azure-durable-task` in
|
|
41
|
+
[vercel-labs/ai-sdk-azure-durable-task](https://github.com/vercel-labs/ai-sdk-azure-durable-task).
|
|
42
|
+
Update package installations and all subpath imports to the new name.
|
|
43
|
+
- Removed Microsoft-specific contribution, support, and internal release pipeline
|
|
44
|
+
boilerplate; package qualification uses independent public-registry consumers.
|
|
45
|
+
- Browser transport documents the exact native `ChatTransport` trigger contract;
|
|
46
|
+
deprecated direct-call overloads preserve legacy tool-result/approval triggers.
|
|
47
|
+
- Public Preview (`0.1.0`): APIs, behaviors, packaging and support may change or
|
|
48
|
+
be retired before General Availability.
|
|
49
|
+
- `ai` (`>=6.0.303 <8.0.0`) is the only peer dependency. PostgreSQL/Redis
|
|
50
|
+
adapters use caller-supplied structural pools/connected clients; callers own
|
|
51
|
+
connection setup, errors and shutdown. `connectionString`/`url` construction
|
|
52
|
+
is removed. `MCPClientPool` now requires a caller-supplied structural client
|
|
53
|
+
factory instead of an MCP configuration object.
|
|
54
|
+
- Removed app workspaces and `pg`, `@types/pg`, `redis`, `@ai-sdk/mcp` dependencies;
|
|
55
|
+
Next.js/worker integration lives in SDK docs/examples and direct SDK tests.
|
|
56
|
+
All direct/development dependencies are pinned exactly. Patched PostCSS remains
|
|
57
|
+
development-only through Vitest/Vite, not in the published SDK dependency graph.
|
|
58
|
+
- UI stream deltas are coalesced; request/response bodies are excluded from telemetry by
|
|
59
|
+
default and trace headers are opt-in.
|
|
60
|
+
- Repository tooling targets the public npm registry; the internal registry
|
|
61
|
+
configuration, lockfile normalization script and `check:package` registry policy
|
|
62
|
+
were removed.
|
|
63
|
+
|
|
64
|
+
### Fixed
|
|
65
|
+
|
|
66
|
+
- HTTPS example runtimes now authenticate both Azure-managed builders instead
|
|
67
|
+
of passing anonymous credentials; Azure CLI acceptance no longer requires
|
|
68
|
+
unrelated service-principal environment variables.
|
|
69
|
+
- Parallel approval gates re-arm only the invalid-token waiter and no longer lose sibling
|
|
70
|
+
approvals; batch timeouts fire once and publish every denial.
|
|
71
|
+
- Session turns and parked approval streams close without reader timeouts; resume uses
|
|
72
|
+
the consumed cursor.
|
|
73
|
+
- Sources and finish reasons are preserved through the stream pipeline.
|
|
74
|
+
|
|
75
|
+
## [0.1.0]
|
|
76
|
+
|
|
77
|
+
Initial experimental release. This entry does not announce public npm publication or
|
|
78
|
+
hosted production qualification.
|
|
79
|
+
|
|
80
|
+
### Added
|
|
81
|
+
|
|
82
|
+
- `DurableAgent` and `runInOrchestration` with native AI SDK tools, model turns,
|
|
83
|
+
structured output, approvals and deterministic activity checkpoints.
|
|
84
|
+
- `durableGenerateText` for durable text generation inside orchestrations.
|
|
85
|
+
- Separate `/client`, `/worker`, `/transport` and `/testing` entry points isolating Node
|
|
86
|
+
clients, long-lived workers, browser UI transport and test harnesses.
|
|
87
|
+
- `/stores/sqlite` and `/stores/postgres` history storage; `/streaming/redis` shared UI
|
|
88
|
+
event broker.
|
|
89
|
+
- Next.js and worker starter apps demonstrating split hosting and shared storage.
|
|
90
|
+
- Operational documentation and ADRs 0001–0007.
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Contributions and suggestions are welcome in
|
|
4
|
+
[vercel-labs/ai-sdk-azure-durable-task](https://github.com/vercel-labs/ai-sdk-azure-durable-task).
|
|
5
|
+
Keep discussions respectful and focused on the project.
|
|
6
|
+
Do not report vulnerabilities in public issues or pull requests; see
|
|
7
|
+
[security reporting](README.md#security).
|
|
8
|
+
|
|
9
|
+
## Prerequisites
|
|
10
|
+
|
|
11
|
+
- Node.js **>=22.15.0** and npm; Node 22 and 24 are the CI targets.
|
|
12
|
+
- Docker for the DTS Emulator and optional PostgreSQL/Redis integration lanes.
|
|
13
|
+
- `npm ci` installs from the default public npm registry; no registry
|
|
14
|
+
configuration is required.
|
|
15
|
+
|
|
16
|
+
## Development and validation
|
|
17
|
+
|
|
18
|
+
From the repository root:
|
|
19
|
+
|
|
20
|
+
```powershell
|
|
21
|
+
npm ci
|
|
22
|
+
npm run build
|
|
23
|
+
npm run typecheck
|
|
24
|
+
npm test
|
|
25
|
+
npm run check:package
|
|
26
|
+
npm run examples
|
|
27
|
+
npm audit
|
|
28
|
+
npm run qualify:artifact -- --ai-version=6.0.303
|
|
29
|
+
npm run qualify:artifact -- --ai-version=7.0.172
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
For live gRPC integration, start the emulator and run the explicit lane:
|
|
33
|
+
|
|
34
|
+
```powershell
|
|
35
|
+
docker run --rm -d --name ai-sdk-azure-durable-task-emulator -e DTS_USE_DYNAMIC_TASK_HUBS=true -p 127.0.0.1:18080:8080 mcr.microsoft.com/dts/dts-emulator:latest
|
|
36
|
+
$env:DTS_EMULATOR = "127.0.0.1:18080"
|
|
37
|
+
$env:DTS_TASKHUB = "vercel-ai"
|
|
38
|
+
npm run test:emulator
|
|
39
|
+
npm run examples:emulator
|
|
40
|
+
docker stop ai-sdk-azure-durable-task-emulator
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Wait for the emulator to listen before running tests. Optional PostgreSQL/Redis
|
|
44
|
+
lanes require `DATABASE_URL` and `REDIS_URL`; never commit credentials. See
|
|
45
|
+
[development](docs/development.md) and [the hosting guide](docs/user-guide.md#reliable-streaming-and-nextjs-usechat).
|
|
46
|
+
Offline skips do not qualify an unavailable integration or hosted deployment.
|
|
47
|
+
|
|
48
|
+
For real Azure Managed DTS qualification, set `DTS_ENDPOINT` to the scheduler's
|
|
49
|
+
actual HTTPS endpoint and `DTS_TASKHUB` to an authorized hub, then run
|
|
50
|
+
`npm run test:dts`. Both builders use `DefaultAzureCredential`; a locally
|
|
51
|
+
signed-in developer can choose `DTS_CREDENTIAL=azure-cli`. The explicit lane
|
|
52
|
+
fails without hosted configuration and never falls back to the emulator.
|
|
53
|
+
See [hosted DTS](docs/Hosted-DTS.md) for complete coverage, RBAC and restricted
|
|
54
|
+
validation evidence.
|
|
55
|
+
|
|
56
|
+
After dependency updates, run `npm install` and commit the resulting
|
|
57
|
+
`package-lock.json`. `npm run check:package` validates the lockfile license
|
|
58
|
+
metadata, exact dependency pins and absence of app/driver dependencies, together with the import boundaries and the
|
|
59
|
+
tarball allowlist. `npm ci` installs the locked versions from the public registry.
|
|
60
|
+
|
|
61
|
+
## Pull request checklist
|
|
62
|
+
|
|
63
|
+
- Explain the change and link a related issue.
|
|
64
|
+
- Add or update tests and relevant documentation; preserve deterministic replay
|
|
65
|
+
and public import boundaries.
|
|
66
|
+
- Record the exact validation commands and their results, including skips.
|
|
67
|
+
- Update [CHANGELOG.md](CHANGELOG.md) for user-visible changes.
|
|
68
|
+
- Describe breaking changes, retained-run compatibility and migration steps.
|
|
69
|
+
- Follow any contribution checks configured by the repository maintainers.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
Copyright (c) 2026 Vercel, Inc. and contributors.
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,326 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ai-sdk-azure-durable-task
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The [Vercel AI SDK](https://ai-sdk.dev/) (`ai`) provides a programming model for
|
|
4
|
+
building AI agents and tool-calling workflows in TypeScript and JavaScript.
|
|
5
|
+
`ai-sdk-azure-durable-task` extends that model with stateful, durable
|
|
6
|
+
execution powered by the [Durable Task SDK for JavaScript (`@microsoft/durabletask-js`)](https://github.com/microsoft/durabletask-js)
|
|
7
|
+
and [Azure Durable Task Scheduler (DTS)](https://learn.microsoft.com/azure/azure-functions/durable/durable-task-scheduler/durable-task-scheduler).
|
|
8
|
+
|
|
9
|
+
Source: [vercel-labs/ai-sdk-azure-durable-task](https://github.com/vercel-labs/ai-sdk-azure-durable-task).
|
|
10
|
+
|
|
11
|
+
> [!NOTE]
|
|
12
|
+
> **Public Preview:** `ai-sdk-azure-durable-task` version `0.1.0` is
|
|
13
|
+
> pre-1.0 Preview software, provided for evaluation and feedback. APIs, behaviors,
|
|
14
|
+
> packaging, and support may change or be retired before General Availability.
|
|
15
|
+
> This is not a General Availability release; see the [support matrix](docs/support-matrix.md).
|
|
16
|
+
|
|
17
|
+
Author agents with familiar `ToolLoopAgent` settings and native tools, providers,
|
|
18
|
+
middleware, and structured outputs. The extension executes `generateText` or
|
|
19
|
+
`streamText` on a Durable Task worker, checkpoints model steps and tool
|
|
20
|
+
activities, and connects browser applications through a durable `useChat`
|
|
21
|
+
transport. Completed checkpoints survive worker restarts; sessions and approvals
|
|
22
|
+
do not depend on an HTTP request staying open.
|
|
23
|
+
|
|
24
|
+
Core capabilities:
|
|
25
|
+
|
|
26
|
+
- **Durable execution and recovery:** checkpoint model steps and tool activities.
|
|
27
|
+
- **Persistent conversations:** thread history, multi-turn sessions, and automatic
|
|
28
|
+
generation rollover with `continueAsNew`.
|
|
29
|
+
- **Human-in-the-loop:** durable approval gates and deferred browser tools.
|
|
30
|
+
- **Multi-agent workflows:** child agents and deterministic custom orchestrations.
|
|
31
|
+
- **Reliable UI delivery:** committed-step streaming, cursor resumption, and
|
|
32
|
+
Next.js App Router integration.
|
|
33
|
+
- **Operational controls:** retries, timeouts, typed dependencies, versioned
|
|
34
|
+
contracts, migrations, telemetry, and test harnesses.
|
|
35
|
+
|
|
36
|
+
| Capability | Ordinary agent | Durable agent |
|
|
37
|
+
| --- | --- | --- |
|
|
38
|
+
| Conversation history | Application manages persistence | Persistent thread history with a `HistoryStore` |
|
|
39
|
+
| Failure recovery | Application reconstructs interrupted work | Replay resumes from committed checkpoints |
|
|
40
|
+
| Multi-instance scale-out | Application coordinates state | Compatible workers resume scheduler-managed work |
|
|
41
|
+
| Multi-agent orchestrations | Application coordinates calls | Deterministic, checkpointed workflows |
|
|
42
|
+
| Human-in-the-loop | Application manages waits and recovery | Durable external-event waits with optional timeouts |
|
|
43
|
+
| Hosting | In-process model/tool loop | Long-lived Node.js worker; web routes act as clients |
|
|
44
|
+
|
|
45
|
+
Durable activities execute **at least once**, not exactly once. Use the supplied
|
|
46
|
+
idempotency key for external mutations. Local in-memory testing does not persist
|
|
47
|
+
through process exit; production history and UI delivery need shared storage.
|
|
48
|
+
|
|
49
|
+
## Packages and installation
|
|
50
|
+
|
|
51
|
+
```powershell
|
|
52
|
+
npm install ai-sdk-azure-durable-task ai zod @microsoft/durabletask-js @microsoft/durabletask-js-azuremanaged
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Use Node.js **22.15 or later**. The AI SDK peer range is `>=6.0.303 <8.0.0`
|
|
56
|
+
(SDK 6 and 7). Install your chosen model provider separately. Until the package
|
|
57
|
+
is published to your registry, use a built source checkout or a local tarball;
|
|
58
|
+
see [local package installation](docs/development.md#local-package-installation). Package self-imports below
|
|
59
|
+
work inside this repository after `npm ci` and `npm run build`.
|
|
60
|
+
|
|
61
|
+
The only peer dependency is `ai`. PostgreSQL, Redis, and MCP integrations accept
|
|
62
|
+
caller-supplied structural TypeScript clients; the SDK does not install or import
|
|
63
|
+
`pg`, `redis`, or `@ai-sdk/mcp`. Install your chosen clients in your application.
|
|
64
|
+
All entries below are
|
|
65
|
+
subpath exports of the **same package**, not separate packages to install.
|
|
66
|
+
|
|
67
|
+
| Import | Purpose | Runtime environment |
|
|
68
|
+
| --- | --- | --- |
|
|
69
|
+
| `ai-sdk-azure-durable-task` | Agents, tools, policies, history, and orchestration helpers | Node.js |
|
|
70
|
+
| `ai-sdk-azure-durable-task/client` | `createDurableClient`, handles, and decisions without worker code | Node.js web routes / console clients |
|
|
71
|
+
| `ai-sdk-azure-durable-task/worker` | Agent registration and `createWorker` lifecycle | Long-lived Node.js services |
|
|
72
|
+
| `ai-sdk-azure-durable-task/transport` | `DurableChatTransport` for `useChat` | Browser |
|
|
73
|
+
| `ai-sdk-azure-durable-task/stores/postgres` | Shared history/decisions; caller supplies a `PgPoolLike` (e.g. `pg.Pool`) | Node.js |
|
|
74
|
+
| `ai-sdk-azure-durable-task/stores/sqlite` | Local SQLite history store | Node.js; built-in `node:sqlite` |
|
|
75
|
+
| `ai-sdk-azure-durable-task/streaming/redis` | Shared stream publisher/subscriber; caller supplies a connected `RedisClientLike` | Node.js |
|
|
76
|
+
| `ai-sdk-azure-durable-task/testing` | In-memory Durable Task harness and scripted/mock models | Node.js tests |
|
|
77
|
+
|
|
78
|
+
## Getting started
|
|
79
|
+
|
|
80
|
+
Build a durable customer-support agent with a demo credit tool and a
|
|
81
|
+
human-in-the-loop approval gate in the
|
|
82
|
+
**[Getting Started Guide](docs/getting-started.md)**. Run it against the local
|
|
83
|
+
Azure Durable Task Scheduler (DTS) Emulator, add multi-turn conversation history,
|
|
84
|
+
and inspect execution in the DTS Dashboard. The **[Developer Guide](docs/user-guide.md)**
|
|
85
|
+
explains authoring, tools, sessions, approvals, streaming, and deployment.
|
|
86
|
+
|
|
87
|
+
For a zero-setup first run, save this as `hello.ts` and run `npx tsx hello.ts`
|
|
88
|
+
from the built source checkout or a project with the package installed.
|
|
89
|
+
The scripted model needs no provider credentials.
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
import { ToolLoopAgent } from "ai";
|
|
93
|
+
import { attachDurability } from "ai-sdk-azure-durable-task";
|
|
94
|
+
import {
|
|
95
|
+
createInMemoryHarness, scriptedModel, text,
|
|
96
|
+
} from "ai-sdk-azure-durable-task/testing";
|
|
97
|
+
|
|
98
|
+
const settings = {
|
|
99
|
+
model: scriptedModel(() => text("Hello from a durable agent!")),
|
|
100
|
+
instructions: "Respond with a short greeting.",
|
|
101
|
+
};
|
|
102
|
+
const native = new ToolLoopAgent(settings);
|
|
103
|
+
const agent = attachDurability(native, { name: "hello", ...settings });
|
|
104
|
+
const harness = createInMemoryHarness();
|
|
105
|
+
agent.register(harness.worker);
|
|
106
|
+
await harness.worker.start();
|
|
107
|
+
try {
|
|
108
|
+
const result = await agent.client(harness.client).run("Hello");
|
|
109
|
+
console.log(result.text);
|
|
110
|
+
} finally {
|
|
111
|
+
await harness.close();
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
`attachDurability` extracts the native agent's public tools; retain model,
|
|
116
|
+
instructions, hooks, and other settings explicitly as above. It returns a new
|
|
117
|
+
durable agent; it does not intercept the original agent's methods. Alternatively,
|
|
118
|
+
construct `new DurableTaskAgent({ name, model, tools, ... })` directly.
|
|
119
|
+
Application-owned `{ tools, settings }` wrappers and public settings getters can
|
|
120
|
+
provide supported defaults: `attachDurability({ tools: native.tools, settings },
|
|
121
|
+
{ name: "hello" })`. Explicit options win. Current SDK agents' private settings
|
|
122
|
+
fields are deliberately not read; see [migration details](docs/user-guide.md#migration-from-native-agents).
|
|
123
|
+
|
|
124
|
+
To use the local **DTS Emulator** instead of the in-memory harness:
|
|
125
|
+
|
|
126
|
+
```powershell
|
|
127
|
+
docker run --name dts-vercel-ai -d -e DTS_USE_DYNAMIC_TASK_HUBS=true -p 127.0.0.1:8080:8080 -p 127.0.0.1:8082:8082 mcr.microsoft.com/dts/dts-emulator:latest
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Register the agent on a `DurableTaskAzureManagedWorkerBuilder` and connect a
|
|
131
|
+
`DurableTaskAzureManagedClientBuilder` to `http://localhost:8080`, task hub
|
|
132
|
+
`vercel-ai`, with `null` credentials for the emulator. The
|
|
133
|
+
[complete tutorial](docs/getting-started.md#step-3-create-your-first-durable-agent)
|
|
134
|
+
shows runnable worker/client wiring. Open the DTS Dashboard at
|
|
135
|
+
**http://localhost:8082** to inspect persisted execution.
|
|
136
|
+
|
|
137
|
+
## Hosting models
|
|
138
|
+
|
|
139
|
+
### Next.js App Router and a separate worker
|
|
140
|
+
|
|
141
|
+
Web routes are **clients, not workers**. Use `createDurableClient` from `/client`
|
|
142
|
+
in Node.js App Router routes, and run model/tool execution on a separate,
|
|
143
|
+
long-lived Node.js Durable Task worker. Never start a worker in a route handler
|
|
144
|
+
or rely on request lifetime/background promises. Client/worker are not
|
|
145
|
+
Edge-compatible; only `/transport` is browser-safe.
|
|
146
|
+
|
|
147
|
+
```mermaid
|
|
148
|
+
flowchart LR
|
|
149
|
+
Browser["useChat / approval UI"] --> Route["Next.js Node routes: auth + tenant ownership"]
|
|
150
|
+
Route --> DTS["Azure DTS / local emulator"]
|
|
151
|
+
DTS <--> Worker["Long-lived Node worker: models + tools"]
|
|
152
|
+
Route <--> Shared["Postgres history + decisions / Redis UI stream"]
|
|
153
|
+
Worker <--> Shared
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
See the [split-topology guide](docs/user-guide.md#reliable-streaming-and-nextjs-usechat)
|
|
157
|
+
and [route example](examples/09_nextjs_route_client.ts). Routes and workers need their
|
|
158
|
+
own scheduler authentication, least-privilege permissions, and network access.
|
|
159
|
+
Use shared PostgreSQL history/decisions and Redis UI events across hosts.
|
|
160
|
+
|
|
161
|
+
For example, install `pg` and `redis` in the **application**, then pass your
|
|
162
|
+
own clients to the adapters (namespace and tenant must match on both hosts):
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
import pg from "pg";
|
|
166
|
+
import { createClient } from "redis";
|
|
167
|
+
import { PostgresHistoryStore } from "ai-sdk-azure-durable-task/stores/postgres";
|
|
168
|
+
import { RedisStreamBroker } from "ai-sdk-azure-durable-task/streaming/redis";
|
|
169
|
+
|
|
170
|
+
const pool = new pg.Pool({ connectionString: process.env.DATABASE_URL });
|
|
171
|
+
const client = createClient({ url: process.env.REDIS_URL });
|
|
172
|
+
client.on("error", error => console.error("Redis connection error", error.message));
|
|
173
|
+
await client.connect();
|
|
174
|
+
const scope = { namespace: "support-app", tenantId: "authenticated-tenant" };
|
|
175
|
+
const history = new PostgresHistoryStore({ pool, ...scope });
|
|
176
|
+
const broker = new RedisStreamBroker({ client, ...scope });
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
The application configures TLS, authentication and error handlers and closes
|
|
180
|
+
`pool`/`client` after stopping all consumers. Adapter `close()` does not close
|
|
181
|
+
caller-owned connections. See the [shared-state factory](docs/user-guide.md#reliable-streaming-and-nextjs-usechat)
|
|
182
|
+
for initialization and cleanup. Sample apps are intentionally outside this
|
|
183
|
+
SDK repository; Next.js, PostgreSQL and Redis are not SDK dependencies.
|
|
184
|
+
|
|
185
|
+
### Standalone workers and console apps
|
|
186
|
+
|
|
187
|
+
A console app can register agents, start a worker, and use a Durable Task client
|
|
188
|
+
in the same process. A supervised worker service can run independently in
|
|
189
|
+
containers, AKS, Azure Container Apps, or another Node.js host with scheduler
|
|
190
|
+
connectivity. `createWorker` provides startup, health/readiness, and shutdown
|
|
191
|
+
controls. See [hosted DTS setup](docs/Hosted-DTS.md) and
|
|
192
|
+
[operations](docs/operations.md) before deployment.
|
|
193
|
+
|
|
194
|
+
## Deterministic multi-agent orchestrations
|
|
195
|
+
|
|
196
|
+
| Pattern | Description |
|
|
197
|
+
| --- | --- |
|
|
198
|
+
| Sequential chaining | Call agents in order and pass outputs forward |
|
|
199
|
+
| Parallel fan-out/fan-in | Schedule multiple child tasks and aggregate results |
|
|
200
|
+
| Conditional branching | Branch on checkpointed, structured agent output |
|
|
201
|
+
| Human-in-the-loop approvals | Pause for external decisions with optional timeouts |
|
|
202
|
+
|
|
203
|
+
Agents can act as tools of another agent or participate in custom Durable Task
|
|
204
|
+
generator orchestrations. This factory accepts an application-provided model:
|
|
205
|
+
|
|
206
|
+
```ts
|
|
207
|
+
import type { LanguageModel } from "ai";
|
|
208
|
+
import type { OrchestrationContext } from "@microsoft/durabletask-js";
|
|
209
|
+
import {
|
|
210
|
+
DurableTaskAgent, durableGenerateText,
|
|
211
|
+
} from "ai-sdk-azure-durable-task";
|
|
212
|
+
|
|
213
|
+
export function writingWorkflow(model: LanguageModel) {
|
|
214
|
+
const child = new DurableTaskAgent({ name: "writer", model });
|
|
215
|
+
const editor = new DurableTaskAgent({
|
|
216
|
+
name: "editor", model, tools: { draft: child.asTool() },
|
|
217
|
+
});
|
|
218
|
+
async function* workflow(ctx: OrchestrationContext, topic: string) {
|
|
219
|
+
const draft = yield* child.runInOrchestration(ctx, topic);
|
|
220
|
+
const edited = yield* durableGenerateText(ctx, {
|
|
221
|
+
agent: editor, prompt: `Improve this draft: ${draft.text}`,
|
|
222
|
+
});
|
|
223
|
+
return edited.text;
|
|
224
|
+
}
|
|
225
|
+
return { child, editor, workflow };
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Register both agents and the custom orchestrator before starting the worker.
|
|
230
|
+
Keep orchestration code deterministic: model/provider calls and external I/O
|
|
231
|
+
belong in activities. See the [multi-agent guide](docs/user-guide.md#multi-agent-and-custom-orchestrations)
|
|
232
|
+
and [graph example](examples/04_multi_agent_graph.ts).
|
|
233
|
+
|
|
234
|
+
## Documentation
|
|
235
|
+
|
|
236
|
+
| Guide | Contents |
|
|
237
|
+
| --- | --- |
|
|
238
|
+
| [Getting Started Guide](docs/getting-started.md) | Install, emulator, first agent, tools, approvals, and sessions |
|
|
239
|
+
| [Developer Guide (How to Use the Library)](docs/user-guide.md) | APIs, policies, dependencies, state, streaming, versioning, and testing |
|
|
240
|
+
| [Architecture & Execution Model](docs/architecture.md) | Replay, checkpoints, wire boundaries, and composition |
|
|
241
|
+
| [Azure Durable Task Scheduler (Hosted DTS) Setup](docs/Hosted-DTS.md) | Endpoints, credentials, topology, and hosted validation |
|
|
242
|
+
| [Operations & Production Readiness](docs/operations.md) | Lifecycle, telemetry, health checks, retention, and failure handling |
|
|
243
|
+
| [Security & Multi-Tenancy](docs/security-and-tenancy.md) | Authentication, authorization, tenancy, and approval boundaries |
|
|
244
|
+
| [Support Matrix & Compatibility](docs/support-matrix.md) | Supported interfaces, dependency ranges, and validation scope |
|
|
245
|
+
|
|
246
|
+
## Repository layout
|
|
247
|
+
|
|
248
|
+
```text
|
|
249
|
+
src/ Agents, clients, workers, stores, and streaming
|
|
250
|
+
src/testing/ In-memory harness and model fixtures
|
|
251
|
+
tests/ Unit, contract, emulator, and hosted tests
|
|
252
|
+
fixtures/ Built-package consumer and type checks
|
|
253
|
+
examples/ Console examples and route-only integration
|
|
254
|
+
docs/ Tutorials, usage guides, architecture, and operations
|
|
255
|
+
scripts/ Validation, packaging, and example runners
|
|
256
|
+
benchmarks/ History scaling measurements
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
## Samples
|
|
260
|
+
|
|
261
|
+
- [Console examples](examples/README.md): greeting, tools, approvals, multi-agent
|
|
262
|
+
graphs, vacation booking, conversations, versioning, and crash recovery.
|
|
263
|
+
- [Next.js and worker integration](docs/user-guide.md#reliable-streaming-and-nextjs-usechat): shared PostgreSQL/Redis,
|
|
264
|
+
authenticated route boundaries, and resumable browser transport.
|
|
265
|
+
- [Route-only integration](examples/09_nextjs_route_client.ts): Node client
|
|
266
|
+
without importing worker/model code.
|
|
267
|
+
|
|
268
|
+
## Build and test
|
|
269
|
+
|
|
270
|
+
From a source checkout:
|
|
271
|
+
|
|
272
|
+
```powershell
|
|
273
|
+
npm ci
|
|
274
|
+
npm run build
|
|
275
|
+
npm run typecheck
|
|
276
|
+
npm test
|
|
277
|
+
npm run check:package
|
|
278
|
+
npm run examples
|
|
279
|
+
npm audit
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
No repository registry configuration is required. See
|
|
283
|
+
[development](docs/development.md) and [contributing](CONTRIBUTING.md).
|
|
284
|
+
`check:package` verifies import boundaries, built consumers, and packaged docs;
|
|
285
|
+
it does not publish a package.
|
|
286
|
+
|
|
287
|
+
## Integration tests
|
|
288
|
+
|
|
289
|
+
Unit tests use scripted models and require no provider keys. Emulator tests
|
|
290
|
+
require Docker/DTS; the repository runner defaults to `127.0.0.1:18080` and task
|
|
291
|
+
hub `vercel-ai`, independently of the tutorial's `8080` port.
|
|
292
|
+
|
|
293
|
+
```powershell
|
|
294
|
+
npm run test:emulator
|
|
295
|
+
npm run examples:emulator
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
Hosted tests are opt-in:
|
|
299
|
+
|
|
300
|
+
```powershell
|
|
301
|
+
npm test -- tests/hosted.test.ts
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
Configure `DTS_HOSTED_ENDPOINT`, `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, and an
|
|
305
|
+
authorized credential chain; `DTS_HOSTED_TASKHUB` selects the hub and
|
|
306
|
+
`DATABASE_URL` enables the PostgreSQL case. See [hosted setup](docs/Hosted-DTS.md).
|
|
307
|
+
Missing configuration skips the hosted lane; local tests alone do not establish
|
|
308
|
+
hosted, commercial-provider, or high-availability qualification.
|
|
309
|
+
|
|
310
|
+
## Contributing
|
|
311
|
+
|
|
312
|
+
This project welcomes contributions and suggestions. See [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
313
|
+
for setup, validation, and the PR checklist.
|
|
314
|
+
|
|
315
|
+
## Security
|
|
316
|
+
|
|
317
|
+
Do not disclose vulnerabilities, credentials, or customer data in public issues.
|
|
318
|
+
Use [GitHub private vulnerability reporting](https://github.com/vercel-labs/ai-sdk-azure-durable-task/security/advisories/new)
|
|
319
|
+
when available, or ask a repository maintainer for a private reporting channel.
|
|
320
|
+
|
|
321
|
+
## Support
|
|
322
|
+
|
|
323
|
+
For bug reports and feature requests, open an issue in
|
|
324
|
+
[vercel-labs/ai-sdk-azure-durable-task](https://github.com/vercel-labs/ai-sdk-azure-durable-task/issues).
|
|
325
|
+
Review the [support matrix](docs/support-matrix.md) and
|
|
326
|
+
[known limitations](docs/limitations.md) before deploying.
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { type ToolSet, type Tool, type OutputInterface } from "ai";
|
|
2
|
+
import { type OrchestrationContext, type Task } from "@microsoft/durabletask-js";
|
|
3
|
+
import { type DurableToolOptions, type DurableToolConfig, type DurableToolDefinition, type CompatibleTools } from "./tools.js";
|
|
4
|
+
import { type AgentConfig, type WorkerRegistration, type RunSettings, type RunArguments, type RunState, type WireResult, type DTSClient, type DurableCallSettings, type DurableGenerateTextOptions } from "./types.js";
|
|
5
|
+
import { DurableAgentClient } from "./client.js";
|
|
6
|
+
import { type TraceContext } from "./telemetry.js";
|
|
7
|
+
export interface ChildToolContext {
|
|
8
|
+
durable: DurableToolOptions<unknown>["durable"];
|
|
9
|
+
experimental_context: unknown;
|
|
10
|
+
runtimeContext?: unknown;
|
|
11
|
+
toolsContext?: Record<string, unknown>;
|
|
12
|
+
depsInput: unknown;
|
|
13
|
+
traceContext?: TraceContext;
|
|
14
|
+
}
|
|
15
|
+
export type ChildToolOptions<DI, O, TO> = {
|
|
16
|
+
description?: string;
|
|
17
|
+
version?: string;
|
|
18
|
+
toModelOutput?: (result: OrchestrationResult<O>) => TO;
|
|
19
|
+
} & (undefined extends DI ? {
|
|
20
|
+
depsInput?: DI | ((input: {
|
|
21
|
+
prompt: string;
|
|
22
|
+
}, context: ChildToolContext) => DI);
|
|
23
|
+
} : {
|
|
24
|
+
depsInput: DI | ((input: {
|
|
25
|
+
prompt: string;
|
|
26
|
+
}, context: ChildToolContext) => DI);
|
|
27
|
+
});
|
|
28
|
+
type OrchestrationResult<O> = Omit<WireResult, "output"> & {
|
|
29
|
+
output: O;
|
|
30
|
+
};
|
|
31
|
+
export declare class DurableTaskAgent<T extends ToolSet = {}, O = string, DI = undefined, D = undefined> {
|
|
32
|
+
readonly orchestratorName: string;
|
|
33
|
+
readonly config: AgentConfig<T, O, DI, D>;
|
|
34
|
+
private readonly registrations;
|
|
35
|
+
constructor(config: AgentConfig<T, O, DI, D>);
|
|
36
|
+
versionConfig(version: string): AgentConfig<T, O, DI, D>;
|
|
37
|
+
private messages;
|
|
38
|
+
private stepHistory;
|
|
39
|
+
private save;
|
|
40
|
+
private finishStep;
|
|
41
|
+
private finishRun;
|
|
42
|
+
private finalizeOutput;
|
|
43
|
+
private modelStep;
|
|
44
|
+
private publishUI;
|
|
45
|
+
private executeTool;
|
|
46
|
+
private observeToolBatch;
|
|
47
|
+
private toolFailure;
|
|
48
|
+
private effectKey;
|
|
49
|
+
private policyFor;
|
|
50
|
+
private collectRegistration;
|
|
51
|
+
register<W extends WorkerRegistration>(worker: W): W;
|
|
52
|
+
private install;
|
|
53
|
+
client(client: DTSClient): DurableAgentClient<T, O, DI, D>;
|
|
54
|
+
initialState(prompt: string, options?: RunSettings<DI>): RunState;
|
|
55
|
+
runInOrchestration(ctx: OrchestrationContext, prompt: string, ...args: RunArguments<DI>): AsyncGenerator<Task<unknown>, OrchestrationResult<O>, unknown>;
|
|
56
|
+
private engine;
|
|
57
|
+
private executeEngine;
|
|
58
|
+
asTool<TO = O>(...args: undefined extends DI ? [options?: ChildToolOptions<DI, O, TO>] : [options: ChildToolOptions<DI, O, TO>]): Tool<{
|
|
59
|
+
prompt: string;
|
|
60
|
+
}, TO>;
|
|
61
|
+
}
|
|
62
|
+
type InheritableAgentSetting = "model" | "instructions" | "system" | "stopWhen" | "prepareStep" | "toolApproval" | "output" | "onStepFinish" | "onStepEnd" | "onFinish" | "onEnd" | "experimental_telemetry" | "telemetry" | "experimental_context" | "runtimeContext" | "toolsContext" | "contextSchema" | "toolChoice" | "activeTools" | "providerOptions" | "maxRetries" | keyof DurableCallSettings;
|
|
63
|
+
type PublicAgentSettings<O> = {
|
|
64
|
+
model: AgentConfig["model"];
|
|
65
|
+
output?: OutputInterface<O, unknown, unknown>;
|
|
66
|
+
} & Partial<Record<Exclude<InheritableAgentSetting, "model" | "output">, unknown>>;
|
|
67
|
+
type PublicSettingsAgent<T extends ToolSet, O, DI, D> = {
|
|
68
|
+
tools: T & CompatibleTools<T, NoInfer<D>>;
|
|
69
|
+
readonly settings: PublicAgentSettings<O>;
|
|
70
|
+
};
|
|
71
|
+
type AttachOptions<T extends ToolSet, O, DI, D> = Omit<AgentConfig<T, O, DI, D>, "tools" | "model"> & {
|
|
72
|
+
model?: AgentConfig<T, O, DI, D>["model"];
|
|
73
|
+
};
|
|
74
|
+
export declare function attachDurability<T extends ToolSet, O = string, DI = undefined, D = undefined>(config: AgentConfig<T, O, DI, D>): DurableTaskAgent<T, O, DI, D>;
|
|
75
|
+
export declare function attachDurability<T extends ToolSet, O = string, DI = undefined, D = undefined>(agent: PublicSettingsAgent<T, O, DI, D>, config: AttachOptions<T, O, DI, D>): DurableTaskAgent<T, O, DI, D>;
|
|
76
|
+
export declare function attachDurability<T extends ToolSet, O = string, DI = undefined, D = undefined>(agent: {
|
|
77
|
+
tools: T & CompatibleTools<T, NoInfer<D>>;
|
|
78
|
+
}, config: Omit<AgentConfig<T, O, DI, D>, "tools">): DurableTaskAgent<T, O, DI, D>;
|
|
79
|
+
export declare function extractToolLoopAgentSettings<T extends ToolSet, O = string, DI = undefined, D = undefined>(source: PublicSettingsAgent<T, O, DI, D>, settings: AttachOptions<T, O, DI, D>): AgentConfig<T, O, DI, D>;
|
|
80
|
+
export declare function extractToolLoopAgentSettings<T extends ToolSet, O = string, DI = undefined, D = undefined>(source: {
|
|
81
|
+
tools?: T & CompatibleTools<T, NoInfer<D>>;
|
|
82
|
+
}, settings: Omit<AgentConfig<T, O, DI, D>, "tools">): AgentConfig<T, O, DI, D>;
|
|
83
|
+
type BoundTool<D> = <I, O>(config: DurableToolConfig<I, O, D>) => DurableToolDefinition<I, O, D>;
|
|
84
|
+
export declare function defineDurableTaskAgent<T extends ToolSet, O = string, DI = undefined, D = undefined>(config: Omit<AgentConfig<T, O, DI, D>, "tools"> & {
|
|
85
|
+
tools: (tool: BoundTool<D>) => T & CompatibleTools<T, D>;
|
|
86
|
+
}): DurableTaskAgent<T, O, DI, D>;
|
|
87
|
+
export declare function defineDurableTaskAgent<T extends ToolSet, O = string, DI = undefined, D = undefined>(config: AgentConfig<T, O, DI, D>): DurableTaskAgent<T, O, DI, D>;
|
|
88
|
+
/**
|
|
89
|
+
* Legacy alias for {@link DurableTaskAgent}.
|
|
90
|
+
*
|
|
91
|
+
* @deprecated Use `DurableTaskAgent`. This name collides with the Vercel AI SDK's own
|
|
92
|
+
* deprecated `DurableAgent` (renamed to `WorkflowAgent`), so importing both in one module is
|
|
93
|
+
* ambiguous. The alias is identity-preserving (`DurableAgent === DurableTaskAgent`) and is kept
|
|
94
|
+
* for backward compatibility; it may be removed in a future major release.
|
|
95
|
+
*/
|
|
96
|
+
export declare const DurableAgent: typeof DurableTaskAgent;
|
|
97
|
+
/**
|
|
98
|
+
* Legacy type alias for {@link DurableTaskAgent}.
|
|
99
|
+
*
|
|
100
|
+
* @deprecated Use `DurableTaskAgent`. See the `DurableAgent` value export for details.
|
|
101
|
+
*/
|
|
102
|
+
export type DurableAgent<T extends ToolSet = {}, O = string, DI = undefined, D = undefined> = DurableTaskAgent<T, O, DI, D>;
|
|
103
|
+
/**
|
|
104
|
+
* Legacy alias for {@link defineDurableTaskAgent}.
|
|
105
|
+
*
|
|
106
|
+
* @deprecated Use `defineDurableTaskAgent`. Kept for backward compatibility alongside `DurableAgent`.
|
|
107
|
+
*/
|
|
108
|
+
export declare const defineDurableAgent: typeof defineDurableTaskAgent;
|
|
109
|
+
export declare function durableGenerateText<T extends ToolSet, O, DI, D>(ctx: OrchestrationContext, options: DurableGenerateTextOptions<T, O, DI, D>): AsyncGenerator<Task<unknown>, OrchestrationResult<O>, unknown>;
|
|
110
|
+
export {};
|