NewEngine 创建工作流引擎
(config *EngineConfig)
| 158 | |
| 159 | // NewEngine 创建工作流引擎 |
| 160 | func NewEngine(config *EngineConfig) (*Engine, error) { |
| 161 | if config == nil { |
| 162 | config = &EngineConfig{ |
| 163 | MaxConcurrentWorkflows: 100, |
| 164 | MaxConcurrentNodes: 50, |
| 165 | DefaultNodeTimeout: time.Minute * 5, |
| 166 | DefaultWorkflowTimeout: time.Hour * 2, |
| 167 | EnableMetrics: true, |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | engine := &Engine{ |
| 172 | config: config, |
| 173 | executions: make(map[string]*WorkflowExecution), |
| 174 | metrics: &EngineMetrics{}, |
| 175 | security: &SecurityManager{}, |
| 176 | } |
| 177 | |
| 178 | return engine, nil |
| 179 | } |
| 180 | |
| 181 | // SetDependencies 设置依赖 |
| 182 | func (e *Engine) SetDependencies(factory AgentFactory, sessionMgr SessionManager, eventBus EventBus) { |