Interface IAgentSchemaInternal

Interface representing the configuration schema for an agent. Defines the agent's properties, tools, and lifecycle behavior.

interface IAgentSchemaInternal {
    agentName: string;
    callbacks?: Partial<IAgentSchemaInternalCallbacks>;
    completion?: string;
    connectOperator?: (
        clientId: string,
        agentName: string,
    ) => (message: string, next: (answer: string) => void) => DisposeFn$2;
    dependsOn?: string[];
    docDescription?: string;
    keepMessages?: number;
    map?: (
        message: IModelMessage,
        clientId: string,
        agentName: string,
    ) => IModelMessage<object> | Promise<IModelMessage<object>>;
    mapToolCalls?: (
        tool: IToolCall[],
        clientId: string,
        agentName: string,
    ) => IToolCall[] | Promise<IToolCall[]>;
    maxToolCalls?: number;
    mcp?: string[];
    operator?: boolean;
    prompt?:
        | string
        | (clientId: string, agentName: string) => string | Promise<string>;
    states?: string[];
    storages?: string[];
    system?: string[];
    systemDynamic?: (
        clientId: string,
        agentName: string,
    ) => string[] | Promise<string[]>;
    systemStatic?: string[];
    tools?: string[];
    transform?: (
        input: string,
        clientId: string,
        agentName: string,
    ) => string | Promise<string>;
    validate?: (output: string) => Promise<string>;
    wikiList?: string[];
}

Properties

agentName: string

The unique name of the agent within the swarm.

callbacks?: Partial<IAgentSchemaInternalCallbacks>

Optional lifecycle callbacks for the agent, allowing customization of execution flow.

completion?: string

The name of the completion mechanism used by the agent. REQUIRED WHEN AGENT IS NOT OPERATOR

connectOperator?: (
    clientId: string,
    agentName: string,
) => (message: string, next: (answer: string) => void) => DisposeFn$2

Operator connection function to passthrough the chat into operator dashboard

dependsOn?: string[]

Optional array of agent names this agent depends on for transitions (e.g., via changeToAgent).

docDescription?: string

Optional description for documentation purposes, aiding in agent usage understanding.

keepMessages?: number

Optional maximum number of messages to maintain context size

map?: (
    message: IModelMessage,
    clientId: string,
    agentName: string,
) => IModelMessage<object> | Promise<IModelMessage<object>>

Optional function to map assistant messages, e.g., converting JSON to tool calls for specific models.

Type declaration

    • (
          message: IModelMessage,
          clientId: string,
          agentName: string,
      ): IModelMessage<object> | Promise<IModelMessage<object>>
    • Parameters

      • message: IModelMessage

        The assistant message to process.

      • clientId: string

        The ID of the client interacting with the agent.

      • agentName: string

        The name of the agent.

      Returns IModelMessage<object> | Promise<IModelMessage<object>>

      The transformed assistant message.

mapToolCalls?: (
    tool: IToolCall[],
    clientId: string,
    agentName: string,
) => IToolCall[] | Promise<IToolCall[]>

Optional function to filter or modify tool calls before execution.

Type declaration

    • (
          tool: IToolCall[],
          clientId: string,
          agentName: string,
      ): IToolCall[] | Promise<IToolCall[]>
    • Parameters

      • tool: IToolCall[]

        The array of tool calls to process.

      • clientId: string

        The ID of the client interacting with the agent.

      • agentName: string

        The name of the agent.

      Returns IToolCall[] | Promise<IToolCall[]>

      The filtered or modified tool calls.

maxToolCalls?: number

Optional maximum number of tool calls allowed per completion cycle.

mcp?: string[]

Optional array of mcp names managed by the agent

operator?: boolean

Flag means the operator is going to chat with customer on another side

prompt?:
    | string
    | (clientId: string, agentName: string) => string | Promise<string>

The primary prompt guiding the agent's behavior. REQUIRED WHEN AGENT IS NOT OPERATOR

states?: string[]

Optional array of state names managed by the agent.

storages?: string[]

Optional array of storage names utilized by the agent.

system?: string[]

Optional array of system prompts, typically used for tool-calling protocols.

systemDynamic?: (
    clientId: string,
    agentName: string,
) => string[] | Promise<string[]>

Optional dynamic array of system prompts from the callback

systemStatic?: string[]

Optional array of system prompts, alias for system

tools?: string[]

Optional array of tool names available to the agent.

transform?: (
    input: string,
    clientId: string,
    agentName: string,
) => string | Promise<string>

Optional function to transform the model's output before further processing.

Type declaration

    • (input: string, clientId: string, agentName: string): string | Promise<string>
    • Parameters

      • input: string

        The raw input from the model.

      • clientId: string

        The ID of the client interacting with the agent.

      • agentName: string

        The name of the agent.

      Returns string | Promise<string>

      The transformed output string.

validate?: (output: string) => Promise<string>

Optional function to validate the agent's output before finalization.

Type declaration

    • (output: string): Promise<string>
    • Parameters

      • output: string

        The output string to validate.

      Returns Promise<string>

      A promise resolving to the validated output or null if invalid.

wikiList?: string[]

Optional array of wiki names utilized by the agent.