@cchevli/inngest 1.8.1-walton.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 +3981 -0
- package/dist/__tests__/adapters/_utils.d.ts +18 -0
- package/dist/__tests__/adapters/_utils.d.ts.map +1 -0
- package/dist/__tests__/durable-agent.test.utils.d.ts +43 -0
- package/dist/__tests__/durable-agent.test.utils.d.ts.map +1 -0
- package/dist/chunk-MICZJLEE.cjs +1977 -0
- package/dist/chunk-MICZJLEE.cjs.map +1 -0
- package/dist/chunk-SE7QPBOX.js +1970 -0
- package/dist/chunk-SE7QPBOX.js.map +1 -0
- package/dist/connect.cjs +12 -0
- package/dist/connect.cjs.map +1 -0
- package/dist/connect.d.ts +43 -0
- package/dist/connect.d.ts.map +1 -0
- package/dist/connect.js +3 -0
- package/dist/connect.js.map +1 -0
- package/dist/durable-agent/create-inngest-agent.d.ts +425 -0
- package/dist/durable-agent/create-inngest-agent.d.ts.map +1 -0
- package/dist/durable-agent/create-inngest-agentic-workflow.d.ts +56 -0
- package/dist/durable-agent/create-inngest-agentic-workflow.d.ts.map +1 -0
- package/dist/durable-agent/index.d.ts +48 -0
- package/dist/durable-agent/index.d.ts.map +1 -0
- package/dist/execution-engine.d.ts +209 -0
- package/dist/execution-engine.d.ts.map +1 -0
- package/dist/functions.d.ts +7 -0
- package/dist/functions.d.ts.map +1 -0
- package/dist/index.cjs +1576 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +117 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1548 -0
- package/dist/index.js.map +1 -0
- package/dist/nested-workflow-output.d.ts +21 -0
- package/dist/nested-workflow-output.d.ts.map +1 -0
- package/dist/pubsub.d.ts +60 -0
- package/dist/pubsub.d.ts.map +1 -0
- package/dist/run.d.ts +234 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/serve.d.ts +77 -0
- package/dist/serve.d.ts.map +1 -0
- package/dist/types.d.ts +16 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/workflow.d.ts +58 -0
- package/dist/workflow.d.ts.map +1 -0
- package/package.json +98 -0
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Factory function to create an Inngest-powered durable agent.
|
|
3
|
+
*
|
|
4
|
+
* This provides a clean API for wrapping a Mastra Agent with Inngest's
|
|
5
|
+
* durable execution engine. The returned object can be registered with
|
|
6
|
+
* Mastra like any other agent, and the required workflow is automatically
|
|
7
|
+
* registered when added to Mastra.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { Agent } from '@mastra/core/agent';
|
|
12
|
+
* import { createInngestAgent } from '@mastra/inngest';
|
|
13
|
+
* import { Inngest } from 'inngest';
|
|
14
|
+
*
|
|
15
|
+
* const inngest = new Inngest({
|
|
16
|
+
* id: 'my-app',
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* const agent = new Agent({
|
|
20
|
+
* id: 'my-agent',
|
|
21
|
+
* name: 'My Agent',
|
|
22
|
+
* instructions: 'You are a helpful assistant',
|
|
23
|
+
* model: openai('gpt-4'),
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* const durableAgent = createInngestAgent({ agent, inngest });
|
|
27
|
+
*
|
|
28
|
+
* const mastra = new Mastra({
|
|
29
|
+
* agents: { myAgent: durableAgent },
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* // Use the agent
|
|
33
|
+
* const { output, cleanup } = await durableAgent.stream('Hello!');
|
|
34
|
+
* const text = await output.text;
|
|
35
|
+
* cleanup();
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
import type { Agent, AgentExecutionOptions } from '@mastra/core/agent';
|
|
39
|
+
import type { AgentStepFinishEventData, AgentSuspendedEventData } from '@mastra/core/agent/durable';
|
|
40
|
+
import type { MessageListInput } from '@mastra/core/agent/message-list';
|
|
41
|
+
import type { MastraServerCache } from '@mastra/core/cache';
|
|
42
|
+
import type { PubSub } from '@mastra/core/events';
|
|
43
|
+
import type { Mastra } from '@mastra/core/mastra';
|
|
44
|
+
import type { MastraModelOutput, ChunkType, FullOutput, MastraOnFinishCallback } from '@mastra/core/stream';
|
|
45
|
+
import type { Workflow } from '@mastra/core/workflows';
|
|
46
|
+
import type { Inngest } from 'inngest';
|
|
47
|
+
/**
|
|
48
|
+
* Options for createInngestAgent factory function.
|
|
49
|
+
*/
|
|
50
|
+
export interface CreateInngestAgentOptions {
|
|
51
|
+
/** The Mastra Agent to wrap with durable execution */
|
|
52
|
+
agent: Agent<any, any, any>;
|
|
53
|
+
/** Inngest client instance */
|
|
54
|
+
inngest: Inngest;
|
|
55
|
+
/** Optional ID override (defaults to agent.id) */
|
|
56
|
+
id?: string;
|
|
57
|
+
/** Optional name override (defaults to agent.name) */
|
|
58
|
+
name?: string;
|
|
59
|
+
/** Optional PubSub override (defaults to InngestPubSub) */
|
|
60
|
+
pubsub?: PubSub;
|
|
61
|
+
/**
|
|
62
|
+
* Cache instance for storing stream events.
|
|
63
|
+
* Enables resumable streams - clients can disconnect and reconnect
|
|
64
|
+
* without missing events.
|
|
65
|
+
*
|
|
66
|
+
* When provided, the pubsub is wrapped with CachingPubSub.
|
|
67
|
+
*/
|
|
68
|
+
cache?: MastraServerCache;
|
|
69
|
+
/** Mastra instance for observability (optional, set automatically when registered with Mastra) */
|
|
70
|
+
mastra?: Mastra;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Options for InngestAgent.stream().
|
|
74
|
+
*
|
|
75
|
+
* Mirrors `DurableAgentStreamOptions` from `@mastra/core/agent/durable` so that
|
|
76
|
+
* Inngest-backed durable agents accept the same execution surface as the
|
|
77
|
+
* in-memory `DurableAgent`. Most options flow straight through
|
|
78
|
+
* `prepareForDurableExecution` and onto the shared workflow steps; see
|
|
79
|
+
* `.context/durable-agent-parity.md` for the per-option durability matrix.
|
|
80
|
+
*/
|
|
81
|
+
export interface InngestAgentStreamOptions<OUTPUT = undefined> {
|
|
82
|
+
/** Custom instructions that override the agent's default instructions */
|
|
83
|
+
instructions?: AgentExecutionOptions<OUTPUT>['instructions'];
|
|
84
|
+
/** Additional context messages */
|
|
85
|
+
context?: AgentExecutionOptions<OUTPUT>['context'];
|
|
86
|
+
/** Memory configuration */
|
|
87
|
+
memory?: AgentExecutionOptions<OUTPUT>['memory'];
|
|
88
|
+
/** Unique identifier for this execution run */
|
|
89
|
+
runId?: string;
|
|
90
|
+
/** Request Context */
|
|
91
|
+
requestContext?: AgentExecutionOptions<OUTPUT>['requestContext'];
|
|
92
|
+
/** Maximum number of steps */
|
|
93
|
+
maxSteps?: number;
|
|
94
|
+
/**
|
|
95
|
+
* Stop condition(s) for the agentic loop. Data-shaped conditions are
|
|
96
|
+
* serialized into the workflow snapshot; function-form conditions are stored
|
|
97
|
+
* on the in-process run registry and degrade to "no extra stop" on a
|
|
98
|
+
* cross-worker resume (same as core DurableAgent).
|
|
99
|
+
*/
|
|
100
|
+
stopWhen?: AgentExecutionOptions<OUTPUT>['stopWhen'];
|
|
101
|
+
/** Additional tool sets */
|
|
102
|
+
toolsets?: AgentExecutionOptions<OUTPUT>['toolsets'];
|
|
103
|
+
/** Client-side tools */
|
|
104
|
+
clientTools?: AgentExecutionOptions<OUTPUT>['clientTools'];
|
|
105
|
+
/** Tool selection strategy */
|
|
106
|
+
toolChoice?: AgentExecutionOptions<OUTPUT>['toolChoice'];
|
|
107
|
+
/** Tool names enabled for this execution */
|
|
108
|
+
activeTools?: AgentExecutionOptions<OUTPUT>['activeTools'];
|
|
109
|
+
/** Model settings */
|
|
110
|
+
modelSettings?: AgentExecutionOptions<OUTPUT>['modelSettings'];
|
|
111
|
+
/** Require approval for tool calls. Boolean (gate all / none) or a per-call function policy. */
|
|
112
|
+
requireToolApproval?: AgentExecutionOptions<OUTPUT>['requireToolApproval'];
|
|
113
|
+
/** Automatically resume suspended tools */
|
|
114
|
+
autoResumeSuspendedTools?: boolean;
|
|
115
|
+
/** Maximum concurrent tool calls */
|
|
116
|
+
toolCallConcurrency?: number;
|
|
117
|
+
/** Include raw chunks in output */
|
|
118
|
+
includeRawChunks?: boolean;
|
|
119
|
+
/** Maximum processor retries */
|
|
120
|
+
maxProcessorRetries?: number;
|
|
121
|
+
/** Structured output configuration */
|
|
122
|
+
structuredOutput?: AgentExecutionOptions<OUTPUT>['structuredOutput'];
|
|
123
|
+
/** Version overrides for sub-agent delegation */
|
|
124
|
+
versions?: AgentExecutionOptions<OUTPUT>['versions'];
|
|
125
|
+
/** Additional system message appended after context but before user messages. */
|
|
126
|
+
system?: AgentExecutionOptions<OUTPUT>['system'];
|
|
127
|
+
/** When true, background tasks are disabled for this run. */
|
|
128
|
+
disableBackgroundTasks?: AgentExecutionOptions<OUTPUT>['disableBackgroundTasks'];
|
|
129
|
+
/** Tracing options forwarded to the agent/model spans. */
|
|
130
|
+
tracingOptions?: AgentExecutionOptions<OUTPUT>['tracingOptions'];
|
|
131
|
+
/** Per-call actor signal forwarded to FGA checks and tool execution. */
|
|
132
|
+
actor?: AgentExecutionOptions<OUTPUT>['actor'];
|
|
133
|
+
/**
|
|
134
|
+
* Tool payload transform policy. `targets` is JSON-safe and persisted in the
|
|
135
|
+
* workflow snapshot; `transformToolPayload` is a closure on the run registry
|
|
136
|
+
* and degrades on cross-worker resume.
|
|
137
|
+
*/
|
|
138
|
+
transform?: AgentExecutionOptions<OUTPUT>['transform'];
|
|
139
|
+
/**
|
|
140
|
+
* Per-step preparation hook. Stored on the run registry and applied via a
|
|
141
|
+
* processor in the durable LLM step. Closure — degrades on cross-worker
|
|
142
|
+
* resume.
|
|
143
|
+
*/
|
|
144
|
+
prepareStep?: AgentExecutionOptions<OUTPUT>['prepareStep'];
|
|
145
|
+
/**
|
|
146
|
+
* Optional completion config (scorers + onComplete + suppressFeedback).
|
|
147
|
+
* JSON-safe parts are serialized; the `onComplete` callback lives on the run
|
|
148
|
+
* registry and degrades on cross-worker resume.
|
|
149
|
+
*/
|
|
150
|
+
isTaskComplete?: AgentExecutionOptions<OUTPUT>['isTaskComplete'];
|
|
151
|
+
/**
|
|
152
|
+
* Sub-agent delegation hooks. Forwarded into `convertTools` at prepare time
|
|
153
|
+
* and baked into the sub-agent tool wrappers stored on the run registry.
|
|
154
|
+
* Cross-worker resume on a fresh worker loses the callbacks and degrades to
|
|
155
|
+
* the agent's default delegation.
|
|
156
|
+
*/
|
|
157
|
+
delegation?: AgentExecutionOptions<OUTPUT>['delegation'];
|
|
158
|
+
/** Callback when chunk is received */
|
|
159
|
+
onChunk?: (chunk: ChunkType<OUTPUT>) => void | Promise<void>;
|
|
160
|
+
/** Callback when step finishes */
|
|
161
|
+
onStepFinish?: (result: AgentStepFinishEventData) => void | Promise<void>;
|
|
162
|
+
/** Callback when execution finishes */
|
|
163
|
+
onFinish?: MastraOnFinishCallback<OUTPUT>;
|
|
164
|
+
/** Callback on error */
|
|
165
|
+
onError?: ({ error }: {
|
|
166
|
+
error: Error | string;
|
|
167
|
+
}) => void | Promise<void>;
|
|
168
|
+
/** Callback when workflow suspends */
|
|
169
|
+
onSuspended?: (data: AgentSuspendedEventData) => void | Promise<void>;
|
|
170
|
+
/** Callback when execution is aborted via abortSignal or `result.abort()` */
|
|
171
|
+
onAbort?: AgentExecutionOptions<OUTPUT>['onAbort'];
|
|
172
|
+
/** Callback fired after each agentic-loop iteration (observation only) */
|
|
173
|
+
onIterationComplete?: AgentExecutionOptions<OUTPUT>['onIterationComplete'];
|
|
174
|
+
/**
|
|
175
|
+
* Optional external abort signal. Forwarded onto an internal AbortController
|
|
176
|
+
* stored on the run registry. Either the external signal or
|
|
177
|
+
* `result.abort()` will cancel the stream and emit an ABORT event over
|
|
178
|
+
* pubsub.
|
|
179
|
+
*/
|
|
180
|
+
abortSignal?: AbortSignal;
|
|
181
|
+
/**
|
|
182
|
+
* When set, `stream()` delegates to the idle-loop wrapper that keeps the
|
|
183
|
+
* outer stream open across background-task continuations.
|
|
184
|
+
*
|
|
185
|
+
* Pass `true` for default idle timeout (5 min), or `{ maxIdleMs }` to
|
|
186
|
+
* customise.
|
|
187
|
+
*/
|
|
188
|
+
untilIdle?: boolean | {
|
|
189
|
+
maxIdleMs?: number;
|
|
190
|
+
};
|
|
191
|
+
/** @internal */
|
|
192
|
+
_skipBgTaskWait?: boolean;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Result from InngestAgent.stream()
|
|
196
|
+
*/
|
|
197
|
+
export interface InngestAgentStreamResult<OUTPUT = undefined> {
|
|
198
|
+
/** The streaming output */
|
|
199
|
+
output: MastraModelOutput<OUTPUT>;
|
|
200
|
+
/** The full stream - delegates to output.fullStream for server compatibility */
|
|
201
|
+
readonly fullStream: ReadableStream<any>;
|
|
202
|
+
/** The unique run ID */
|
|
203
|
+
runId: string;
|
|
204
|
+
/** Thread ID if using memory */
|
|
205
|
+
threadId?: string;
|
|
206
|
+
/** Resource ID if using memory */
|
|
207
|
+
resourceId?: string;
|
|
208
|
+
/** Cleanup function */
|
|
209
|
+
cleanup: () => void;
|
|
210
|
+
/**
|
|
211
|
+
* Abort this run. Flips the internal AbortController for this stream so the
|
|
212
|
+
* durable LLM step short-circuits (when the step worker shares the same
|
|
213
|
+
* process) and emits an ABORT event over pubsub so the consumer stream
|
|
214
|
+
* closes. Safe to call after the run has already finished.
|
|
215
|
+
*/
|
|
216
|
+
abort: (reason?: unknown) => void;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Options for InngestAgent.resume(). Mirrors core DurableAgent.resume().
|
|
220
|
+
*/
|
|
221
|
+
export interface InngestAgentResumeOptions<OUTPUT = undefined> {
|
|
222
|
+
threadId?: string;
|
|
223
|
+
resourceId?: string;
|
|
224
|
+
onChunk?: (chunk: ChunkType<OUTPUT>) => void | Promise<void>;
|
|
225
|
+
onStepFinish?: (result: AgentStepFinishEventData) => void | Promise<void>;
|
|
226
|
+
onFinish?: MastraOnFinishCallback<OUTPUT>;
|
|
227
|
+
onError?: ({ error }: {
|
|
228
|
+
error: Error | string;
|
|
229
|
+
}) => void | Promise<void>;
|
|
230
|
+
onSuspended?: (data: AgentSuspendedEventData) => void | Promise<void>;
|
|
231
|
+
/** Callback when execution is aborted via abortSignal or `result.abort()` */
|
|
232
|
+
onAbort?: AgentExecutionOptions<OUTPUT>['onAbort'];
|
|
233
|
+
/**
|
|
234
|
+
* Optional abort signal scoped to the resumed segment. Forwarded onto a
|
|
235
|
+
* fresh internal controller installed on the run's registry entry, so
|
|
236
|
+
* `result.abort()` and the external signal can both cancel the resumed
|
|
237
|
+
* iterations.
|
|
238
|
+
*/
|
|
239
|
+
abortSignal?: AbortSignal;
|
|
240
|
+
/**
|
|
241
|
+
* When set, keep the resumed segment open after the workflow's initial
|
|
242
|
+
* resume turn finishes and continue streaming follow-up turns until the
|
|
243
|
+
* agent goes idle (no in-flight background tasks for the same memory
|
|
244
|
+
* scope). Same semantics as `stream({ untilIdle })`. Pass an object to
|
|
245
|
+
* tune `maxIdleMs`.
|
|
246
|
+
*/
|
|
247
|
+
untilIdle?: boolean | {
|
|
248
|
+
maxIdleMs?: number;
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* An Inngest-powered durable agent.
|
|
253
|
+
*
|
|
254
|
+
* This interface represents an agent that uses Inngest's durable execution engine.
|
|
255
|
+
* It can be registered with Mastra like a regular Agent, and the required workflow
|
|
256
|
+
* is automatically registered.
|
|
257
|
+
*
|
|
258
|
+
* At runtime, a Proxy forwards all Agent method calls (e.g., `generate()`, `listTools()`,
|
|
259
|
+
* `getMemory()`) to the underlying agent. The index signature below reflects this:
|
|
260
|
+
* any property not explicitly declared here is available via the Proxy.
|
|
261
|
+
*/
|
|
262
|
+
export interface InngestAgent<TOutput = undefined> {
|
|
263
|
+
/** Agent ID */
|
|
264
|
+
readonly id: string;
|
|
265
|
+
/** Agent name */
|
|
266
|
+
readonly name: string;
|
|
267
|
+
/** The underlying Mastra Agent (for Mastra registration) */
|
|
268
|
+
readonly agent: Agent<any, any, TOutput>;
|
|
269
|
+
/** The Inngest client */
|
|
270
|
+
readonly inngest: Inngest;
|
|
271
|
+
/** The cache instance if resumable streams are enabled */
|
|
272
|
+
readonly cache?: MastraServerCache;
|
|
273
|
+
/**
|
|
274
|
+
* The PubSub instance used for streaming events.
|
|
275
|
+
* Returns the CachingPubSub wrapper if caching is enabled.
|
|
276
|
+
* @internal Used by the server's observe endpoint to subscribe to the correct PubSub instance.
|
|
277
|
+
*/
|
|
278
|
+
readonly pubsub: PubSub;
|
|
279
|
+
/**
|
|
280
|
+
* Stream a response using Inngest's durable execution.
|
|
281
|
+
*/
|
|
282
|
+
stream(messages: MessageListInput, options?: InngestAgentStreamOptions<TOutput>): Promise<InngestAgentStreamResult<TOutput>>;
|
|
283
|
+
/**
|
|
284
|
+
* Resume a suspended workflow execution.
|
|
285
|
+
*/
|
|
286
|
+
resume(runId: string, resumeData: unknown, options?: InngestAgentResumeOptions<TOutput>): Promise<InngestAgentStreamResult<TOutput>>;
|
|
287
|
+
/**
|
|
288
|
+
* Prepare for durable execution without starting it.
|
|
289
|
+
*/
|
|
290
|
+
prepare(messages: MessageListInput, options?: AgentExecutionOptions<TOutput>): Promise<{
|
|
291
|
+
runId: string;
|
|
292
|
+
messageId: string;
|
|
293
|
+
workflowInput: any;
|
|
294
|
+
threadId?: string;
|
|
295
|
+
resourceId?: string;
|
|
296
|
+
}>;
|
|
297
|
+
/**
|
|
298
|
+
* Observe (reconnect to) an existing stream.
|
|
299
|
+
* Use this to resume receiving events after a disconnection.
|
|
300
|
+
*
|
|
301
|
+
* @param runId - The run ID to observe
|
|
302
|
+
* @param options.offset - Resume from this event index (0-based). If omitted, replays all events.
|
|
303
|
+
*/
|
|
304
|
+
observe(runId: string, options?: {
|
|
305
|
+
offset?: number;
|
|
306
|
+
onChunk?: (chunk: ChunkType<TOutput>) => void | Promise<void>;
|
|
307
|
+
onStepFinish?: (result: AgentStepFinishEventData) => void | Promise<void>;
|
|
308
|
+
onFinish?: MastraOnFinishCallback<TOutput>;
|
|
309
|
+
onError?: ({ error }: {
|
|
310
|
+
error: Error | string;
|
|
311
|
+
}) => void | Promise<void>;
|
|
312
|
+
onSuspended?: (data: AgentSuspendedEventData) => void | Promise<void>;
|
|
313
|
+
}): Promise<Omit<InngestAgentStreamResult<TOutput>, 'threadId' | 'resourceId'> & {
|
|
314
|
+
runId: string;
|
|
315
|
+
}>;
|
|
316
|
+
/**
|
|
317
|
+
* Get the durable workflows required by this agent.
|
|
318
|
+
* Called by Mastra during agent registration.
|
|
319
|
+
* @internal
|
|
320
|
+
*/
|
|
321
|
+
getDurableWorkflows(): Workflow<any, any, any, any, any, any, any>[];
|
|
322
|
+
/**
|
|
323
|
+
* Set the Mastra instance for observability.
|
|
324
|
+
* Called by Mastra during agent registration.
|
|
325
|
+
* @internal
|
|
326
|
+
*/
|
|
327
|
+
__setMastra(mastra: Mastra): void;
|
|
328
|
+
/**
|
|
329
|
+
* Drain a durable run to a single {@link FullOutput}. Mirrors
|
|
330
|
+
* {@link DurableAgent.generate}: kicks off the same Inngest durable
|
|
331
|
+
* workflow as {@link InngestAgent.stream}, but threads
|
|
332
|
+
* `methodType: 'generate'` into preparation (so tool/preparation paths
|
|
333
|
+
* that branch on method behave consistently with non-durable
|
|
334
|
+
* `Agent.generate`) and awaits `output.getFullOutput()`.
|
|
335
|
+
*
|
|
336
|
+
* If the run suspends (e.g. tool approval), the returned output's
|
|
337
|
+
* `finishReason` is `'suspended'` — use {@link InngestAgent.resumeGenerate}
|
|
338
|
+
* to continue. The run registry entry is intentionally not cleaned up on
|
|
339
|
+
* suspend so resume can pick it up.
|
|
340
|
+
*/
|
|
341
|
+
generate(messages: MessageListInput, options?: InngestAgentStreamOptions<TOutput>): Promise<FullOutput<TOutput>>;
|
|
342
|
+
/**
|
|
343
|
+
* Resume a suspended durable run and drain it to a single
|
|
344
|
+
* {@link FullOutput}. Mirrors {@link DurableAgent.resumeGenerate} on top
|
|
345
|
+
* of {@link InngestAgent.resume}.
|
|
346
|
+
*/
|
|
347
|
+
resumeGenerate(runId: string, resumeData: unknown, options?: InngestAgentResumeOptions<TOutput>): Promise<FullOutput<TOutput>>;
|
|
348
|
+
/** Get the agent's description. Forwarded to the underlying Agent. */
|
|
349
|
+
getDescription(): string;
|
|
350
|
+
/** Get the agent's instructions. Forwarded to the underlying Agent. */
|
|
351
|
+
getInstructions(...args: any[]): any;
|
|
352
|
+
/** List tools available to the agent. Forwarded to the underlying Agent. */
|
|
353
|
+
listTools(...args: any[]): any;
|
|
354
|
+
/** Get the agent's LLM configuration. Forwarded to the underlying Agent. */
|
|
355
|
+
getLLM(...args: any[]): any;
|
|
356
|
+
/** Get the agent's model. Forwarded to the underlying Agent. */
|
|
357
|
+
getModel(...args: any[]): any;
|
|
358
|
+
/** Get the agent's memory instance. Forwarded to the underlying Agent. */
|
|
359
|
+
getMemory(...args: any[]): any;
|
|
360
|
+
/** Check if agent has its own memory. Forwarded to the underlying Agent. */
|
|
361
|
+
hasOwnMemory(): boolean;
|
|
362
|
+
/** Get the agent's workspace. Forwarded to the underlying Agent. */
|
|
363
|
+
getWorkspace(...args: any[]): any;
|
|
364
|
+
/** List sub-agents. Forwarded to the underlying Agent. */
|
|
365
|
+
listAgents(...args: any[]): any;
|
|
366
|
+
/** List workflows. Forwarded to the underlying Agent. */
|
|
367
|
+
listWorkflows(...args: any[]): any;
|
|
368
|
+
/** Get default execution options. Forwarded to the underlying Agent. */
|
|
369
|
+
getDefaultOptions(...args: any[]): any;
|
|
370
|
+
/** Get legacy generate options. Forwarded to the underlying Agent. */
|
|
371
|
+
getDefaultGenerateOptionsLegacy(...args: any[]): any;
|
|
372
|
+
/** Get legacy stream options. Forwarded to the underlying Agent. */
|
|
373
|
+
getDefaultStreamOptionsLegacy(...args: any[]): any;
|
|
374
|
+
/** Get available models. Forwarded to the underlying Agent. */
|
|
375
|
+
getModelList(...args: any[]): any;
|
|
376
|
+
/** Get configured processor workflows. Forwarded to the underlying Agent. */
|
|
377
|
+
getConfiguredProcessorWorkflows(...args: any[]): any;
|
|
378
|
+
/** Get raw agent configuration. Forwarded to the underlying Agent. */
|
|
379
|
+
toRawConfig(...args: any[]): any;
|
|
380
|
+
/** Resume a streaming execution. Forwarded to the underlying Agent. */
|
|
381
|
+
resumeStream(...args: any[]): any;
|
|
382
|
+
/** Approve a pending tool call. Forwarded to the underlying Agent. */
|
|
383
|
+
approveToolCall(...args: any[]): any;
|
|
384
|
+
/** @internal Update the agent's model. Forwarded to the underlying Agent. */
|
|
385
|
+
__updateModel(...args: any[]): any;
|
|
386
|
+
/** @internal Reset to original model. Forwarded to the underlying Agent. */
|
|
387
|
+
__resetToOriginalModel(...args: any[]): any;
|
|
388
|
+
/** @internal Set logger. Forwarded to the underlying Agent. */
|
|
389
|
+
__setLogger(...args: any[]): any;
|
|
390
|
+
/** @internal Register primitives. Forwarded to the underlying Agent. */
|
|
391
|
+
__registerPrimitives(...args: any[]): any;
|
|
392
|
+
/** @internal Register Mastra instance. Forwarded to the underlying Agent. */
|
|
393
|
+
__registerMastra(...args: any[]): any;
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Create an Inngest-powered durable agent from a Mastra Agent.
|
|
397
|
+
*
|
|
398
|
+
* This factory function wraps a regular Mastra Agent with Inngest's durable
|
|
399
|
+
* execution capabilities. The returned InngestAgent can be registered with
|
|
400
|
+
* Mastra, and the required workflow will be automatically registered.
|
|
401
|
+
*
|
|
402
|
+
* @param options - Configuration options
|
|
403
|
+
* @returns An InngestAgent that can be registered with Mastra
|
|
404
|
+
*
|
|
405
|
+
* @example
|
|
406
|
+
* ```typescript
|
|
407
|
+
* const agent = new Agent({
|
|
408
|
+
* id: 'my-agent',
|
|
409
|
+
* instructions: 'You are helpful',
|
|
410
|
+
* model: openai('gpt-4'),
|
|
411
|
+
* });
|
|
412
|
+
*
|
|
413
|
+
* const durableAgent = createInngestAgent({ agent, inngest });
|
|
414
|
+
*
|
|
415
|
+
* const mastra = new Mastra({
|
|
416
|
+
* agents: { myAgent: durableAgent },
|
|
417
|
+
* });
|
|
418
|
+
* ```
|
|
419
|
+
*/
|
|
420
|
+
export declare function createInngestAgent<TOutput = undefined>(options: CreateInngestAgentOptions): InngestAgent<TOutput>;
|
|
421
|
+
/**
|
|
422
|
+
* Check if an object is an InngestAgent
|
|
423
|
+
*/
|
|
424
|
+
export declare function isInngestAgent(obj: any): obj is InngestAgent;
|
|
425
|
+
//# sourceMappingURL=create-inngest-agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-inngest-agent.d.ts","sourceRoot":"","sources":["../../src/durable-agent/create-inngest-agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AASvE,OAAO,KAAK,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACpG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAExE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC5G,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AA8BvC;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,sDAAsD;IACtD,KAAK,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IAC5B,8BAA8B;IAC9B,OAAO,EA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AC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;IACjC,uEAAuE;IACvE,YAAY,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;IAClC,sEAAsE;IACtE,eAAe,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;IACrC,6EAA6E;IAC7E,aAAa,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;IACnC,4EAA4E;IAC5E,sBAAsB,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;IAC5C,+DAA+D;IAC/D,WAAW,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;IACjC,wEAAwE;IACxE,oBAAoB,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;IAC1C,6EAA6E;IAC7E,gBAAgB,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;CACvC;AAMD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAG,SAAS,EAAE,OAAO,EAAE,yBAAyB,GAAG,YAAY,CAAC,OAAO,CAAC,CAutBjH;AAMD;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,YAAY,CAU5D"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Inngest } from 'inngest';
|
|
2
|
+
/**
|
|
3
|
+
* Options for creating an Inngest durable agentic workflow
|
|
4
|
+
*/
|
|
5
|
+
export interface InngestDurableAgenticWorkflowOptions {
|
|
6
|
+
/** Inngest client instance */
|
|
7
|
+
inngest: Inngest;
|
|
8
|
+
/** Maximum number of agentic loop iterations */
|
|
9
|
+
maxSteps?: number;
|
|
10
|
+
}
|
|
11
|
+
/** Inngest-prefixed workflow IDs */
|
|
12
|
+
export declare const InngestDurableStepIds: {
|
|
13
|
+
readonly AGENTIC_EXECUTION: "inngest:durable-agentic-execution";
|
|
14
|
+
readonly AGENTIC_LOOP: "inngest:durable-agentic-loop";
|
|
15
|
+
};
|
|
16
|
+
export declare function createInngestDurableAgenticWorkflow(options: InngestDurableAgenticWorkflowOptions): import("@mastra/core/workflows").Workflow<import("../types").InngestEngineType, never[], "inngest:durable-agentic-loop", any, {
|
|
17
|
+
runId: string;
|
|
18
|
+
agentId: string;
|
|
19
|
+
messageListState: any;
|
|
20
|
+
toolsMetadata: any[];
|
|
21
|
+
modelConfig: {
|
|
22
|
+
provider: string;
|
|
23
|
+
modelId: string;
|
|
24
|
+
specificationVersion?: string | undefined;
|
|
25
|
+
settings?: Record<string, any> | undefined;
|
|
26
|
+
providerOptions?: Record<string, any> | undefined;
|
|
27
|
+
};
|
|
28
|
+
options: any;
|
|
29
|
+
state: any;
|
|
30
|
+
messageId: string;
|
|
31
|
+
agentName?: string | undefined;
|
|
32
|
+
agentSpanData?: any;
|
|
33
|
+
modelSpanData?: any;
|
|
34
|
+
stepIndex?: number | undefined;
|
|
35
|
+
}, {
|
|
36
|
+
messageListState: any;
|
|
37
|
+
messageId: string;
|
|
38
|
+
stepResult: any;
|
|
39
|
+
output: {
|
|
40
|
+
usage: any;
|
|
41
|
+
steps: any[];
|
|
42
|
+
text?: string | undefined;
|
|
43
|
+
};
|
|
44
|
+
state: any;
|
|
45
|
+
}, {
|
|
46
|
+
messageListState: any;
|
|
47
|
+
messageId: string;
|
|
48
|
+
stepResult: any;
|
|
49
|
+
output: {
|
|
50
|
+
usage: any;
|
|
51
|
+
steps: any[];
|
|
52
|
+
text?: string | undefined;
|
|
53
|
+
};
|
|
54
|
+
state: any;
|
|
55
|
+
}, unknown>;
|
|
56
|
+
//# sourceMappingURL=create-inngest-agentic-workflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-inngest-agentic-workflow.d.ts","sourceRoot":"","sources":["../../src/durable-agent/create-inngest-agentic-workflow.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AA2BvC;;GAEG;AACH,MAAM,WAAW,oCAAoC;IACnD,8BAA8B;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,gDAAgD;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAuCD,oCAAoC;AACpC,eAAO,MAAM,qBAAqB;;;CAGxB,CAAC;AAEX,wBAAgB,mCAAmC,CAAC,OAAO,EAAE,oCAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAgUhG"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inngest DurableAgent Module
|
|
3
|
+
*
|
|
4
|
+
* Provides durable AI agent execution through Inngest's execution engine.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { Agent } from '@mastra/core/agent';
|
|
9
|
+
* import { createInngestAgent, serve as inngestServe } from '@mastra/inngest';
|
|
10
|
+
* import { Mastra } from '@mastra/core/mastra';
|
|
11
|
+
* import { Inngest } from 'inngest';
|
|
12
|
+
*
|
|
13
|
+
* const inngest = new Inngest({
|
|
14
|
+
* id: 'my-app',
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* // 1. Create a regular Mastra agent
|
|
18
|
+
* const agent = new Agent({
|
|
19
|
+
* id: 'my-agent',
|
|
20
|
+
* name: 'My Agent',
|
|
21
|
+
* instructions: 'You are a helpful assistant',
|
|
22
|
+
* model: openai('gpt-4'),
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* // 2. Wrap it with Inngest durable execution
|
|
26
|
+
* const durableAgent = createInngestAgent({ agent, inngest });
|
|
27
|
+
*
|
|
28
|
+
* // 3. Register with Mastra (workflow is auto-registered)
|
|
29
|
+
* const mastra = new Mastra({
|
|
30
|
+
* agents: { myAgent: durableAgent },
|
|
31
|
+
* server: {
|
|
32
|
+
* apiRoutes: [{
|
|
33
|
+
* path: '/inngest/api',
|
|
34
|
+
* method: 'ALL',
|
|
35
|
+
* createHandler: async ({ mastra }) => inngestServe({ mastra, inngest }),
|
|
36
|
+
* }],
|
|
37
|
+
* },
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* // 4. Use the agent
|
|
41
|
+
* const { output, cleanup } = await durableAgent.stream('Hello!');
|
|
42
|
+
* const text = await output.text;
|
|
43
|
+
* cleanup();
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export { createInngestAgent, isInngestAgent, type InngestAgent, type CreateInngestAgentOptions, type InngestAgentStreamOptions, type InngestAgentStreamResult, } from './create-inngest-agent.js';
|
|
47
|
+
export { createInngestDurableAgenticWorkflow, type InngestDurableAgenticWorkflowOptions, } from './create-inngest-agentic-workflow.js';
|
|
48
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/durable-agent/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAGH,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,KAAK,YAAY,EACjB,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,GAC9B,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,mCAAmC,EACnC,KAAK,oCAAoC,GAC1C,MAAM,mCAAmC,CAAC"}
|