@mastra/core
Version:
The core foundation of the Mastra framework, providing essential components and interfaces for building AI-powered applications.
123 lines • 6.11 kB
TypeScript
import type { CoreMessage, GenerateObjectResult, GenerateTextResult, StreamObjectResult, StreamTextResult } from 'ai';
import type { JSONSchema7 } from 'json-schema';
import { z } from 'zod';
import type { ZodSchema } from 'zod';
import { Agent } from '../agent';
import type { AgentGenerateOptions, AgentStreamOptions, AiMessageType } from '../agent';
import { MastraBase } from '../base';
import type { Mastra } from '../mastra';
import type { RuntimeContext } from '../runtime-context';
import type { AgentNetworkConfig } from './types';
export declare class AgentNetwork extends MastraBase {
#private;
constructor(config: AgentNetworkConfig);
formatAgentId(name: string): string;
getTools(): {
readonly transmit: import("../tools").Tool<z.ZodObject<{
actions: z.ZodArray<z.ZodObject<{
agent: z.ZodString;
input: z.ZodString;
includeHistory: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
input: string;
agent: string;
includeHistory?: boolean | undefined;
}, {
input: string;
agent: string;
includeHistory?: boolean | undefined;
}>, "many">;
}, "strip", z.ZodTypeAny, {
actions: {
input: string;
agent: string;
includeHistory?: boolean | undefined;
}[];
}, {
actions: {
input: string;
agent: string;
includeHistory?: boolean | undefined;
}[];
}>, undefined, import("..").ToolExecutionContext<z.ZodObject<{
actions: z.ZodArray<z.ZodObject<{
agent: z.ZodString;
input: z.ZodString;
includeHistory: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
input: string;
agent: string;
includeHistory?: boolean | undefined;
}, {
input: string;
agent: string;
includeHistory?: boolean | undefined;
}>, "many">;
}, "strip", z.ZodTypeAny, {
actions: {
input: string;
agent: string;
includeHistory?: boolean | undefined;
}[];
}, {
actions: {
input: string;
agent: string;
includeHistory?: boolean | undefined;
}[];
}>>>;
};
getAgentHistory(agentId: string): {
input: string;
output: string;
timestamp: string;
}[];
/**
* Get the history of all agent interactions that have occurred in this network
* @returns A record of agent interactions, keyed by agent ID
*/
getAgentInteractionHistory(): {
[x: string]: {
input: string;
output: string;
timestamp: string;
}[];
};
/**
* Get a summary of agent interactions in a more readable format, displayed chronologically
* @returns A formatted string with all agent interactions in chronological order
*/
getAgentInteractionSummary(): string;
executeAgent(agentId: string, input: CoreMessage[], includeHistory?: boolean, runtimeContext?: RuntimeContext): Promise<string>;
getInstructions(): string;
getRoutingAgent(): Agent<string, import("../agent").ToolsInput, Record<string, import("..").Metric>>;
getAgents(): Agent<string, import("../agent").ToolsInput, Record<string, import("..").Metric>>[];
generate(messages: string | string[] | CoreMessage[] | AiMessageType[], args?: AgentGenerateOptions<undefined, undefined> & {
output?: never;
experimental_output?: never;
}): Promise<GenerateTextResult<any, undefined>>;
generate<OUTPUT extends ZodSchema | JSONSchema7>(messages: string | string[] | CoreMessage[] | AiMessageType[], args?: AgentGenerateOptions<OUTPUT, undefined> & {
output?: OUTPUT;
experimental_output?: never;
}): Promise<GenerateObjectResult<OUTPUT>>;
generate<EXPERIMENTAL_OUTPUT extends ZodSchema | JSONSchema7>(messages: string | string[] | CoreMessage[] | AiMessageType[], args?: AgentGenerateOptions<undefined, EXPERIMENTAL_OUTPUT> & {
output?: never;
experimental_output?: EXPERIMENTAL_OUTPUT;
}): Promise<GenerateTextResult<any, EXPERIMENTAL_OUTPUT>>;
stream<OUTPUT extends ZodSchema | JSONSchema7 | undefined = undefined, EXPERIMENTAL_OUTPUT extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage[] | AiMessageType[], args?: AgentStreamOptions<OUTPUT, EXPERIMENTAL_OUTPUT> & {
output?: never;
experimental_output?: never;
}): Promise<StreamTextResult<any, OUTPUT extends ZodSchema ? z.infer<OUTPUT> : unknown>>;
stream<OUTPUT extends ZodSchema | JSONSchema7 | undefined = undefined, EXPERIMENTAL_OUTPUT extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage[] | AiMessageType[], args?: AgentStreamOptions<OUTPUT, EXPERIMENTAL_OUTPUT> & {
output?: OUTPUT;
experimental_output?: never;
}): Promise<StreamObjectResult<any, OUTPUT extends ZodSchema ? z.infer<OUTPUT> : unknown, any>>;
stream<OUTPUT extends ZodSchema | JSONSchema7 | undefined = undefined, EXPERIMENTAL_OUTPUT extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage[] | AiMessageType[], args?: AgentStreamOptions<OUTPUT, EXPERIMENTAL_OUTPUT> & {
output?: never;
experimental_output?: EXPERIMENTAL_OUTPUT;
}): Promise<StreamTextResult<any, OUTPUT extends ZodSchema ? z.infer<OUTPUT> : unknown> & {
partialObjectStream: StreamTextResult<any, OUTPUT extends ZodSchema ? z.infer<OUTPUT> : EXPERIMENTAL_OUTPUT extends ZodSchema ? z.infer<EXPERIMENTAL_OUTPUT> : unknown>['experimental_partialOutputStream'];
}>;
__registerMastra(p: Mastra): void;
}
//# sourceMappingURL=network.d.ts.map