IAgentSchema

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

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

Optional function to filter or modify tool calls before execution.

maxToolCalls: number

Optional maximum number of tool calls allowed per completion cycle.

keepMessages: number

Optional maximum number of messages to maintain context size

docDescription: string

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

agentName: string

The unique name of the agent within the swarm.

operator: boolean

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

completion: string

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

prompt: string

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

system: string[]

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

systemStatic: string[]

Optional array of system prompts, alias for system

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

Optional dynamic array of system prompts from the callback

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

Operator connection function to passthrough the chat into operator dashboard

tools: string[]

Optional array of tool names available to the agent.

storages: string[]

Optional array of storage names utilized by the agent.

wikiList: string[]

Optional array of wiki names utilized by the agent.

states: string[]

Optional array of state names managed by the agent.

mcp: string[]

Optional array of mcp names managed by the agent

dependsOn: string[]

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

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

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

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

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

map: (message: IModelMessage<object>, 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.

callbacks: Partial<IAgentSchemaCallbacks>

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