Interface ISwarmSchema

Interface representing the schema for defining a swarm. Configures the swarm's behavior, navigation, and agent management.

interface ISwarmSchema {
    agentList: string[];
    callbacks?: Partial<ISwarmCallbacks>;
    defaultAgent: string;
    docDescription?: string;
    getActiveAgent?: (
        clientId: string,
        swarmName: string,
        defaultAgent: string,
    ) => string | Promise<string>;
    getNavigationStack?: (
        clientId: string,
        swarmName: string,
    ) => string[] | Promise<string[]>;
    persist?: boolean;
    policies?: string[];
    setActiveAgent?: (
        clientId: string,
        agentName: string,
        swarmName: string,
    ) => void | Promise<void>;
    setNavigationStack?: (
        clientId: string,
        navigationStack: string[],
        swarmName: string,
    ) => Promise<void>;
    swarmName: string;
}

Properties

agentList: string[]

The list of agent names available within the swarm.

callbacks?: Partial<ISwarmCallbacks>

Optional partial set of lifecycle callbacks for the swarm, allowing customization of events.

defaultAgent: string

The default agent name to use when no active agent is specified.

docDescription?: string

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

getActiveAgent?: (
    clientId: string,
    swarmName: string,
    defaultAgent: string,
) => string | Promise<string>

Optional function to fetch the active agent upon swarm initialization.

getNavigationStack?: (
    clientId: string,
    swarmName: string,
) => string[] | Promise<string[]>

Optional function to retrieve the initial navigation stack after swarm initialization.

persist?: boolean

Optional flag to enable serialization of navigation stack and active agent state to persistent storage (e.g., hard drive).

policies?: string[]

Optional array of policy names defining banhammer or access control rules for the swarm.

setActiveAgent?: (
    clientId: string,
    agentName: string,
    swarmName: string,
) => void | Promise<void>

Optional function to update the active agent after navigation changes.

If the update fails (e.g., due to persistence issues).

setNavigationStack?: (
    clientId: string,
    navigationStack: string[],
    swarmName: string,
) => Promise<void>

Optional function to persist the navigation stack after a change.

If persistence fails (e.g., due to storage issues).

swarmName: string

The unique name of the swarm within the system.