MCPcopy Create free account
hub / github.com/echoVic/blade-code / constructor

Method constructor

src/agent/Agent.ts:60–102  ·  view source on GitHub ↗
(config: AgentConfig = {})

Source from the content-addressed store, hash-verified

58 private isDestroyed = false;
59
60 constructor(config: AgentConfig = {}) {
61 super();
62 this.config = {
63 debug: false,
64 tools: {
65 enabled: true,
66 includeBuiltinTools: true,
67 ...config.tools,
68 },
69 context: {
70 enabled: true,
71 debug: config.debug,
72 ...config.context,
73 },
74 mcp: {
75 enabled: true,
76 ...config.mcp,
77 },
78 components: {
79 debug: config.debug,
80 autoInit: true,
81 ...config.components,
82 },
83 ...config,
84 };
85
86 // 初始化管理器
87 this.llmManager = new LLMManager(this.config.debug);
88 this.componentManager = new ComponentManager(this.config.components);
89
90 // 转发管理器事件
91 this.setupManagerEventForwarding();
92
93 this.log('Agent 实例已创建');
94
95 // 配置 LLM
96 if (this.config.llm) {
97 this.llmManager.configure(this.config.llm);
98 }
99
100 // 自动注册默认组件
101 this.autoRegisterComponents();
102 }
103
104 /**
105 * 初始化 Agent 和所有管理器

Callers

nothing calls this directly

Calls 4

logMethod · 0.95
configureMethod · 0.80

Tested by

no test coverage detected