Skip to content

agents / Exports / AgentFactory

Class: AgentFactory

Agent Factory for creating and managing agents Instance-based for isolated agent factory management

Table of contents

Constructors

Methods

Constructors

constructor

new AgentFactory(options?, lifecycleEvents?): AgentFactory

Parameters

NameType
optionsAgentFactoryOptions
lifecycleEventsAgentLifecycleEvents

Returns

AgentFactory

Defined in

packages/agents/src/managers/agent-factory.ts:68

Methods

initialize

initialize(): Promise<void>

Initialize the factory

Returns

Promise<void>

Defined in

packages/agents/src/managers/agent-factory.ts:100


createAgent

createAgent(AgentClass, config, fromTemplate?): Promise<AgentInterface>

Create a new agent instance

Parameters

NameTypeDefault value
AgentClass(config: AgentConfig) => AgentInterfaceundefined
configPartial<AgentConfig>undefined
fromTemplatebooleanfalse

Returns

Promise<AgentInterface>

Defined in

packages/agents/src/managers/agent-factory.ts:113


createFromTemplate

createFromTemplate(AgentClass, templateId, overrides?): Promise<AgentInterface>

Create agent from template

Parameters

NameType
AgentClass(config: AgentConfig) => AgentInterface
templateIdstring
overridesPartial<AgentConfig>

Returns

Promise<AgentInterface>

Defined in

packages/agents/src/managers/agent-factory.ts:188


registerTemplate

registerTemplate(template): void

Register a template

Parameters

NameType
templateAgentTemplate

Returns

void

Defined in

packages/agents/src/managers/agent-factory.ts:223


unregisterTemplate

unregisterTemplate(templateId): boolean

Unregister a template

Parameters

NameType
templateIdstring

Returns

boolean

Defined in

packages/agents/src/managers/agent-factory.ts:230


getTemplates

getTemplates(): AgentTemplate[]

Get all templates

Returns

AgentTemplate[]

Defined in

packages/agents/src/managers/agent-factory.ts:237


getTemplate

getTemplate(templateId): undefined | AgentTemplate

Get template by ID

Parameters

NameType
templateIdstring

Returns

undefined | AgentTemplate

Defined in

packages/agents/src/managers/agent-factory.ts:244


findTemplates

findTemplates(criteria): AgentTemplate[]

Find templates by criteria

Parameters

NameType
criteriaObject
criteria.category?string
criteria.tags?string[]
criteria.provider?string
criteria.model?string

Returns

AgentTemplate[]

Defined in

packages/agents/src/managers/agent-factory.ts:251


applyTemplate

applyTemplate(template, overrides?): TemplateApplicationResult

Apply template to configuration

Parameters

NameType
templateAgentTemplate
overridesPartial<AgentConfig>

Returns

TemplateApplicationResult

Defined in

packages/agents/src/managers/agent-factory.ts:263


destroyAgent

destroyAgent(agentId): Promise<boolean>

Destroy an agent

Parameters

NameType
agentIdstring

Returns

Promise<boolean>

Defined in

packages/agents/src/managers/agent-factory.ts:270


getCreationStats

getCreationStats(): AgentCreationStats

Get creation statistics

Returns

AgentCreationStats

Defined in

packages/agents/src/managers/agent-factory.ts:305


getActiveAgents

getActiveAgents(): Map<string, AgentInterface>

Get all active agents

Returns

Map<string, AgentInterface>

Defined in

packages/agents/src/managers/agent-factory.ts:312


validateConfiguration

validateConfiguration(config): Object

Validate agent configuration

Parameters

NameType
configPartial<AgentConfig>

Returns

Object

NameType
isValidboolean
errorsstring[]

Defined in

packages/agents/src/managers/agent-factory.ts:319

Released under the MIT License.