@statelyai/agent 1.1.6 → 2.0.0-alpha.5

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.
Files changed (84) hide show
  1. package/LICENSE +21 -0
  2. package/dist/ai-sdk.cjs +249 -0
  3. package/dist/ai-sdk.d.cts +168 -0
  4. package/dist/ai-sdk.d.mts +168 -0
  5. package/dist/ai-sdk.mjs +241 -0
  6. package/dist/cli.cjs +63 -0
  7. package/dist/cli.d.cts +1 -0
  8. package/dist/cli.d.mts +1 -0
  9. package/dist/cli.mjs +64 -0
  10. package/dist/decision-FTmbqSEe.mjs +938 -0
  11. package/dist/decision-pC-bY2DE.cjs +1231 -0
  12. package/dist/index.cjs +54 -0
  13. package/dist/index.d.cts +1217 -0
  14. package/dist/index.d.mts +1194 -405
  15. package/dist/index.mjs +3 -588
  16. package/dist/openai-compat.cjs +319 -0
  17. package/dist/openai-compat.d.cts +98 -0
  18. package/dist/openai-compat.d.mts +98 -0
  19. package/dist/openai-compat.mjs +312 -0
  20. package/dist/src-CjpHDU8F.mjs +2445 -0
  21. package/dist/src-DcRsWPfV.cjs +2564 -0
  22. package/dist/text-logic-1ZQkO3zr.d.cts +682 -0
  23. package/dist/text-logic-2EMJIS-n.d.mts +682 -0
  24. package/dist/types-BHjeDdch.d.cts +208 -0
  25. package/dist/types-Cq1YlAQ6.d.mts +208 -0
  26. package/dist/utils-CWUCa3pF.d.mts +108 -0
  27. package/dist/utils-lK1wnL2i.d.cts +108 -0
  28. package/dist/zod.cjs +31 -0
  29. package/dist/zod.d.cts +30 -0
  30. package/dist/zod.d.mts +30 -0
  31. package/dist/zod.mjs +30 -0
  32. package/package.json +109 -28
  33. package/readme.md +144 -6
  34. package/schemas/agent-workflow.json +527 -0
  35. package/.changeset/README.md +0 -8
  36. package/.changeset/config.json +0 -11
  37. package/.env.template +0 -3
  38. package/.github/actions/ci-setup/action.yml +0 -24
  39. package/.github/workflows/release.yml +0 -46
  40. package/.vscode/launch.json +0 -28
  41. package/CHANGELOG.md +0 -222
  42. package/dist/index.d.ts +0 -428
  43. package/dist/index.js +0 -621
  44. package/examples/chatbot.ts +0 -71
  45. package/examples/cot.ts +0 -89
  46. package/examples/email.ts +0 -118
  47. package/examples/example.ts +0 -81
  48. package/examples/goal.ts +0 -94
  49. package/examples/helpers/helpers.ts +0 -17
  50. package/examples/helpers/loader.ts +0 -32
  51. package/examples/helpers/runner.ts +0 -27
  52. package/examples/joke.ts +0 -225
  53. package/examples/multi.ts +0 -103
  54. package/examples/newspaper.ts +0 -324
  55. package/examples/number.ts +0 -102
  56. package/examples/raffle.ts +0 -105
  57. package/examples/sandbox.ts +0 -28
  58. package/examples/simple.ts +0 -39
  59. package/examples/support.ts +0 -147
  60. package/examples/ticTacToe.ts +0 -224
  61. package/examples/todo.ts +0 -137
  62. package/examples/tutor.ts +0 -100
  63. package/examples/verify.ts +0 -120
  64. package/examples/weather.ts +0 -178
  65. package/examples/wiki.ts +0 -30
  66. package/examples/word.ts +0 -171
  67. package/src/adapters/vercel.ts +0 -7
  68. package/src/agent-experimental.ts +0 -221
  69. package/src/agent.test.ts +0 -506
  70. package/src/agent.ts +0 -300
  71. package/src/decision.test.ts +0 -179
  72. package/src/decision.ts +0 -84
  73. package/src/index.ts +0 -4
  74. package/src/memory.ts +0 -25
  75. package/src/planners/shortestPathPlanner.ts +0 -22
  76. package/src/planners/simplePlanner.ts +0 -139
  77. package/src/schemas.ts +0 -11
  78. package/src/strategies/chain-of-note.ts +0 -155
  79. package/src/templates/defaultText.ts +0 -18
  80. package/src/text.ts +0 -241
  81. package/src/types.ts +0 -499
  82. package/src/utils.ts +0 -72
  83. package/tsconfig.json +0 -109
  84. package/vitest.config.ts +0 -9
