@statelyai/agent 2.0.0-alpha.11 → 2.0.0-alpha.13
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/dist/ai-sdk.cjs +4 -5
- package/dist/ai-sdk.d.cts +7 -4
- package/dist/ai-sdk.d.mts +7 -4
- package/dist/ai-sdk.mjs +1 -2
- package/dist/{events-JiVPYrct.mjs → decision-BezSD_YC.mjs} +327 -20
- package/dist/{events-CRQj3VtP.cjs → decision-dWGhBh0P.cjs} +401 -28
- package/dist/errors-BQRk9eiZ.d.cts +19 -0
- package/dist/errors-C9rxnWbX.d.mts +19 -0
- package/dist/errors-CeSXQx0v.mjs +23 -0
- package/dist/errors-DUBBzRLP.cjs +28 -0
- package/dist/event-log-store-CNT_7F0V.cjs +452 -0
- package/dist/event-log-store-CriMgX1D.d.mts +144 -0
- package/dist/event-log-store-D7pWtIhb.mjs +411 -0
- package/dist/event-log-store-Ruq18mGp.d.cts +144 -0
- package/dist/index.cjs +1050 -705
- package/dist/index.d.cts +538 -565
- package/dist/index.d.mts +538 -565
- package/dist/index.mjs +950 -644
- package/dist/machines.cjs +752 -0
- package/dist/machines.d.cts +372 -0
- package/dist/machines.d.mts +372 -0
- package/dist/machines.mjs +741 -0
- package/dist/otel.cjs +268 -0
- package/dist/otel.d.cts +67 -0
- package/dist/otel.d.mts +67 -0
- package/dist/otel.mjs +267 -0
- package/dist/run-agent-C3mFDGTf.d.mts +1111 -0
- package/dist/run-agent-DnvtcnTZ.d.cts +1111 -0
- package/dist/setup-agent-DAZZSjDS.mjs +1711 -0
- package/dist/setup-agent-DP95MFrI.cjs +1836 -0
- package/dist/sqlite.cjs +135 -0
- package/dist/sqlite.d.cts +57 -0
- package/dist/sqlite.d.mts +57 -0
- package/dist/sqlite.mjs +133 -0
- package/dist/{text-logic-CaKqgX4Y.d.mts → text-logic-BDxwQNsD.d.cts} +155 -72
- package/dist/{text-logic-Ckhr2kKC.d.cts → text-logic-TkKPw8Aq.d.mts} +155 -72
- package/dist/{types-qm00QF91.d.mts → types-QbEfCVny.d.cts} +1 -1
- package/dist/{types-C9QiMjre.d.cts → types-_FXoFBGO.d.mts} +1 -1
- package/package.json +47 -39
- package/readme.md +49 -12
- package/schemas/agent-workflow.json +40 -21
- package/skills/generate-machine/SKILL.md +267 -0
- package/dist/adapter.cjs +0 -15
- package/dist/adapter.d.cts +0 -4
- package/dist/adapter.d.mts +0 -4
- package/dist/adapter.mjs +0 -2
- package/dist/decision-C3k4ve51.mjs +0 -227
- package/dist/decision-D8wJrM8W.cjs +0 -286
- package/dist/openai-compat.cjs +0 -309
- package/dist/openai-compat.d.cts +0 -59
- package/dist/openai-compat.d.mts +0 -59
- package/dist/openai-compat.mjs +0 -308
- package/dist/steps-BALp1eZo.d.mts +0 -198
- package/dist/steps-CVe54GPP.cjs +0 -420
- package/dist/steps-CkyyyuHd.mjs +0 -379
- package/dist/steps-MjnQI4aB.d.cts +0 -198
- package/dist/steps.cjs +0 -12
- package/dist/steps.d.cts +0 -3
- package/dist/steps.d.mts +0 -3
- package/dist/steps.mjs +0 -3
- package/dist/utils-BYqT_Dyv.d.cts +0 -108
- package/dist/utils-Do5wIJrh.d.mts +0 -108
- package/dist/zod.cjs +0 -31
- package/dist/zod.d.cts +0 -30
- package/dist/zod.d.mts +0 -30
- package/dist/zod.mjs +0 -30
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
import { _ as StandardSchemaV1, c as AgentTools } from "./types-_FXoFBGO.mjs";
|
|
2
|
+
import { AnyStateMachine } from "xstate";
|
|
3
|
+
|
|
4
|
+
//#region src/machines/tool-loop.d.ts
|
|
5
|
+
/** Config for {@link createToolLoopMachine}. */
|
|
6
|
+
interface CreateToolLoopMachineConfig {
|
|
7
|
+
/** Model ref, or an alias from the host's `models` registry. */
|
|
8
|
+
model: string;
|
|
9
|
+
/** System prompt. */
|
|
10
|
+
instructions?: string;
|
|
11
|
+
/** Tools the host runs inside the one request. */
|
|
12
|
+
tools?: AgentTools;
|
|
13
|
+
/** Structured output schema. Omitted means the output is plain text. */
|
|
14
|
+
outputSchema?: StandardSchemaV1;
|
|
15
|
+
/** Bounds the host-side tool loop — lowered to `metadata.maxSteps`. */
|
|
16
|
+
maxTurns?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Tool names the host should gate before executing. Lowered to
|
|
19
|
+
* `metadata.interruptOn`, which only a host that implements gating reads —
|
|
20
|
+
* the preset itself stays a single state and never pauses. For a real
|
|
21
|
+
* approval gate as machine states, eject to `examples/review-tool-calls`.
|
|
22
|
+
*/
|
|
23
|
+
interruptOn?: readonly string[];
|
|
24
|
+
}
|
|
25
|
+
/** Context of a {@link createToolLoopMachine} machine. */
|
|
26
|
+
type ToolLoopContext = {
|
|
27
|
+
prompt: string;
|
|
28
|
+
result: unknown;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* The single-state tool loop: one text request carries the `tools`, and the
|
|
32
|
+
* host runs the tool loop inside it (`maxTurns` bounds it). Selecting and
|
|
33
|
+
* executing tools is the model + host's business, not machine states.
|
|
34
|
+
*
|
|
35
|
+
* States: `answering` → `done`.
|
|
36
|
+
*
|
|
37
|
+
* ```ts
|
|
38
|
+
* const machine = createToolLoopMachine({
|
|
39
|
+
* model: "quick",
|
|
40
|
+
* instructions: "Answer using the tools.",
|
|
41
|
+
* tools: { calculate },
|
|
42
|
+
* maxTurns: 5,
|
|
43
|
+
* });
|
|
44
|
+
*
|
|
45
|
+
* const result = await runAgent(machine, {
|
|
46
|
+
* input: { prompt: "What is 42 * 17?" },
|
|
47
|
+
* executors,
|
|
48
|
+
* });
|
|
49
|
+
* // Snapshots and log entries carry machine.version ("1") automatically.
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
declare function createToolLoopMachine(config: CreateToolLoopMachineConfig): AnyStateMachine;
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/machines/sequential.d.ts
|
|
55
|
+
/** Arguments a {@link SequentialStep}'s `prompt` receives. */
|
|
56
|
+
interface SequentialPromptArgs {
|
|
57
|
+
/** The machine's `input.prompt`. */
|
|
58
|
+
prompt: string;
|
|
59
|
+
/** Every completed step's output, keyed by step name. */
|
|
60
|
+
results: Record<string, unknown>;
|
|
61
|
+
/** The previous step's output (`null` for the first step). */
|
|
62
|
+
previous: unknown;
|
|
63
|
+
}
|
|
64
|
+
/** One step of a {@link createSequentialMachine} chain. */
|
|
65
|
+
interface SequentialStep {
|
|
66
|
+
/** Step name. Becomes the state name and the `results` key. */
|
|
67
|
+
name: string;
|
|
68
|
+
/** System prompt for this step. */
|
|
69
|
+
instructions?: string;
|
|
70
|
+
/** Builds this step's prompt. Defaults to the previous step's output (the machine's `prompt` for the first step). */
|
|
71
|
+
prompt?: (args: SequentialPromptArgs) => string;
|
|
72
|
+
/** Structured output schema for this step. */
|
|
73
|
+
outputSchema?: StandardSchemaV1;
|
|
74
|
+
/** Model ref for this step. Falls back to the factory's `model`. */
|
|
75
|
+
model?: string;
|
|
76
|
+
/** Tools the host runs inside this step's request. */
|
|
77
|
+
tools?: AgentTools;
|
|
78
|
+
/** Bounds this step's host-side tool loop (`metadata.maxSteps`). */
|
|
79
|
+
maxTurns?: number;
|
|
80
|
+
}
|
|
81
|
+
/** Config for {@link createSequentialMachine}. */
|
|
82
|
+
interface CreateSequentialMachineConfig {
|
|
83
|
+
/** Default model ref for every step. */
|
|
84
|
+
model: string;
|
|
85
|
+
/** The chain, run in array order. */
|
|
86
|
+
steps: readonly SequentialStep[];
|
|
87
|
+
}
|
|
88
|
+
/** Context of a {@link createSequentialMachine} machine. */
|
|
89
|
+
type SequentialContext = {
|
|
90
|
+
prompt: string;
|
|
91
|
+
results: Record<string, unknown>;
|
|
92
|
+
previous: unknown;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* A prompt chain: each step is one state, and each step's output feeds the
|
|
96
|
+
* next. The default prompt for a step is the previous step's output, so a
|
|
97
|
+
* chain needs no `prompt` functions at all.
|
|
98
|
+
*
|
|
99
|
+
* States: one per step, in order → `done`.
|
|
100
|
+
*
|
|
101
|
+
* ```ts
|
|
102
|
+
* const machine = createSequentialMachine({
|
|
103
|
+
* model: "quick",
|
|
104
|
+
* steps: [
|
|
105
|
+
* { name: "outline", instructions: "Outline the post." },
|
|
106
|
+
* { name: "draft", instructions: "Write the post from the outline." },
|
|
107
|
+
* { name: "polish", instructions: "Tighten the prose." },
|
|
108
|
+
* ],
|
|
109
|
+
* });
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
declare function createSequentialMachine(config: CreateSequentialMachineConfig): AnyStateMachine;
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/machines/internal.d.ts
|
|
115
|
+
/** One delegated unit of work, lowered to an inline text request. */
|
|
116
|
+
interface PresetRequestEntry {
|
|
117
|
+
/** What this entry is for. Shown to the routing/supervising model. */
|
|
118
|
+
description?: string;
|
|
119
|
+
/** System prompt for this entry's model call. */
|
|
120
|
+
instructions?: string;
|
|
121
|
+
/** Model ref (or `models` alias). Falls back to the factory's `model`. */
|
|
122
|
+
model?: string;
|
|
123
|
+
/** Structured output schema. Omitted means plain text. */
|
|
124
|
+
outputSchema?: StandardSchemaV1;
|
|
125
|
+
/** Tools the host runs inside this one request. */
|
|
126
|
+
tools?: AgentTools;
|
|
127
|
+
/** Bounds the host-side tool loop (lowered to `metadata.maxSteps`). */
|
|
128
|
+
maxTurns?: number;
|
|
129
|
+
}
|
|
130
|
+
/** One delegated unit of work, lowered to an invoked child machine. */
|
|
131
|
+
interface PresetMachineEntry {
|
|
132
|
+
/** What this entry is for. Shown to the routing/supervising model. */
|
|
133
|
+
description?: string;
|
|
134
|
+
/** The child machine to invoke. Registered as an actor source, so `runAgent` binds its executors. */
|
|
135
|
+
machine: AnyStateMachine;
|
|
136
|
+
/** Builds the child's `input`. Defaults to `{ prompt }` (`{ message }` for handoff). */
|
|
137
|
+
input?: (args: {
|
|
138
|
+
prompt: string;
|
|
139
|
+
}) => unknown;
|
|
140
|
+
}
|
|
141
|
+
/** A route/branch/worker/agent entry: an inline request, or a child machine. */
|
|
142
|
+
type PresetEntry = PresetRequestEntry | PresetMachineEntry;
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region src/machines/router.d.ts
|
|
145
|
+
/** Config for {@link createRouterMachine}. */
|
|
146
|
+
interface CreateRouterMachineConfig {
|
|
147
|
+
/** Model ref for the routing decision, and the default for request routes. */
|
|
148
|
+
model: string;
|
|
149
|
+
/** System prompt for the routing decision. */
|
|
150
|
+
instructions?: string;
|
|
151
|
+
/** The legal destinations, keyed by route name. Each is an inline request or a child machine. */
|
|
152
|
+
routes: Record<string, PresetEntry>;
|
|
153
|
+
/** Route taken when the routing decision errors. Without it, a failed decision ends the run. */
|
|
154
|
+
fallback?: string;
|
|
155
|
+
}
|
|
156
|
+
/** Context of a {@link createRouterMachine} machine. */
|
|
157
|
+
type RouterContext = {
|
|
158
|
+
prompt: string;
|
|
159
|
+
route: string | null;
|
|
160
|
+
result: unknown;
|
|
161
|
+
};
|
|
162
|
+
/** The event a route decision chooses: `ROUTE_<name>`. */
|
|
163
|
+
declare function routeEventType(route: string): string;
|
|
164
|
+
/**
|
|
165
|
+
* One `agent.decide` picks exactly one declared route, then the machine runs
|
|
166
|
+
* it. Only the declared routes have events and transitions, so a model naming
|
|
167
|
+
* anything else is rejected before any work happens — illegal routes are
|
|
168
|
+
* impossible, not discouraged.
|
|
169
|
+
*
|
|
170
|
+
* States: `routing` → one state per route → `done`.
|
|
171
|
+
*
|
|
172
|
+
* ```ts
|
|
173
|
+
* const machine = createRouterMachine({
|
|
174
|
+
* model: "quick",
|
|
175
|
+
* routes: {
|
|
176
|
+
* billing: { description: "Payments and invoices", instructions: "Answer the billing question." },
|
|
177
|
+
* technical: { description: "Bugs and outages", machine: technicalMachine },
|
|
178
|
+
* },
|
|
179
|
+
* fallback: "technical",
|
|
180
|
+
* });
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
declare function createRouterMachine(config: CreateRouterMachineConfig): AnyStateMachine;
|
|
184
|
+
//#endregion
|
|
185
|
+
//#region src/machines/parallel.d.ts
|
|
186
|
+
/** Config for {@link createParallelMachine}. */
|
|
187
|
+
interface CreateParallelMachineConfig {
|
|
188
|
+
/** Default model ref for request branches. */
|
|
189
|
+
model: string;
|
|
190
|
+
/** The branches, run concurrently. Each is an inline request or a child machine. */
|
|
191
|
+
branches: Record<string, PresetEntry>;
|
|
192
|
+
}
|
|
193
|
+
/** Context of a {@link createParallelMachine} machine. */
|
|
194
|
+
type ParallelContext = {
|
|
195
|
+
prompt: string;
|
|
196
|
+
results: Record<string, unknown>;
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* Static fan-out: every branch runs concurrently as its own region of one
|
|
200
|
+
* parallel state, and the run joins when all of them finish. Results are keyed
|
|
201
|
+
* by branch name.
|
|
202
|
+
*
|
|
203
|
+
* Branch count is fixed at author time. For an N decided at run time (a planner
|
|
204
|
+
* choosing subtopics), eject to `examples/fan-out`, which spawns branches
|
|
205
|
+
* dynamically.
|
|
206
|
+
*
|
|
207
|
+
* States: `running` (one region per branch) → `done`.
|
|
208
|
+
*
|
|
209
|
+
* ```ts
|
|
210
|
+
* const machine = createParallelMachine({
|
|
211
|
+
* model: "quick",
|
|
212
|
+
* branches: {
|
|
213
|
+
* security: { instructions: "Review for security issues." },
|
|
214
|
+
* performance: { instructions: "Review for performance issues." },
|
|
215
|
+
* },
|
|
216
|
+
* });
|
|
217
|
+
* ```
|
|
218
|
+
*/
|
|
219
|
+
declare function createParallelMachine(config: CreateParallelMachineConfig): AnyStateMachine;
|
|
220
|
+
//#endregion
|
|
221
|
+
//#region src/machines/loop.d.ts
|
|
222
|
+
/** The accumulated state a {@link CreateLoopMachineConfig.until} predicate reads. */
|
|
223
|
+
interface LoopState {
|
|
224
|
+
/** The machine's `input.prompt`. */
|
|
225
|
+
prompt: string;
|
|
226
|
+
/** Completed iterations. */
|
|
227
|
+
iterations: number;
|
|
228
|
+
/** Every iteration's output, in order. */
|
|
229
|
+
results: unknown[];
|
|
230
|
+
/** The latest iteration's output. */
|
|
231
|
+
last: unknown;
|
|
232
|
+
}
|
|
233
|
+
/** Config for {@link createLoopMachine}. */
|
|
234
|
+
interface CreateLoopMachineConfig {
|
|
235
|
+
/** Default model ref for a request body. */
|
|
236
|
+
model: string;
|
|
237
|
+
/** The repeated unit of work: an inline request or a child machine. */
|
|
238
|
+
body: PresetEntry & {
|
|
239
|
+
/** Builds each iteration's prompt. Defaults to the machine's `prompt`. */prompt?: (state: LoopState) => string;
|
|
240
|
+
};
|
|
241
|
+
/** Stop condition, checked after each iteration. */
|
|
242
|
+
until: (state: LoopState) => boolean;
|
|
243
|
+
/** Hard upper bound on iterations, enforced by a guard. */
|
|
244
|
+
maxIterations: number;
|
|
245
|
+
}
|
|
246
|
+
/** Context of a {@link createLoopMachine} machine. */
|
|
247
|
+
type LoopContext = {
|
|
248
|
+
prompt: string;
|
|
249
|
+
iterations: number;
|
|
250
|
+
results: unknown[];
|
|
251
|
+
last: unknown;
|
|
252
|
+
};
|
|
253
|
+
/**
|
|
254
|
+
* A bounded repeat: run the body, check `until` over the accumulated state,
|
|
255
|
+
* and either stop or go again. `maxIterations` is a guard, so the loop cannot
|
|
256
|
+
* run away even if `until` never returns `true`.
|
|
257
|
+
*
|
|
258
|
+
* States: `running` → `checking` → (`running` | `done`).
|
|
259
|
+
*
|
|
260
|
+
* ```ts
|
|
261
|
+
* const machine = createLoopMachine({
|
|
262
|
+
* model: "quick",
|
|
263
|
+
* body: { instructions: "Improve the draft. Return only the draft." },
|
|
264
|
+
* until: ({ last }) => String(last).length > 500,
|
|
265
|
+
* maxIterations: 4,
|
|
266
|
+
* });
|
|
267
|
+
* ```
|
|
268
|
+
*/
|
|
269
|
+
declare function createLoopMachine(config: CreateLoopMachineConfig): AnyStateMachine;
|
|
270
|
+
//#endregion
|
|
271
|
+
//#region src/machines/supervisor.d.ts
|
|
272
|
+
/** Config for {@link createSupervisorMachine}. */
|
|
273
|
+
interface CreateSupervisorMachineConfig {
|
|
274
|
+
/** Model ref for the supervising decision, and the default for request workers. */
|
|
275
|
+
model: string;
|
|
276
|
+
/** System prompt for the supervising decision. */
|
|
277
|
+
instructions?: string;
|
|
278
|
+
/** The workers the supervisor may delegate to, keyed by name. */
|
|
279
|
+
workers: Record<string, PresetEntry>;
|
|
280
|
+
/** Hard upper bound on delegations, enforced by a guard. Default 6. */
|
|
281
|
+
maxTurns?: number;
|
|
282
|
+
}
|
|
283
|
+
/** Context of a {@link createSupervisorMachine} machine. */
|
|
284
|
+
type SupervisorContext = {
|
|
285
|
+
task: string;
|
|
286
|
+
results: Record<string, unknown>;
|
|
287
|
+
turns: number;
|
|
288
|
+
worker: string | null;
|
|
289
|
+
};
|
|
290
|
+
/** The event a supervising decision chooses to delegate to a worker: `DELEGATE_<name>`. */
|
|
291
|
+
declare function delegateEventType(worker: string): string;
|
|
292
|
+
/** The event a supervising decision chooses to stop. */
|
|
293
|
+
declare const FINISH_EVENT_TYPE = "FINISH";
|
|
294
|
+
/**
|
|
295
|
+
* A supervisor delegating to typed workers: each turn, one `agent.decide`
|
|
296
|
+
* picks a worker or `FINISH`. Worker results accumulate in context and are fed
|
|
297
|
+
* back into the next decision.
|
|
298
|
+
*
|
|
299
|
+
* Control always returns to the supervisor after a worker finishes — that is
|
|
300
|
+
* what separates this from {@link createHandoffMachine}, where control
|
|
301
|
+
* transfers and does not come back.
|
|
302
|
+
*
|
|
303
|
+
* `maxTurns` bounds the delegations twice over: a spent budget removes every
|
|
304
|
+
* `DELEGATE_*` from the decision's candidate events, and a guard on each
|
|
305
|
+
* delegate transition rejects one anyway. `FINISH` is all that is left.
|
|
306
|
+
*
|
|
307
|
+
* States: `supervising` → one state per worker → `supervising` → … → `done`.
|
|
308
|
+
*
|
|
309
|
+
* ```ts
|
|
310
|
+
* const machine = createSupervisorMachine({
|
|
311
|
+
* model: "quick",
|
|
312
|
+
* workers: {
|
|
313
|
+
* researcher: { description: "Facts and background", instructions: "Research it." },
|
|
314
|
+
* writer: { description: "Prose and summaries", instructions: "Write it up." },
|
|
315
|
+
* },
|
|
316
|
+
* maxTurns: 4,
|
|
317
|
+
* });
|
|
318
|
+
* ```
|
|
319
|
+
*/
|
|
320
|
+
declare function createSupervisorMachine(config: CreateSupervisorMachineConfig): AnyStateMachine;
|
|
321
|
+
//#endregion
|
|
322
|
+
//#region src/machines/handoff.d.ts
|
|
323
|
+
/** Config for {@link createHandoffMachine}. */
|
|
324
|
+
interface CreateHandoffMachineConfig {
|
|
325
|
+
/** The peer agents, keyed by name. Each is an inline request or a child machine. */
|
|
326
|
+
agents: Record<string, PresetEntry>;
|
|
327
|
+
/** Which agent holds the mic at the start of a run. */
|
|
328
|
+
defaultActiveAgent: string;
|
|
329
|
+
/** Default model ref for request agents that declare none. */
|
|
330
|
+
model?: string;
|
|
331
|
+
}
|
|
332
|
+
/** Context of a {@link createHandoffMachine} machine. */
|
|
333
|
+
type HandoffContext = {
|
|
334
|
+
message: string;
|
|
335
|
+
activeAgent: string;
|
|
336
|
+
reply: unknown;
|
|
337
|
+
};
|
|
338
|
+
/** The event that hands the mic to a peer: `transfer_to_<name>`. */
|
|
339
|
+
declare function transferEventType(agent: string): string;
|
|
340
|
+
/**
|
|
341
|
+
* Peer handoff (the swarm shape): `context.activeAgent` holds the mic, runs one
|
|
342
|
+
* turn, then the machine settles idle in `waiting`. A `transfer_to_<name>`
|
|
343
|
+
* event moves the mic to a peer and re-routes.
|
|
344
|
+
*
|
|
345
|
+
* Control TRANSFERS and does not return — the opposite of
|
|
346
|
+
* {@link createSupervisorMachine}, where every worker hands control back.
|
|
347
|
+
*
|
|
348
|
+
* There is no final state: a conversation ends when the host stops resuming it.
|
|
349
|
+
* Persist the idle snapshot between turns; `activeAgent` round-trips with it.
|
|
350
|
+
*
|
|
351
|
+
* States: `routing` → one turn state per agent → `waiting` → `routing` → …
|
|
352
|
+
*
|
|
353
|
+
* ```ts
|
|
354
|
+
* const machine = createHandoffMachine({
|
|
355
|
+
* model: "quick",
|
|
356
|
+
* defaultActiveAgent: "travel",
|
|
357
|
+
* agents: {
|
|
358
|
+
* travel: { description: "Destinations and itineraries", instructions: "You are a travel concierge." },
|
|
359
|
+
* food: { description: "Restaurants and dishes", instructions: "You are a food concierge." },
|
|
360
|
+
* },
|
|
361
|
+
* });
|
|
362
|
+
*
|
|
363
|
+
* const next = await runAgent(machine, {
|
|
364
|
+
* snapshot,
|
|
365
|
+
* event: { type: "transfer_to_food", message: "What should I eat there?" },
|
|
366
|
+
* executors,
|
|
367
|
+
* });
|
|
368
|
+
* ```
|
|
369
|
+
*/
|
|
370
|
+
declare function createHandoffMachine(config: CreateHandoffMachineConfig): AnyStateMachine;
|
|
371
|
+
//#endregion
|
|
372
|
+
export { type CreateHandoffMachineConfig, type CreateLoopMachineConfig, type CreateParallelMachineConfig, type CreateRouterMachineConfig, type CreateSequentialMachineConfig, type CreateSupervisorMachineConfig, type CreateToolLoopMachineConfig, FINISH_EVENT_TYPE, type HandoffContext, type LoopContext, type LoopState, type ParallelContext, type PresetEntry, type PresetMachineEntry, type PresetRequestEntry, type RouterContext, type SequentialContext, type SequentialPromptArgs, type SequentialStep, type SupervisorContext, type ToolLoopContext, createHandoffMachine, createLoopMachine, createParallelMachine, createRouterMachine, createSequentialMachine, createSupervisorMachine, createToolLoopMachine, delegateEventType, routeEventType, transferEventType };
|