import type { Mastra } from '../../index.js'; import type { AgentExecutionOptions } from '../../agent/index.js'; import type { MultiPrimitiveExecutionOptions, NetworkOptions } from '../../agent/agent.types.js'; import { Agent } from '../../agent/index.js'; import type { MessageListInput } from '../../agent/message-list/index.js'; import type { StructuredOutputOptions } from '../../agent/types.js'; import type { ObservabilityContext } from '../../observability/index.js'; import { ProcessorRunner } from '../../processors/runner.js'; import type { RequestContext } from '../../request-context/index.js'; import { MastraAgentNetworkStream } from '../../stream/MastraAgentNetworkStream.js'; import type { IdGeneratorContext } from '../../types/index.js'; import type { Step } from '../../workflows/index.js'; import type { CompletionConfig } from './validation.js'; /** * Type for ID generator function that can optionally accept context */ type NetworkIdGenerator = (context?: IdGeneratorContext) => string; /** @internal Exported for testing purposes */ export declare function getRoutingAgent({ requestContext, agent, routingConfig, }: { agent: Agent; requestContext: RequestContext; routingConfig?: { additionalInstructions?: string; }; }): Promise>; export declare function getLastMessage(messages: MessageListInput): string; export declare function prepareMemoryStep({ threadId, resourceId, messages, routingAgent, requestContext, generateId, memoryConfig, ...rest }: { threadId: string; resourceId: string; messages: MessageListInput; routingAgent: Agent; requestContext: RequestContext; generateId: NetworkIdGenerator; memoryConfig?: any; } & Partial): Promise<{ thread: import("../../memory").StorageThreadType | undefined; }>; export declare function createNetworkLoop({ networkName, requestContext, runId, agent, generateId, routingAgentOptions, routing, onStepFinish, onError, onAbort, abortSignal, }: { networkName: string; requestContext: RequestContext; runId: string; agent: Agent; routingAgentOptions?: Pick; generateId: NetworkIdGenerator; routing?: { additionalInstructions?: string; verboseIntrospection?: boolean; }; onStepFinish?: (event: any) => Promise | void; onError?: ({ error }: { error: Error | string; }) => Promise | void; onAbort?: (event: any) => Promise | void; abortSignal?: AbortSignal; }): Promise<{ networkWorkflow: import("../../workflows").Workflow[], "Agent-Network-Outer-Workflow", unknown, { task: string; primitiveId: string; primitiveType: "agent" | "workflow" | "tool" | "none"; iteration: number; isOneOff: boolean; verboseIntrospection: boolean; result?: string | undefined; threadId?: string | undefined; threadResourceId?: string | undefined; }, { task: string; primitiveId: string; primitiveType: "agent" | "workflow" | "tool" | "none"; prompt: string; result: string; iteration: number; isOneOff: boolean; isComplete?: boolean | undefined; completionReason?: string | undefined; threadId?: string | undefined; threadResourceId?: string | undefined; }, { task: string; primitiveId: string; primitiveType: "agent" | "workflow" | "tool" | "none"; iteration: number; isOneOff: boolean; verboseIntrospection: boolean; result?: string | undefined; threadId?: string | undefined; threadResourceId?: string | undefined; }, unknown>; processorRunner: ProcessorRunner | null; }>; export declare function networkLoop({ networkName, requestContext, runId, routingAgent, routingAgentOptions, generateId, maxIterations, threadId, resourceId, messages, validation, routing, onIterationComplete, resumeData, autoResumeSuspendedTools, mastra, structuredOutput, onStepFinish, onError, onAbort, abortSignal, }: { networkName: string; requestContext: RequestContext; runId: string; routingAgent: Agent; routingAgentOptions?: AgentExecutionOptions; generateId: NetworkIdGenerator; maxIterations: number; threadId?: string; resourceId?: string; messages: MessageListInput; /** * Completion checks configuration. * When provided, runs checks to verify task completion. */ validation?: CompletionConfig; /** * Optional routing configuration to customize primitive selection behavior. */ routing?: { additionalInstructions?: string; verboseIntrospection?: boolean; }; /** * Optional callback fired after each iteration completes. */ onIterationComplete?: (context: { iteration: number; primitiveId: string; primitiveType: 'agent' | 'workflow' | 'tool' | 'none'; result: string; isComplete: boolean; }) => void | Promise; /** * Structured output configuration for the network's final result. * When provided, generates a structured response matching the schema. */ structuredOutput?: OUTPUT extends {} ? StructuredOutputOptions : never; resumeData?: any; autoResumeSuspendedTools?: boolean; mastra?: Mastra; onStepFinish?: NetworkOptions['onStepFinish']; onError?: NetworkOptions['onError']; onAbort?: NetworkOptions['onAbort']; abortSignal?: NetworkOptions['abortSignal']; }): Promise>; export {}; //# sourceMappingURL=index.d.ts.map