package/dist/index.mjs CHANGED
@@ -1,588 +1,3 @@
1
- // src/agent.ts
2
- import {
3
- createActor,
4
- fromTransition
5
- } from "xstate";
6
-
7
- // src/planners/simplePlanner.ts
8
- import { tool } from "ai";
9
-
10
- // src/utils.ts
11
- import hash from "object-hash";
12
- function getAllTransitions(state) {
13
- const nodes = state._nodes;
14
- const transitions = nodes.map((node) => [...node.transitions.values()]).map((nodeTransitions) => {
15
- return nodeTransitions.map((nodeEventTransitions) => {
16
- return nodeEventTransitions.map((transition) => {
17
- return {
18
- ...transition,
19
- guard: typeof transition.guard === "string" ? { type: transition.guard } : transition.guard
20
- // TODO: fix
21
- };
22
- });
23
- });
24
- }).flat(2);
25
- return transitions;
26
- }
27
- function getAllMachineTransitions(stateNode) {
28
- const transitions = [...stateNode.transitions.values()].map((nodeTransitions) => {
29
- return nodeTransitions.map((transition) => {
30
- return {
31
- ...transition,
32
- guard: typeof transition.guard === "string" ? { type: transition.guard } : transition.guard
33
- // TODO: fix
34
- };
35
- });
36
- }).flat(2);
37
- for (const s of Object.values(stateNode.states)) {
38
- const stateTransitions = getAllMachineTransitions(s);
39
- transitions.push(...stateTransitions);
40
- }
41
- return transitions;
42
- }
43
- function wrapInXml(tagName, content) {
44
- return `<${tagName}>${content}</${tagName}>`;
45
- }
46
- function randomId() {
47
- const timestamp = Date.now().toString(36);
48
- const random = Math.random().toString(36).substring(2, 9);
49
- return timestamp + random;
50
- }
51
- var machineHashes = /* @__PURE__ */ new WeakMap();
52
- function getMachineHash(machine) {
53
- if (machineHashes.has(machine)) return machineHashes.get(machine);
54
- const transitions = getAllMachineTransitions(machine.root);
55
- const machineHash = hash(transitions);
56
- machineHashes.set(machine, machineHash);
57
- return machineHash;
58
- }
59
-
60
- // src/templates/defaultText.ts
61
- var defaultTextTemplate = (data) => {
62
- const preamble = [
63
- data.context ? wrapInXml("context", JSON.stringify(data.context)) : void 0
64
- ].filter(Boolean).join("\n");
65
- return `
66
- ${preamble}
67
-
68
- ${data.goal}
69
- `.trim();
70
- };
71
-
72
- // src/text.ts
73
- import {
74
- fromObservable,
75
- fromPromise,
76
- toObserver
77
- } from "xstate";
78
- async function getMessages(agent, prompt, options) {
79
- let messages = [];
80
- if (typeof options.messages === "function") {
81
- messages = await options.messages(agent);
82
- } else if (options.messages) {
83
- messages = options.messages;
84
- }
85
- messages = messages.concat({
86
- role: "user",
87
- content: prompt
88
- });
89
- return messages;
90
- }
91
- async function agentGenerateText(agent, options) {
92
- const resolvedOptions = {
93
- ...agent.defaultOptions,
94
- ...options,
95
- correlationId: options.correlationId ?? randomId()
96
- };
97
- const template = resolvedOptions.template ?? defaultTextTemplate;
98
- const id = randomId();
99
- const goal = typeof resolvedOptions.prompt === "string" ? resolvedOptions.prompt : await resolvedOptions.prompt(agent);
100
- const promptWithContext = template({
101
- goal,
102
- context: resolvedOptions.context
103
- });
104
- const messages = await getMessages(agent, promptWithContext, resolvedOptions);
105
- agent.addMessage({
106
- id,
107
- role: "user",
108
- content: promptWithContext,
109
- timestamp: Date.now(),
110
- correlationId: resolvedOptions.correlationId,
111
- parentCorrelationId: resolvedOptions.parentCorrelationId
112
- });
113
- const result = await agent.adapter.generateText({
114
- ...resolvedOptions,
115
- prompt: void 0,
116
- messages
117
- });
118
- agent.addMessage({
119
- content: result.text,
120
- id,
121
- role: "assistant",
122
- timestamp: Date.now(),
123
- responseId: id,
124
- result,
125
- correlationId: resolvedOptions.correlationId,
126
- parentCorrelationId: resolvedOptions.parentCorrelationId
127
- });
128
- return {
129
- ...result,
130
- parentCorrelationId: resolvedOptions.parentCorrelationId,
131
- correlationId: resolvedOptions.correlationId
132
- };
133
- }
134
- async function agentStreamText(agent, options) {
135
- const resolvedOptions = {
136
- ...agent.defaultOptions,
137
- ...options,
138
- correlationId: options.correlationId ?? randomId()
139
- };
140
- const template = resolvedOptions.template ?? defaultTextTemplate;
141
- const id = randomId();
142
- const goal = typeof resolvedOptions.prompt === "string" ? resolvedOptions.prompt : await resolvedOptions.prompt(agent);
143
- const promptWithContext = template({
144
- goal,
145
- context: resolvedOptions.context
146
- });
147
- const messages = await getMessages(agent, promptWithContext, resolvedOptions);
148
- agent.addMessage({
149
- role: "user",
150
- content: promptWithContext,
151
- id,
152
- timestamp: Date.now(),
153
- correlationId: resolvedOptions.correlationId,
154
- parentCorrelationId: resolvedOptions.parentCorrelationId
155
- });
156
- const result = await agent.adapter.streamText({
157
- ...resolvedOptions,
158
- prompt: void 0,
159
- messages,
160
- onFinish: async (res) => {
161
- agent.addMessage({
162
- role: "assistant",
163
- result: {
164
- text: res.text,
165
- finishReason: res.finishReason,
166
- logprobs: void 0,
167
- responseMessages: [],
168
- toolCalls: [],
169
- toolResults: [],
170
- usage: res.usage,
171
- warnings: res.warnings,
172
- rawResponse: res.rawResponse,
173
- roundtrips: [],
174
- // TODO: how do we get this information?,
175
- steps: res.steps,
176
- response: res.response,
177
- experimental_providerMetadata: res.experimental_providerMetadata
178
- },
179
- content: res.text,
180
- id: randomId(),
181
- timestamp: Date.now(),
182
- responseId: id,
183
- correlationId: resolvedOptions.correlationId,
184
- parentCorrelationId: resolvedOptions.parentCorrelationId
185
- });
186
- }
187
- });
188
- return {
189
- ...result,
190
- textStream: result.textStream,
191
- fullStream: result.fullStream,
192
- parentCorrelationId: resolvedOptions.parentCorrelationId,
193
- correlationId: resolvedOptions.correlationId
194
- };
195
- }
196
- function fromTextStream(agent, defaultOptions) {
197
- return fromObservable(({ input }) => {
198
- const observers = /* @__PURE__ */ new Set();
199
- (async () => {
200
- const result = await agentStreamText(agent, {
201
- ...defaultOptions,
202
- ...input,
203
- context: input.context
204
- });
205
- for await (const part of result.fullStream) {
206
- if (part.type === "text-delta") {
207
- observers.forEach((observer) => {
208
- observer.next?.(part);
209
- });
210
- }
211
- }
212
- })();
213
- return {
214
- subscribe: (...args) => {
215
- const observer = toObserver(...args);
216
- observers.add(observer);
217
- return {
218
- unsubscribe: () => {
219
- observers.delete(observer);
220
- }
221
- };
222
- }
223
- };
224
- });
225
- }
226
- function fromText(agent, defaultOptions) {
227
- return fromPromise(async ({ input }) => {
228
- return await agentGenerateText(agent, {
229
- ...input,
230
- ...defaultOptions,
231
- context: input.context
232
- });
233
- });
234
- }
235
-
236
- // src/planners/simplePlanner.ts
237
- function getTransitions(state, machine) {
238
- if (!machine) {
239
- return [];
240
- }
241
- const resolvedState = machine.resolveState(state);
242
- return getAllTransitions(resolvedState);
243
- }
244
- var simplePlannerPromptTemplate = (data) => {
245
- return `
246
- ${defaultTextTemplate(data)}
247
-
248
- Make at most one tool call to achieve the above goal. If the goal cannot be achieved with any tool calls, do not make any tool call.
249
- `.trim();
250
- };
251
- async function simplePlanner(agent, input) {
252
- const transitions = input.machine ? getTransitions(input.state, input.machine) : Object.entries(input.events).map(([eventType, { description }]) => ({
253
- eventType,
254
- description
255
- }));
256
- const filter = (eventType) => Object.keys(input.events).includes(eventType);
257
- const functionNameMapping = {};
258
- const toolTransitions = transitions.filter((t) => {
259
- return filter(t.eventType);
260
- }).map((t) => {
261
- const name = t.eventType.replace(/\./g, "_");
262
- functionNameMapping[name] = t.eventType;
263
- return {
264
- type: "function",
265
- eventType: t.eventType,
266
- description: t.description,
267
- name
268
- };
269
- });
270
- const toolMap = {};
271
- for (const toolTransitionData of toolTransitions) {
272
- const toolZodType = input.events?.[toolTransitionData.eventType];
273
- if (!toolZodType) {
274
- continue;
275
- }
276
- toolMap[toolTransitionData.name] = tool({
277
- description: toolZodType?.description ?? toolTransitionData.description,
278
- parameters: toolZodType,
279
- execute: async (params) => {
280
- const event = {
281
- type: toolTransitionData.eventType,
282
- ...params
283
- };
284
- return event;
285
- }
286
- });
287
- }
288
- if (!Object.keys(toolMap).length) {
289
- return void 0;
290
- }
291
- const prompt = simplePlannerPromptTemplate({
292
- context: input.state.context,
293
- goal: input.goal
294
- });
295
- const messages = await getMessages(agent, prompt, input);
296
- const result = await agent.generateText({
297
- toolChoice: "required",
298
- ...input,
299
- prompt,
300
- messages,
301
- tools: toolMap
302
- });
303
- const singleResult = result.toolResults[0];
304
- if (!singleResult) {
305
- console.warn("No tool call results returned");
306
- return void 0;
307
- }
308
- return {
309
- goal: input.goal,
310
- state: input.state,
311
- execute: async (state) => {
312
- if (JSON.stringify(state) === JSON.stringify(input.state)) {
313
- return singleResult.result;
314
- }
315
- return void 0;
316
- },
317
- nextEvent: singleResult.result,
318
- sessionId: agent.sessionId,
319
- timestamp: Date.now()
320
- };
321
- }
322
-
323
- // src/decision.ts
324
- import { fromPromise as fromPromise2 } from "xstate";
325
- async function agentDecide(agent, options) {
326
- const resolvedOptions = {
327
- ...agent.defaultOptions,
328
- ...options
329
- };
330
- const {
331
- planner = simplePlanner,
332
- goal,
333
- events = agent.events,
334
- state,
335
- machine,
336
- model = agent.model,
337
- ...otherPlanInput
338
- } = resolvedOptions;
339
- const plan = await planner(agent, {
340
- model,
341
- goal,
342
- events,
343
- state,
344
- machine,
345
- ...otherPlanInput
346
- });
347
- if (plan?.nextEvent) {
348
- agent.addPlan(plan);
349
- await resolvedOptions.execute?.(plan.nextEvent);
350
- }
351
- return plan;
352
- }
353
- function fromDecision(agent, defaultInput) {
354
- return fromPromise2(async ({ input, self }) => {
355
- const parentRef = self._parent;
356
- if (!parentRef) {
357
- return;
358
- }
359
- const snapshot = parentRef.getSnapshot();
360
- const inputObject = typeof input === "string" ? { goal: input } : input;
361
- const resolvedInput = {
362
- ...defaultInput,
363
- ...inputObject
364
- };
365
- const contextToInclude = resolvedInput.context === true ? (
366
- // include entire context
367
- parentRef.getSnapshot().context
368
- ) : resolvedInput.context;
369
- const state = {
370
- value: snapshot.value,
371
- context: contextToInclude
372
- };
373
- const plan = await agentDecide(agent, {
374
- machine: parentRef.logic,
375
- state,
376
- execute: async (event) => {
377
- parentRef.send(event);
378
- },
379
- ...resolvedInput
380
- });
381
- return plan;
382
- });
383
- }
384
-
385
- // src/adapters/vercel.ts
386
- import { generateText, streamText } from "ai";
387
- var vercelAdapter = {
388
- generateText,
389
- streamText
390
- };
391
-
392
- // src/agent.ts
393
- var agentLogic = fromTransition(
394
- (state, event, { emit }) => {
395
- switch (event.type) {
396
- case "agent.feedback": {
397
- state.feedback.push(event.feedback);
398
- emit({
399
- type: "feedback",
400
- // @ts-ignore TODO: fix types in XState
401
- feedback: event.feedback
402
- });
403
- break;
404
- }
405
- case "agent.observe": {
406
- state.observations.push(event.observation);
407
- emit({
408
- type: "observation",
409
- // @ts-ignore TODO: fix types in XState
410
- observation: event.observation
411
- });
412
- break;
413
- }
414
- case "agent.message": {
415
- state.messages.push(event.message);
416
- emit({
417
- type: "message",
418
- // @ts-ignore TODO: fix types in XState
419
- message: event.message
420
- });
421
- break;
422
- }
423
- case "agent.plan": {
424
- state.plans.push(event.plan);
425
- emit({
426
- type: "plan",
427
- // @ts-ignore TODO: fix types in XState
428
- plan: event.plan
429
- });
430
- break;
431
- }
432
- default:
433
- break;
434
- }
435
- return state;
436
- },
437
- () => ({
438
- feedback: [],
439
- messages: [],
440
- observations: [],
441
- plans: []
442
- })
443
- );
444
- function createAgent({
445
- name,
446
- description,
447
- model,
448
- events,
449
- context,
450
- planner = simplePlanner,
451
- stringify = JSON.stringify,
452
- getMemory,
453
- logic = agentLogic,
454
- adapter = vercelAdapter,
455
- ...generateTextOptions
456
- }) {
457
- const agent = createActor(logic);
458
- agent.events = events;
459
- agent.model = model;
460
- agent.name = name;
461
- agent.description = description;
462
- agent.adapter = adapter;
463
- agent.defaultOptions = { ...generateTextOptions, model };
464
- agent.select = (selector) => {
465
- return selector(agent.getSnapshot().context);
466
- };
467
- agent.memory = getMemory ? getMemory(agent) : void 0;
468
- agent.onMessage = (callback) => {
469
- agent.on("message", (ev) => callback(ev.message));
470
- };
471
- agent.decide = (opts) => {
472
- return agentDecide(agent, opts);
473
- };
474
- agent.addMessage = (messageInput) => {
475
- const message = {
476
- ...messageInput,
477
- id: messageInput.id ?? randomId(),
478
- timestamp: messageInput.timestamp ?? Date.now(),
479
- sessionId: agent.sessionId,
480
- correlationId: messageInput.correlationId ?? randomId()
481
- };
482
- agent.send({
483
- type: "agent.message",
484
- message
485
- });
486
- return message;
487
- };
488
- agent.getMessages = () => agent.getSnapshot().context.messages;
489
- agent.generateText = (opts) => agentGenerateText(agent, opts);
490
- agent.streamText = (opts) => agentStreamText(agent, opts);
491
- agent.addFeedback = (feedbackInput) => {
492
- const feedback = {
493
- ...feedbackInput,
494
- attributes: { ...feedbackInput.attributes },
495
- reward: feedbackInput.reward ?? 0,
496
- timestamp: feedbackInput.timestamp ?? Date.now(),
497
- sessionId: agent.sessionId
498
- };
499
- agent.send({
500
- type: "agent.feedback",
501
- feedback
502
- });
503
- return feedback;
504
- };
505
- agent.getFeedback = () => agent.getSnapshot().context.feedback;
506
- agent.addObservation = (observationInput) => {
507
- const { prevState, event, state } = observationInput;
508
- const observation = {
509
- prevState,
510
- event,
511
- state,
512
- id: observationInput.id ?? randomId(),
513
- sessionId: agent.sessionId,
514
- timestamp: observationInput.timestamp ?? Date.now(),
515
- machineHash: observationInput.machine ? getMachineHash(observationInput.machine) : void 0
516
- };
517
- agent.send({
518
- type: "agent.observe",
519
- observation
520
- });
521
- return observation;
522
- };
523
- agent.getObservations = () => agent.getSnapshot().context.observations;
524
- agent.addPlan = (plan) => {
525
- agent.send({
526
- type: "agent.plan",
527
- plan
528
- });
529
- };
530
- agent.getPlans = () => agent.getSnapshot().context.plans;
531
- agent.interact = (actorRef, getInput) => {
532
- let prevState = void 0;
533
- let subscribed = true;
534
- async function handleObservation(observationInput) {
535
- const observation = agent.addObservation(observationInput);
536
- const input = getInput?.(observation);
537
- if (input) {
538
- await agentDecide(agent, {
539
- machine: actorRef.src,
540
- state: observation.state,
541
- execute: async (event) => {
542
- actorRef.send(event);
543
- },
544
- ...input
545
- });
546
- }
547
- prevState = observationInput.state;
548
- }
549
- actorRef.system.inspect({
550
- next: async (inspEvent) => {
551
- if (!subscribed || inspEvent.actorRef !== actorRef || inspEvent.type !== "@xstate.snapshot") {
552
- return;
553
- }
554
- const observationInput = {
555
- event: inspEvent.event,
556
- prevState,
557
- state: inspEvent.snapshot,
558
- machine: actorRef.src
559
- };
560
- await handleObservation(observationInput);
561
- }
562
- });
563
- if (actorRef._processingStatus === 1) {
564
- handleObservation({
565
- prevState: void 0,
566
- event: { type: "" },
567
- // TODO: unknown events?
568
- state: actorRef.getSnapshot(),
569
- machine: actorRef.src
570
- });
571
- }
572
- return {
573
- unsubscribe: () => {
574
- subscribed = false;
575
- }
576
- // TODO: make this actually unsubscribe
577
- };
578
- };
579
- agent.types = {};
580
- agent.start();
581
- return agent;
582
- }
583
- export {
584
- createAgent,
585
- fromDecision,
586
- fromText,
587
- fromTextStream
588
- };
1
+ import { _ as createAgentSchemas, a as AgentIdleError, b as messagesSchema, c as inspectTransitions, d as executeAgentRequest, f as getAgentRequests, g as transitionAgentStep, h as resolveAgentStep, i as simulateAgent, l as runAgent, m as resolveAgentRequests, n as explorePaths, o as IllegalResumeEventError, p as initialAgentStep, r as lintAgentMachine, s as SnapshotVersionMismatchError, t as canReach, u as runAgentToCompletion, v as setupAgent, y as appendMessages } from "./src-CjpHDU8F.mjs";
2
+ import { B as getJsonSchema, G as persistSnapshot, H as getMachineStructuralHash, J as userMessage, K as systemMessage, L as assistantMessage, O as parseOutput, S as createTextLogic, T as isStructuredOutputSchema, U as getStateMeta, V as getJsonSchemaSync, W as isStandardSchema, Y as validateSchemaSync, b as buildEnvelopeSchema, d as EVENT_TOOL_PREFIX, f as getAcceptedEvents, l as renderDecisionAttempts, m as parseAgentEvent, n as PLAN_DONE_EVENT_TYPE, p as matchesEventPattern, q as toolMessage, t as DecisionExhaustedError, u as resolveDecision, w as getAgentOutputMode, y as bindRequestExecutor, z as getAgentMessages } from "./decision-FTmbqSEe.mjs";
3
+ export { AgentIdleError, DecisionExhaustedError, EVENT_TOOL_PREFIX, IllegalResumeEventError, PLAN_DONE_EVENT_TYPE, SnapshotVersionMismatchError, appendMessages, assistantMessage, bindRequestExecutor, buildEnvelopeSchema, canReach, createAgentSchemas, createTextLogic, executeAgentRequest, explorePaths, getAcceptedEvents, getAgentMessages, getAgentOutputMode, getAgentRequests, getJsonSchema, getJsonSchemaSync, getMachineStructuralHash, getStateMeta, initialAgentStep, inspectTransitions, isStandardSchema, isStructuredOutputSchema, lintAgentMachine, matchesEventPattern, messagesSchema, parseAgentEvent, parseOutput, persistSnapshot, renderDecisionAttempts, resolveAgentRequests, resolveAgentStep, resolveDecision, runAgent, runAgentToCompletion, setupAgent, simulateAgent, systemMessage, toolMessage, transitionAgentStep, userMessage, validateSchemaSync };