UNPKG

@mastra/core

Version:

The core foundation of the Mastra framework, providing essential components and interfaces for building AI-powered applications.

259 lines • 10.7 kB
import { z } from 'zod'; import type { Mastra, Tool } from '../..'; import { Agent } from '../../agent'; import type { MastraLanguageModel } from '../../agent'; import { MastraBase } from '../../base'; import type { MastraMemory } from '../../memory'; import { RuntimeContext } from '../../runtime-context'; import type { DynamicArgument } from '../../types'; import type { Workflow } from '../../workflows'; interface NewAgentNetworkConfig { id: string; name: string; instructions: DynamicArgument<string>; model: DynamicArgument<MastraLanguageModel>; agents: DynamicArgument<Record<string, Agent>>; workflows?: DynamicArgument<Record<string, Workflow>>; tools?: DynamicArgument<Record<string, Tool<any, any, any>>>; memory?: DynamicArgument<MastraMemory>; defaultAgent?: DynamicArgument<Agent>; } export declare class NewAgentNetwork extends MastraBase { #private; id: string; name: string; constructor({ id, name, instructions, model, agents, workflows, memory, tools, defaultAgent, }: NewAgentNetworkConfig); __registerMastra(mastra: Mastra): void; private beforeRun; getAgents({ runtimeContext }: { runtimeContext?: RuntimeContext; }): Promise<Record<string, Agent<string, import("../../agent").ToolsInput, Record<string, import("../..").Metric>>>>; getWorkflows({ runtimeContext }: { runtimeContext?: RuntimeContext; }): Promise<Record<string, Workflow<any, import("../..").Step<string, any, any, any, any, any>[], string, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>>>>; getTools({ runtimeContext }: { runtimeContext?: RuntimeContext; }): Promise<Record<string, Tool<undefined, undefined, import("../..").ToolExecutionContext<undefined>>>>; getMemory({ runtimeContext }: { runtimeContext?: RuntimeContext; }): Promise<MastraMemory | undefined>; getInstructions({ runtimeContext }: { runtimeContext?: RuntimeContext; }): Promise<string>; getRoutingAgent({ runtimeContext }: { runtimeContext?: RuntimeContext; }): Promise<Agent<"routing-agent", import("../../agent").ToolsInput, Record<string, import("../..").Metric>>>; loop(message: string, { runtimeContext, maxIterations, }: { runtimeContext?: RuntimeContext; maxIterations?: number; }): Promise<{ status: "success"; result: { resourceId: string; result: string; prompt: string; task: string; resourceType: "none" | "tool" | "workflow" | "agent"; iteration: number; isOneOff: boolean; threadId?: string | undefined; threadResourceId?: string | undefined; isComplete?: boolean | undefined; completionReason?: string | undefined; }; steps: { [x: string]: import("../..").StepResult<any, any, any, any> | import("../..").StepResult<unknown, unknown, unknown, unknown>; }; }>; loopStream(message: string, { runtimeContext, maxIterations, threadId, resourceId, }: { runtimeContext?: RuntimeContext; maxIterations?: number; threadId?: string; resourceId?: string; }): Promise<{ stream: import("stream/web").ReadableStream<import("../..").StreamEvent>; getWorkflowState: () => Promise<import("../..").WorkflowResult<z.ZodObject<{ task: z.ZodString; resourceId: z.ZodString; resourceType: z.ZodEnum<["agent", "workflow", "none", "tool", "none"]>; prompt: z.ZodString; result: z.ZodString; isComplete: z.ZodOptional<z.ZodBoolean>; completionReason: z.ZodOptional<z.ZodString>; iteration: z.ZodNumber; }, "strip", z.ZodTypeAny, { resourceId: string; result: string; prompt: string; task: string; resourceType: "none" | "tool" | "workflow" | "agent"; iteration: number; isComplete?: boolean | undefined; completionReason?: string | undefined; }, { resourceId: string; result: string; prompt: string; task: string; resourceType: "none" | "tool" | "workflow" | "agent"; iteration: number; isComplete?: boolean | undefined; completionReason?: string | undefined; }>, import("../..").Step<string, any, any, any, any, import("../..").DefaultEngineType>[]>>; }>; createWorkflow({ runtimeContext }: { runtimeContext?: RuntimeContext; }): Workflow<import("../..").DefaultEngineType, import("../..").Step<string, any, any, any, any, import("../..").DefaultEngineType>[], "Agent-Network-Outer-Workflow", z.ZodObject<{ task: z.ZodString; resourceId: z.ZodString; resourceType: z.ZodEnum<["agent", "workflow", "none", "tool", "none"]>; result: z.ZodOptional<z.ZodString>; iteration: z.ZodNumber; threadId: z.ZodOptional<z.ZodString>; threadResourceId: z.ZodOptional<z.ZodString>; isOneOff: z.ZodBoolean; verboseIntrospection: z.ZodBoolean; }, "strip", z.ZodTypeAny, { resourceId: string; task: string; resourceType: "none" | "tool" | "workflow" | "agent"; iteration: number; isOneOff: boolean; verboseIntrospection: boolean; threadId?: string | undefined; result?: string | undefined; threadResourceId?: string | undefined; }, { resourceId: string; task: string; resourceType: "none" | "tool" | "workflow" | "agent"; iteration: number; isOneOff: boolean; verboseIntrospection: boolean; threadId?: string | undefined; result?: string | undefined; threadResourceId?: string | undefined; }>, z.ZodObject<{ task: z.ZodString; resourceId: z.ZodString; resourceType: z.ZodEnum<["agent", "workflow", "none", "tool", "none"]>; prompt: z.ZodString; result: z.ZodString; isComplete: z.ZodOptional<z.ZodBoolean>; completionReason: z.ZodOptional<z.ZodString>; iteration: z.ZodNumber; threadId: z.ZodOptional<z.ZodString>; threadResourceId: z.ZodOptional<z.ZodString>; isOneOff: z.ZodBoolean; }, "strip", z.ZodTypeAny, { resourceId: string; result: string; prompt: string; task: string; resourceType: "none" | "tool" | "workflow" | "agent"; iteration: number; isOneOff: boolean; threadId?: string | undefined; threadResourceId?: string | undefined; isComplete?: boolean | undefined; completionReason?: string | undefined; }, { resourceId: string; result: string; prompt: string; task: string; resourceType: "none" | "tool" | "workflow" | "agent"; iteration: number; isOneOff: boolean; threadId?: string | undefined; threadResourceId?: string | undefined; isComplete?: boolean | undefined; completionReason?: string | undefined; }>, z.ZodObject<{ task: z.ZodString; resourceId: z.ZodString; resourceType: z.ZodEnum<["agent", "workflow", "none", "tool", "none"]>; result: z.ZodOptional<z.ZodString>; iteration: z.ZodNumber; threadId: z.ZodOptional<z.ZodString>; threadResourceId: z.ZodOptional<z.ZodString>; isOneOff: z.ZodBoolean; verboseIntrospection: z.ZodBoolean; }, "strip", z.ZodTypeAny, { resourceId: string; task: string; resourceType: "none" | "tool" | "workflow" | "agent"; iteration: number; isOneOff: boolean; verboseIntrospection: boolean; threadId?: string | undefined; result?: string | undefined; threadResourceId?: string | undefined; }, { resourceId: string; task: string; resourceType: "none" | "tool" | "workflow" | "agent"; iteration: number; isOneOff: boolean; verboseIntrospection: boolean; threadId?: string | undefined; result?: string | undefined; threadResourceId?: string | undefined; }>>; generate(message: string, { runtimeContext, threadId, resourceId, }: { runtimeContext?: RuntimeContext; threadId?: string; resourceId?: string; }): Promise<{ task: string; result: string; resourceId: string; resourceType: "none" | "tool" | "workflow" | "agent"; }>; stream(message: string, { runtimeContext, threadId, resourceId, }: { runtimeContext?: RuntimeContext; resourceId?: string; threadId?: string; }): Promise<{ stream: import("stream/web").ReadableStream<import("../..").StreamEvent>; getWorkflowState: () => Promise<import("../..").WorkflowResult<z.ZodObject<{ task: z.ZodString; resourceId: z.ZodString; resourceType: z.ZodEnum<["agent", "workflow", "none", "tool", "none"]>; prompt: z.ZodString; result: z.ZodString; isComplete: z.ZodOptional<z.ZodBoolean>; completionReason: z.ZodOptional<z.ZodString>; iteration: z.ZodNumber; threadId: z.ZodOptional<z.ZodString>; threadResourceId: z.ZodOptional<z.ZodString>; isOneOff: z.ZodBoolean; }, "strip", z.ZodTypeAny, { resourceId: string; result: string; prompt: string; task: string; resourceType: "none" | "tool" | "workflow" | "agent"; iteration: number; isOneOff: boolean; threadId?: string | undefined; threadResourceId?: string | undefined; isComplete?: boolean | undefined; completionReason?: string | undefined; }, { resourceId: string; result: string; prompt: string; task: string; resourceType: "none" | "tool" | "workflow" | "agent"; iteration: number; isOneOff: boolean; threadId?: string | undefined; threadResourceId?: string | undefined; isComplete?: boolean | undefined; completionReason?: string | undefined; }>, import("../..").Step<string, any, any, any, any, import("../..").DefaultEngineType>[]>>; }>; } export {}; //# sourceMappingURL=index.d.ts.map